usb_new_device() -> usb_get_device_descriptor()
usb_get_device_descriptor() 读入整个设备描述结构
设备中有:设备描述块 USB_DT_DEVICE
接口描述块 USB_DT_INTERFACE
配置描述块 USB_DT_CONFIG
端口描述块 USB_DT_ENDPOINT
从设备读入的16位整数都是"little ending"的格式,所以要把它们转换成主机CPU所采用的格式
int usb_get_device_descriptor(struct usb_device *dev)
{
int ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor,
sizeof(dev->descriptor));
if (ret >= 0) {
le16_to_cpus(&dev->descriptor.bcdUSB);
le16_to_cpus(&dev->descriptor.idVendor);
le16_to_cpus(&dev->descriptor.idProduct);
le16_to_cpus(&dev->descriptor.bcdDevice);
}
return ret;
}