When the USB system has identified that a driver must be started from a file-system. The USBDeviceDriver$Path path will be searched for a driver. The drivers must be stored in application directories (i.e. are preceded by an ! and contain a !Run file) which are named according to the following specification.
For a class driver, the directory name is !cc-sc-ppU
For a vendor/product driver, the directory name is in the form of !cc-sc-ppU.!vvvv-iiii
Code | Name | Base | Pad Length |
---|---|---|---|
cc | class code | hex | 2 |
sc | sub-class code | hex | 2 |
pp | Protocol code | hex | 2 |
vvvv | Vendor Code | hex | 4 |
iiii | Product Code | hex | 4 |
The default contents of the USBDeviceDriver$Path are the DevDriver directory inside the booted copy of !USB. The device driver can either add the directory containing itself to this path, or be installed within the !USB.DevDriver directory. Device drivers should not modify any other part of !USB without prior permission.
If a suitable driver is located its !Run file will be executed with the following command string. The device is automatically claimed by the USB system for the device driver. Because of this the driver does not need to use the unclaimed device pool, except to release the device.
Arguments are passed on the command line containing the relevant information about the device.
Log file / temporary file the textual name of the host controller the device is on the device number in decimal
These are followed by a list of endpoints, each item being joined to the next by a '-' character, in the form of two decimals separated by a '/' character. The first entry in the item is the endpoint reference, the second the endpoint number containing info about the type (in, out, bulk, etc.).
Further parameters are prefixed by switches
Format | Entry | Type |
---|---|---|
-s | Serial number | serial number of device |
-m | Vendor ID | vendor id (decimal) |
-p | product ID | product id (decimal) |
-devmsg | ptr to msg | pointer to the device message that launched the driver |
The devmsg field (new device message) should be stored for later use if the driver wishes to release the device once finished with it, or can be used to extract the same data as passed in to the driver via the command line.
A device driver should return as soon as possible after being started, and therefore if the driver is not able to multi-task it should start itself within a task window to allow the rest of the system to continue.