devctl()

Hi,

I want to understand how devctl() works, in the developer support of QNX they don’t precise how we can use for example __DIOTF(class, cmd, data), we have a different class, but what about cmd, I saw in an example that he use different numbers but I don’t know what those numbers represent.

The command and the data_in and/or data_out, are private between you and your driver. The o/s only creates and sends a devctl message with your command and data. All the data you send “in” will be part of the message.

That said, you should pick an appropriate class and create your dcmd_xxx.h from a standard model i.e. usr/include/sys/dcmd_chr.h

for example :
#define __DIOTF(class, cmd, data) ((sizeof(data)<<16) + ((class)<<8) + (cmd) + _POSIX_DEVDIR_TOFROM)

the class _DCMD_MISC correspond to a number
#define _DCMD_MISC 0x05

and same thing for cmd it’s a number.

how I can create my dcmd_xxx and how devctl will interpret it ?

Does this help

qnx.com/developers/docs/660/ … evctl.html

qnx.com/developers/docs/660/ … EVCTL.html

devctl is just a communication layer between your driver & your other program (like a phone is a communication layer between 2 people). It doesn’t know/care about what numbers you use (or language 2 people speak over a phone). Your driver & other program are what has to know what those numbers mean.

Tim