> #define APM_IOC_REJECT _IOW('A', 0, struct apm_event_info)
> #define APM_IOC_STANDBY _IO('A', 1)
> #define APM_IOC_SUSPEND _IO('A', 2)
> #define APM_IOC_GETPOWER _IOR('A', 3, struct apm_power_info)
> ...
>
> I'm yet to figure out what the 0, 1, 2 and 3 (to 6) arguments really
> do but these defines seem to use ioccom.h to create the "request" part
> of an ioctl call. You'll notice these correspond to the apm_action
> enum in apm-proto.h
They are arbitrary. If you look at the _IO etc. macros, you will see what I
mean.
The way all this works is that you predefine your ioctl labels, then use the
*same* constants in both the kernel and userland. The difference between the 2
arg and 3 arg ones is that the 'W' and 'R' are for write and read respectively,
and you are declaring that you are writing or reading an object of type X. There
is also an _IOWR macro AFAIR.
The letter (arg 1) is a label to help distinguish between conflicting subsystems
that may accessible through a single device, and the number (arg 2) is simply a
sequence.
Peter
|