ctl function

The ctl function handles a driver-specific devctl() command. The prototype for this function is:

int ctl(
      void *hdl,
      int cmd,
      void *msg,
      int msglen,
      int *nbytes,
      int *info );

The arguments are:

hdl
The handle returned by the init function.
cmd
The device command.
msg
A pointer to the message buffer. The function can change the contents of the buffer.
msglen
The length of the message buffer, in bytes.
nbytes
The number of bytes being returned. This must not be greater than msglen.
info
A pointer to a location where the function can store extra status information returned by devctl().

The function must return:

EOK
Success.
Any other errno value
Failure.