|
|

|
|
Listing 1: These descriptors for a USB joystick are included in the
device
firmware. They include the device, configuration, and interface descriptors
required for every device, plus the HID class descriptor and a descriptor for
an interrupt IN endpoint
|
device_desc_table:
db 12h ; Descriptor length (18 bytes)
db 01h ; Descriptor type (Device)
db 00h,01h ; Complies to USB Spec. Release (1.00)
db 00h ; Class code (0)
db 00h ; Subclass code (0)
db 00h ; Protocol (No specific protocol)
db 08h ; Max. packet size for Endpoint 0 (8 bytes)
db B4h,04h ; Vendor ID (Cypress)
db 1Fh,0Fh ; Product ID (joystick = 0x0F1F)
db 88h,02h ; Device release number (2.88)
db 00h ; Mfr. string descriptor index (None)
db 00h ; Product string descriptor index (None)
db 00h ; Serial No. string descriptor index (None)
db 01h ; Number of possible configurations (1)
end_device_desc_table:
config_desc_table:
db 09h ; Descriptor
length (9 bytes)
db 02h ; Descriptor type (Configuration)
db 22h,00h ; Total data length (34 bytes)
db 01h ; Interface supported (1)
db 01h ; Configuration value (1)
db 00h ; Index of string descriptor (None)
db 80h ; Configuration (Bus powered)
db 32h ; Maximum power consumption (100mA)
Interface_Descriptor:
db 09h ; Descriptor length (9 bytes)
db 04h ; Descriptor type (Interface)
db 00h ; Number of interface (0)
db 00h ; Alternate setting (0)
db 01h ;
Number of endpoints supported
db 03h ; Class code ()
db 00h ; Subclass code ()
db 00h ; Protocol code ()
db 00h ; Index of string()
Class_Descriptor:
db 09h ; Descriptor length (9 bytes)
db 21h ; Descriptor type (HID)
db 00h,01h ; HID class release number (1.00)
db 00h ; Localized country code (None)
db 01h ; No. of HID class descriptors to follow (1)
db 22h ; Report descriptor type (HID)
; Total length of
report descriptor
db (end_hid_report_desc_table - hid_report_desc_table),00h
Endpoint_Descriptor:
db 07h ; Descriptor length (7 bytes)
db 05h ; Descriptor type (Endpoint)
db 81h ; Encoded address (Respond to IN, 1 endpoint)
db 03h ; Endpoint attribute (Interrupt transfer)
db 06h,00h ; Maximum packet size (6 bytes)
db 0Ah ; Polling interval (10 millisecs)
end_config_desc_table:
|
|
|
|
|