tud_cdc_connected() or tud_cdc_line_state_cb() problem when unplug USB connector
Discussed in https://github.com/hathach/tinyusb/discussions/1185
Originally posted by mastupristi November 11, 2021
hi,
I'm using tinyUsb 0.12.0, on i.MX RT1051.
I'm successfully using the tud_cdc_line_state_cb() callback to be notified when on the PC I connect/disconnect to the ttyACM0 (on PC I use minicom).
The scenario is: with the usb cable plugged in I run minicom and the tud_cdc_line_state_cb() is called with dtr=1. In the moment I quit minicom the tud_cdc_line_state_cb() is called with dtr=0.
The problem arises if, with minicom running, i unplug the usb cable. In that case the tud_cdc_line_state_cb() is not called. But when I plug the cable back in it is called again with dtr=1.
This makes it difficult if not impossible to code state machines take into account the connection state.
Is this behavior intentional? How can I be notified of the cable disconnection?
best regards Max
any news about this? is there a fix? is it already available in v0.16.0? What about RT117x? I think they have the problem too, is that right?
regards Max