How to find ioctl callback function inside the driver source

How can you see which code a module executes when your app calls an ioctl system call? Consider this situation: You app gets to the point where it executes an ioctl syscall and returns an error, e.g. if (ioctl(fd, STVMIX_IOC_DISCONNECTLAYERS, &STVMIX_Ioctl_DisconnectLayers) != 0) { /* IOCTL failed */ ErrorCode = ST_ERROR_BAD_PARAMETER; printf (” STVMIX_DisconnectLayers():Ioctl error […]

Continue reading


How to convert UNIX datetime value to date/time string in OpenOffice Calc or Excel

To convert a UNIX datetime value to date/time string in OpenOffice Calc or Excel use this formula (assumes your datetime stamp is in the A1 cell of the current spreadsheet): =A1/86400+DATEVALUE(“1/1/1970”) If you want to test the above you may use the following simple C program: ======= #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> […]

Continue reading


Converting defines to strings in precompiler directives

Often times it is useful to construct a string visible to the pre-compiler and assemble it from one more more other values, defined by means of a #define dierctive. Here’s some example code (this is some custom environemnt config for U-Boot for a STM-based device I work with): #if defined( DEVELOPER_ALAN ) #define CONFIG_ETHADDR 00:23:b0:00:00:00 […]

Continue reading


GDB – how to step into uClibc if you have .debug files

1. Make sure your debuginfo files are part of LD_LIBRARY_PATH. To do this, either a) add the path where you stored the .debug files to your LD_LIBRARY_PATH environment variable, e.g.: $ export LD_LIBRARY_PATH=/opt/STM/STLinux-2.3/devkit/sh4_uclibc/target/usr/lib/debug:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../lib:/opt/STM/STMCR1.5.0/lib:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../../../host/stmc/lib Then restart gdb. OR b) start gdb and set the LD_LIBRARY_PATH from within gdb: (gdb) set env LD_LIBRARY_PATH /opt/STM/STLinux-2.3/devkit/sh4_uclibc/target/usr/lib/debug:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../lib:/opt/STM/STMCR1.5.0/lib:/opt/STM/STLinux-2.3/devkit/sh4_uclibc/bin/../../../host/stmc/lib In my case […]

Continue reading