ESP32S3 as usb host, how to get device's PROD_STR

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

ESP32S3 as usb host, how to get device's PROD_STR

Postby TRYOKETHEPEN » Fri Nov 10, 2023 6:29 am

My ESP32S3 works as usb host, connected with a usb device. The device's information:
  1. ---------------------- Device Descriptor ----------------------
  2. bLength : 0x12 (18 bytes)
  3. bDescriptorType : 0x01 (Device Descriptor)
  4. bcdUSB : 0x200 (USB Version 2.0) -> but device is Full-Speed only
  5. bDeviceClass : 0x00 (defined by the interface descriptors)
  6. bDeviceSubClass : 0x00
  7. bDeviceProtocol : 0x00
  8. bMaxPacketSize0 : 0x08 (8 bytes)
  9. idVendor : 0x05E0 (Zebra Technologies)
  10. idProduct : 0x1200
  11. bcdDevice : 0x0201
  12. iManufacturer : 0x01 (String Descriptor 1)
  13. Language 0x0409 : "ᄅSymbol Technologies, Inc, 2002"
  14. iProduct : 0x02 (String Descriptor 2)
  15. Language 0x0409 : "Symbol Bar Code Scanner"
  16. iSerialNumber : 0x03 (String Descriptor 3)
  17. Language 0x0409 : "S/N:C8820020FD115541B46BDB1CBA3D5E16 Rev:NBRPPAAQ3"
  18. bNumConfigurations : 0x01 (1 Configuration)
  19. Data (HexDump) : 12 01 00 02 00 00 00 08 E0 05 00 12 01 02 01 02 ................
  20. 03 01 ..
I want to get the iProduct string "Symbol Bar Code Scanner", how should I do?

I found a function declaration at "esp-idf-v5.1.1/components/esp_rom/include/esp32s3/rom/usb/usb_descriptor.h" :
  1. bool usb_get_descriptor(uint16_t type_index, uint16_t lang_id,
  2.                         int32_t *len, uint8_t **data);
It seems that this function can meets my need, but it has no definition.

I try to add log out at "hub.c" as follows:
尝试打印.PNG
尝试打印.PNG (54.52 KiB) Viewed 509 times
but only get problem unicode:
得到乱码.PNG
得到乱码.PNG (52.01 KiB) Viewed 509 times

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

Re: ESP32S3 as usb host, how to get device's PROD_STR

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

I've solved this problem.
Refer to "test_hid_basic.c", use "hid_host_get_device_info()" to get device's info.

Who is online

Users browsing this forum: cistern and 267 guests