I'm trying to run the CDC-ACM Usb Host example with an FTDI RS485 adapter but my ESP32S2 fails to identify it as a serial device. The bDeviceClass, bDeviceSubClass and bDeviceProtocol fields of the device descriptor are all zero.
Code to list some of the fields:
Code: Select all
usb_device_handle_t current_device;
// Open USB device
if (usb_host_device_open(GetCdcAcm(), dev_addr_list[i], ¤t_device) != ESP_OK) {
Serial1.println("failed to open device");
continue; // In case we failed to open this device, continue with next one in the list
}
const usb_device_desc_t *device_desc;
ESP_ERROR_CHECK(usb_host_get_device_descriptor(current_device, &device_desc));
const usb_config_desc_t *config_desc;
usb_host_get_active_config_descriptor(current_device, &config_desc);
const usb_standard_desc_t *this_desc = (const usb_standard_desc_t *)config_desc;
int desc_offset = 0;
this_desc = usb_parse_next_descriptor(this_desc, config_desc->wTotalLength, &desc_offset);
Serial1.println(device_desc->idVendor); // 0x0403
Serial1.println(device_desc->idProduct); // 0x6001
Serial1.println(device_desc->bDeviceClass);
Serial1.println(device_desc->bDeviceSubClass);
Serial1.println(device_desc->bDeviceProtocol);
Serial1.println(device_desc->iSerialNumber);
Serial1.println(device_desc->bMaxPacketSize0);
Serial1.println(device_desc->bDescriptorType);
Serial1.println(device_desc->bNumConfigurations);
Serial1.println(config_desc->wTotalLength);
Serial1.println(config_desc->bDescriptorType);
Serial1.println(config_desc->bNumInterfaces);
Serial1.println(this_desc->bDescriptorType);
const usb_intf_desc_t* interface_desc = (const usb_intf_desc_t*) this_desc;
Serial1.println(interface_desc->bInterfaceClass);
Serial1.println(interface_desc->bInterfaceSubClass);
Serial1.println(interface_desc->bInterfaceProtocol);
1027
24577
0
0
0
3
8
1
1
32
2
1
4
255
255
255
The adapter works fine with windows as a serial port. How to make it work with ESP-IDF?