Bug in receiving CDC-ACM serial state notifications
Posted: Tue Jul 15, 2025 3:02 pm
I'm working on interfacing an ESP32-S3 to a USB CDC-ACM serial adapter. Right now I'm in the early stages so I'm just working from the cdc_acm_host example. I'm trying to get the ESP32-S3 to read the state of the DSR signal, however it seems there's a bug in how it handles the state notify event. When I toggle the state of DSR, the following is printed:
The state never changes and always print 0xCBFC even though the DSR state changed. If I hook the USB CDC-ACM serial adapter to Linux and fire up Kermit, I can see the state of the DSR pin properly reflects the actual state, so I know the adapter works correctly.
Trying to figure out if maybe the state bits were somewhere else in the notify event, I modified cdc_acm_host.c to add a hexdump of the data:
When I toggle DSR, I see:
It looks like what is being printed for state is actually the two low bytes of a pointer to some data.
Is the state notification USB packet not being decoded correctly?
Code: Select all
I (11225) USB-CDC: Serial state notif 0xCBFC
W (11235) USB-CDC: Unsupported CDC event: 2
I (11735) USB-CDC: Serial state notif 0xCBFC
W (11735) USB-CDC: Unsupported CDC event: 2
Trying to figure out if maybe the state bits were somewhere else in the notify event, I modified cdc_acm_host.c to add a hexdump of the data:
Code: Select all
case USB_CDC_NOTIF_SERIAL_STATE: {
ESP_LOG_BUFFER_HEXDUMP("FOZZTEXX", notif, 16, ESP_LOG_INFO);
cdc_dev->serial_state.val = *((uint16_t *)notif->Data);
Code: Select all
I (13455) FOZZTEXX: 0x3fc9cc04 a1 20 00 00 00 00 02 00 fc cb c9 3f 48 00 00 00 |. .........?H...|
I (13455) USB-CDC: Serial state notif 0xCBFC
W (13455) USB-CDC: Unsupported CDC event: 2
I (13955) FOZZTEXX: 0x3fc9cc04 a1 20 00 00 00 00 02 00 fc cb c9 3f 48 00 00 00 |. .........?H...|
I (13955) USB-CDC: Serial state notif 0xCBFC: DSR: 0
W (13965) USB-CDC: Unsupported CDC event: 2
Is the state notification USB packet not being decoded correctly?