Top |
Driver structures need to be defined inside each driver in order for the core library to know what function to call, and the capabilities of the driver and the devices it supports.
struct usb_id { uint16_t vendor; uint16_t product; unsigned long driver_data; };
The struct usb_id is used to declare devices supported by a
particular driver. The driver_data
information is used to
differentiate different models of devices which only need
small changes compared to the default driver behaviour to function.
For example, a device might have a different initialisation from the stock device, so the driver could do:
1 2 3 4 5 |
if (driver_data == MY_DIFFERENT_DEVICE_QUIRK) { ... } else { ... } |
The default value is zero, so the driver_data
needs to be a
non-zero to be useful.