usb protocol

12
USB Protocol USB Protocol CET 316 CET 316 By John C. Johnston By John C. Johnston

Upload: leighanna-gamble

Post on 30-Dec-2015

22 views

Category:

Documents


0 download

DESCRIPTION

USB Protocol. CET 316 By John C. Johnston. USB Programming. Enumeration Descriptors Descriptors Device Descriptor Configuration Descriptor Interface Descriptor HID descriptor Report Descriptor Endpoint Descriptor Data Transmission to host. USB Protocol. USB Protocol. USB Protocol. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: USB Protocol

USB ProtocolUSB Protocol

CET 316CET 316

By John C. JohnstonBy John C. Johnston

Page 2: USB Protocol

USB ProgrammingUSB Programming

Enumeration Descriptors Enumeration Descriptors DescriptorsDescriptors

Device DescriptorDevice Descriptor Configuration DescriptorConfiguration Descriptor Interface DescriptorInterface Descriptor HID descriptorHID descriptor Report DescriptorReport Descriptor Endpoint DescriptorEndpoint Descriptor

Data Transmission to hostData Transmission to host

Page 3: USB Protocol

USB ProtocolUSB Protocol

Page 4: USB Protocol

USB ProtocolUSB Protocol

Page 5: USB Protocol

USB ProtocolUSB Protocol

Page 6: USB Protocol

USB ProgrammingUSB ProgrammingDevice DescriptorDevice Descriptor

Field Designation Field Description Value

bLength This field which gives the size of the descriptor 12h

bDescriptorType This field gives the USB specification release of the device 01h

bcdUSB This field gives the USB specification release of the device 00h, 01h

bDeviceClass This field contains the class code of the device 00h

bDeviceSubclass This field defines the subclass code used by the device 00h

bDeviceProtocol This field defines the protocol by which the selected class or subclass work 00h

MaxEPO This field contains the maximum size of the packet for endpoint 0 08h

idVendor This field gives a numeric identification of the vendor of the device. 88h,88h

idProduct This field gives a numeric identification code to the device 45h,02h

bcdDevice This identifies the BCD coded value of the release number of the device 00h,01h

iManufacturer This is an index that points to a string describing the manufacturer (optional) 00h

iProduct This is an index that points to a string describing the Product (optional) 00h

iSerialNumber This is an index of the string descriptor containing the serial number 00h

bNumConfigurations This field contains the number of possible configurations 01h

Page 7: USB Protocol

USB ProgrammingUSB ProgrammingConfiguration DescriptorConfiguration Descriptor

Field Designation Field Description Value

bLength this field contains the size of this descriptor 09h

bDescriptorType This field contains the constant of the descriptor Configuration (02h) 02h

wTotalLength this field contains the size of all data returned for this configuration in bytes 22h,00h

bNumInterfaces This field contains the number of interfaces the configuration supports 01h

bConfigurationValue this field contains the identifiers for Set_Configuration and the Get_configuration requests 01h

iConfiguration this field contains the index of the string descriptor for the configuration 00h

bmAttributes the field contains the Self power, Bus power, and remote wakeup settings 80h

MaxPower this field specifies how much bus current a device requires from the host to run 32h

Page 8: USB Protocol

USB ProgrammingUSB ProgrammingInterface DescriptorInterface Descriptor

Field Designation Field Description Value

bLength This field contains the descriptor size in bytes 09h

bDescriptorType this field contains the constant for the interface descriptor (04h) 04h

bInterfaceNumber number identifying this interface descriptor 00h

bAlternateSettings the content value of this field is used to select alternate settings 00h

bNumEndpoints this field designates the number of endpoints supported 01h

bInterfaceClass This field defines the USB defined class for transfer 03h

bInterfaceSubclass this field contains the subclass code as it is defined by the interface 00h

bInterfaceProtocol this field contains the protocol code as it is defined by the interface 00h

iInterface this field contains the index for the string descriptor for the interface 00h

Page 9: USB Protocol

USB ProgrammingUSB ProgrammingHID DescriptorHID Descriptor

Field Designation Field Description Value

bLength this field contains the length of this descriptor in bytes 09h

bDescriptorType this identifies the HID class for this descriptor with the value 21h

bcdHID this field contains the HID specification number that this device complies with in binary decimal coded format

00h,01h

bCountryCode this field contains the code for localizing the hardware to a specific country 00h

bNumDescriptors this field contains the number of class descriptors that are under influence of this descriptor

01h

bDescriptorType this field contains the type (report or physical) of descriptor controlled under this descriptor and must support at least one report descriptor

22h

wDescriptorLength this field contains the length of the report of physical descriptor defined in the previous field

00h

Additional bDescriptorType and wDescriptorLength

fields

for the purposes of multiple report or physical descriptors that might follow None used

Page 10: USB Protocol

USB ProgrammingUSB ProgrammingReport DescriptorReport Descriptor

Field Designation Value

USAGE_PAGE (Generic Desktop) 05h,01h

USAGE (Joystick) 09h,04h

COLLECTION (Application) A1h,01h

USAGE (Pointer) 09h,01h

COLLECTION (Physical) A1h,00h

USAGE_PAGE (Button) 05h,09h

USAGE_MINIMUM (Button 1) 19h,01h

USAGE_MAXIMUM (Button 16) 29h,10h

LOGICAL_MINIMUM (0) 15h,00h

LOGICAL_MAXIMUM (1) 25h,01h

PHYSICAL_MINIMUM (0) 35h,00h

PHYSICAL_MAXIMUM (1) 45h,01h

REPORT_SIZE (1) 75h,01h

REPORT_COUNT (16) 95h,10h

INPUT (Data,Var,Abs) 81h,02h

Field Designation Value

USAGE_PAGE (Generic Desktop) 05h,01h

USAGE (X) 09h,30h

USAGE (Y) 09h,31h

LOGICAL_MINIMUM (0) 15h,00h

LOGICAL_MAXIMUM (255) 26h,FFh,00h

PHYSICAL_MINIMUM (0) 35h,00h

PHYSICAL_MAXIMUM (255) 46h, FFh,00h

Unit (None (2 bytes)) 66h,00h,00h

REPORT_SIZE (8) 75h,08h

REPORT_COUNT (2) 95h,02h

INPUT (Data,Var,Abs) 81h,02h

USAGE_PAGE (Generic Desktop) 05h,01h

USAGE (RZ) 09h,32h

USAGE (Slider) 9h,35h

LOGICAL_MINIMUM (0) 15h,00h

Page 11: USB Protocol

USB ProgrammingUSB ProgrammingReport Descriptor continuedReport Descriptor continued

Field Designation Value

LOGICAL_MAXIMUM (255) 26h, FFh,00h

PHYSICAL_MINIMUM (0) 35h,00h

PHYSICAL_MAXIMUM (255) 46h, FFh,00h

Unit (None (2 bytes)) 66h,00h,00h

REPORT_SIZE (8) 75h,08h

REPORT_COUNT (2) 95h,02h

INPUT (Data,Var,Abs) 81h,02h

END_COLLECTION C0h

END_COLLECTION C0h

Page 12: USB Protocol

USB ProgrammingUSB ProgrammingEndpoint DescriptorEndpoint Descriptor

Field Designation Field Description Value

bLength this field contains the descriptor size in bytes 07h

bDescriptorType This field contains the constant for Endpoint 05h

bEndpointAddress this field contains the number and direction of the Endpoint 81h

bmAttributes this defines the transfer type supported by the Endpoint 03h

wMaxPacketSize this field defines the maximum packet size supported by the Endpoint 06h,00h

bInterval this contains the maximum latency for polling interrupt Endpoints 0Ah