What I don't understand is HOW to define my own *additional* ioctl
numbers and using them from the userspace.
I've been trying something like this in the kernel module:
#define IOCTL_APP_TYPE 'k'
#define USER_APP_IOCTL _IOWR(IOCTL_APP_TYPE,0, struct iwreq *)
but I have no clues about what that 'k' means.
Moreover, when using SIOCIWFIRSTPRIV+N (wit N witin 0 and 32), as the
ioctl number, everything works fine, while when using my own
"USER_APP_IOCTL" the driver ioctl handler is not triggered and I get
-1 as ret value from ioctl(...).
I don't know if this is of any help to you, but the printk of
USER_APP_IOCTL gives me a negative number which smells fishy..
Consider I'm a newbie with regards to this topic so take it easy on
me :)
Thanks in advance,
RM
The steps I'm missing are
(1) where in wireless tools the "_IO" macros are used (if they are)
(2) where in wireless tools the 'k' is defined and how the association
with the kernel module is obtained.
Did you read the file 'Documentation/ioctl_numbers.txt' in the
kernel sources? I guess that it should answer several of your
questions quite well. About the ioctl number: the thing called
here 'IOCTL_APP_TYPE' is a 1-byte value that becomes, together
with the second argument of the _IO(R|W) macro part of the ioctl
number. One way to pick something is to use the major device
number for this, the other to pick one from the file in the
documentation listed as not yet used. But in your case it
certainly makes sense to stay with the one that already is
used, in this case 'k' and just use something not used yet just
for the second number (by the way, you should start with N set
to 1 and not 0 for the new ioctls you're adding, otherwise you
would redefine the one or SIOCIWFIRSTPRIV (given that this is
the last already used)).
You put the defines for these numbers into a header file that
gets included when you build your module, but that also
gets included by user-space programs that want to call these
ioctls. Then everything should work out fine.
Regards, Jens
--
\ Jens Thoms Toerring ___ j...@toerring.de
\__________________________ http://toerring.de