I am trying to use the FpIOCtl in the BASEUNIX unit. Guess what? the
only thing I get back is -1 !
Is there any example code available on how to talk to a kernel module?
The only kernel that I know to talk to is the one that I am trying is
the one that I am writing myself. I am not too familiar with writing
device drivers in C. Therefore I would apreciate if someone could sent
me an example of a SIMPLE "char" module.
So far, I could register the device using
"register_chrdev(major, name, &fops)"
This seems to work, since I then see the driver in: /proc/modules
/proc/devices and /sys/modules
My next step is to issue an FPIOCTL commant but the return code is -1
and the driver never sees the command.
Do I need open a "file deccriptor" in order to communicate using IOCTL?
It should not be?
I have spent the week-end on this, and failed again ... My self esteem
is close to nul at this point. Help please...
As always: RTFM, reading the man page (man 2 ioctl) actually might help
| [...] The argument d must be an open file descriptor.
| Usually, on success zero is returned. A few ioctls use
| the return value as an output parameter and return a non
| negative value on success. On error, -1 is returned, and
| errno is set appropriately.
BTW, I agree - writing device drivers sucks. I know. :-)