All descriptors have three common fields like bLength bDescriptorType and bcdUSB. The first one decides the length of the descriptor, the second type indicates its type. The different types of descriptors are:-
1:- Device Descriptors: - The device descriptor represents the entire USB device and hence each device can have a single device descriptor. The idProduct and idVendor fields of device descriptor help the OS to find the appropriate driver for the device
2:- Configuration Descriptor:- The configuration descriptor specifies values such as the amount of power this particular configuration uses, if the device is self or bus powered and the number of interfaces it has. When a device is enumerated, the host reads the device descriptors and can make a decision of which configuration to enable. It can only enable one configuration at a time. Thus multiple configuration descriptors are possible.
3:- Interface descriptor: - This can be seen as a header or leader of a group of endpoints which is dedicated to perform a particular function. For example you could have a multi-function fax/scanner/printer device. Interface descriptor one could describe the endpoints of the fax function, Interface descriptor two the scanner function and Interface descriptor three the printer function. Unlike the configuration descriptor, there is no limitation as to having only one interface enabled at a time. A device could have 1 or many interface descriptors enabled at once. Though there is a system of identifying the primary and/or the secondary interface descriptor by judging the fields like bInterfaceNumber (specifying the Interface number) and a bAlternateSetting
4: - Endpoint Descriptor: - Endpoint descriptors are used to describe endpoints other than endpoint0. Endpoint zero is always assumed to be a control endpoint and is configured before any descriptors are even requested. The host will use the information returned from these descriptors to determine the bandwidth requirements of the bus
5: - String Descriptor: - These provides information to the end user and hence contains human readable data like the name “ Jetflash Mass Storage Device” which we are used to see in the property of a USB device.
Enumeration Steps:-
Enumeration is the initialization process by which an OS detects a device and specifies its power requirement, which class of device, type of data transfer it supports. The steps of enumeration in a windows machine are as follows:-
1:- First when the device is inserted in the USB connection of the machine, host gives it a time of 100ms for the power stabilization
2:- The device is assigned an address 0 by default by the host controller. No matter how many devices are attached to the host controller all those will be assigned as address 0 in the beginning and hence the multiple devices attached to the host are enumerated one by one and not simultaneously
3:- The host asks for the device descriptor
4: After receiving initial 8 bytes of the device descriptor the host assigns a reset command
5: The host now assigns an address to the device by issuing a set address command. The address issued by the host ranges from 1 to 127. Thus we are able to connect 127 devices to each host
6:- The remaining bytes of the device descriptor are asked for
7:- The host then asks for the configuration descriptor and then for the interface descriptor to determine the overall size and the types or no. of function to be performed by the device.
8:- The host then asks for string descriptor if there is any
After all these steps depending upon the idProduct and idVendor as provided by the device descriptor the OS will search for the device driver. If it founds one then it loads the driver and then pops up a message near the taskbar that “an USB device has been recognized “. If the OS can not load any driver then it will show the message “the device is not recognized”.