Monday, October 2, 2006

hacking usb device drivers->part 2

This is the second article from “Hacking USB device drivers” series. In this part will be covered device supporting mechanism by USB device drivers.

  • Adding vendor and product IDs for USB drivers (read)
  • Adding support for new devices to USB drivers
    • Introduction
    • Modify dev_devs[] structure

Adding support for new devices to USB drivers

Introduction
All USB devices have vendor ID, product ID and device class. USB device can be attached to driver allocated with supported IDs and/or classes. Typically in USB driver you can see dev_devs[] structure, where dev is a device name. In this structure listed supported products.
USB device drivers can be founded in /usr/src/sys/dev/usb/ directory.

Modify dev_devs[] structure
For example, in uplcom(4) driver uplcom_devs[] structure contain strings like following line:
{ USB_VENDOR_SIEMENS3, USB_PRODUCT_SIEMENS3_X75 },
These lines can be founded in usbdevs_data.h file:
{
USB_VENDOR_SIEMENS3, USB_PRODUCT_SIEMENS3_X75,
"X75",
},
For adding support of new product to USB device driver all you need is modify dev_devs[] structure.

No comments: