gii_cmd_event is the basic structure for evCommand and evInformation events. It may need to be casted to some other structure (depending on code) to access the data.
#define GII_CMD_DATA_MAX (248-sizeof(gii_cmd_nodata_event)) /* These are used internally either to the application or the * kernel. The same event is used for both Command and Information * events. The recipient must not store references to the data. If * the data information is needed afterwards, copy it! */ typedef struct gii_cmd_event { COMMON_DATA; uint32 code; /* command/request code */ uint8 data[GII_CMD_DATA_MAX]; /* command related data */ } gii_cmd_event;
One use of evCommand is to convey some capabilities of a GII device:
/* This event is sent/received to require/get the capabilities of a device * as specified in target/origin. * An event stating num_buttons=num_axes=0 says, that the device is inactive, * unplugged, whatever. Devices automatically report (detectable) state * changes via devinfo. But you need to re-query the valinfo records. */ #define GII_CMDCODE_GETDEVINFO (0x01) typedef struct gii_cmddata_getdevinfo { char longname[75]; char shortname[5]; gii_event_mask can_generate; int num_buttons; /* Maximum number of buttons. */ int num_axes; /* Maximum number of axes. */ } gii_cmddata_getdevinfo;
This event is guaranteed to be generated immediately after opening an input source.
can_generate is a mask of all events that the device can generate. num_buttons and num_axes are the number of buttons and axes that the device can report on.