usb host如何获得 USB设备的描述字符串

TRYOKETHEPEN
Posts: 4
Joined: Fri Nov 10, 2023 3:52 am

usb host如何获得 USB设备的描述字符串

Postby TRYOKETHEPEN » Fri Nov 10, 2023 5:40 am

在usb_descriptor.h中有函数声明:
函数声明.PNG
函数声明.PNG (25.1 KiB) Viewed 3712 times
但是并没有对应的函数定义。

请问如何根据index、langid来得到描述符字符串?

比如我的USB设备为:
---------------------- Device Descriptor ----------------------
bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x200 (USB Version 2.0) -> but device is Full-Speed only
bDeviceClass : 0x00 (defined by the interface descriptors)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00
bMaxPacketSize0 : 0x08 (8 bytes)
idVendor : 0x05E0 (Zebra Technologies)
idProduct : 0x1200
bcdDevice : 0x0201
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "ᄅSymbol Technologies, Inc, 2002"
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "Symbol Bar Code Scanner"
iSerialNumber : 0x03 (String Descriptor 3)
Language 0x0409 : "S/N:C8820020FD115541B46BDB1CBA3D5E16 Rev:NBRPPAAQ3"
bNumConfigurations : 0x01 (1 Configuration)
Data (HexDump) : 12 01 00 02 00 00 00 08 E0 05 00 12 01 02 01 02 ................
03 01 ..

想要获得"Symbol Bar Code Scanner"这个字符串。
尝试增加如下打印:
尝试打印.PNG
尝试打印.PNG (54.52 KiB) Viewed 3712 times
得到乱码:
得到乱码.PNG
得到乱码.PNG (52.01 KiB) Viewed 3712 times

TRYOKETHEPEN
Posts: 4
Joined: Fri Nov 10, 2023 3:52 am

Re: usb host如何获得 USB设备的描述字符串

Postby TRYOKETHEPEN » Fri Nov 10, 2023 8:36 am

解决了 在test_hid_basic.c中有相关示例
利用hid_host_get_device_info()

Who is online

Users browsing this forum: No registered users and 163 guests