1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > usb_get_device_descriptor()

usb_get_device_descriptor()

时间:2020-12-06 03:46:26

usb_get_device_descriptor()

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;

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读