Development: How to develop drivers for USB based devices

From LinuxTVWiki
Revision as of 17:25, 29 January 2008 by CityK (talk | contribs) (start page -- info taken from "Afatech AF9015" article ... initial info likely written by Andrew Leech, and submitted under the name (corona). Later expanded)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article is meant to serve as an introduction to the task of developing a driver for a usb based dvb device. Currently, in terms of this subject, there are a number of scattered resources available that, when organized together, could form the basis of a howto suitable for the noice developer. Hence, it might be very worthwile documenting the process.

Initial Steps

The very first thing you would want to do is to identify the components used in your device. Refer to the section entitled "Gathering Information About Your Unidentified/Unsupported Device" for some clues on how to proceed with that task.

The next logical step would be to try to obtain technical datasheets on the components. Many chip manufacturers make this documentation readiablily available, while in other cases a google search for the chip's part or model number is necessary to track down other sources for such documentation.

Familiarizing yourself with a USB driver

To start with, there are some great Linux USB tutorials on Linux Journal:

In addition, get the source code for the LinuxTV V4L-DVB driver set. You will find that USB based DVB drivers are contained within the ./v4l-dvb/linux/drivers/media/dvb/dvb-usb directory. Have a bit of a browse through them while you're reading through the first article listed above, and try to get a feel for how the driver is put together (note: there is also a procedure about this that is described in a thread found here). Sometimes you can get a good head start in your own development efforts by attempting to leverage parts of earlier released code -- that which may have been written specifically for the exact same chip as contained in your own device or via code for a near similar chip, such as say from a previous production generation. Simply, modifying existing code to suite your own endeavour can greatly expediate the process of driver development.

Some useful tools

  • usbsnoop - a Windows USB sniffer utilitly, which adheres to the WDM architecture
  • parser.pl - a script for parsing the huge usbsniff log file
  • USB Replay - allows one to replay parsed usbsnoop logfiles on a Linux system
  • USBmon
  • Usbmon2usbsnoop - a script that converts the output from usbmon to a format that is compatible with USB Replay

Also See