Adafruit_TinyUSB_Arduino icon indicating copy to clipboard operation
Adafruit_TinyUSB_Arduino copied to clipboard

CDC Notification Endpoint, so we can send DSR/DCD/RI.

Open SmittyHalibut opened this issue 9 months ago • 5 comments

See #491

The goal is to implement the Notification endpoint in the CDC ACM spec so we can send hardware flow control signals up to the host.

~~Draft for now. I'm looking for code reviews. For the obvious stuff: style, improvements, etc.~~

~~But also: It doesn't work yet. My computer doesn't seem to be sending events to the Notification endpoint. At least, my code doesn't seem to be getting triggered at all.~~

~~I am NOT an expert at USB stack coding (this is my first time.) I'm hoping there's a simple "Oh, you forgot that it's Thursday. You need to flip this bit and tickle that widget and poke this bear, and it'll work."~~

~~There's some extra debugging code in here that I'll remove before fully submitting the PR; it's in there for testing.~~

Figured it out; see below.

SmittyHalibut avatar Feb 22 '25 01:02 SmittyHalibut

Figured it out. I was queueing the notification in the callback, which only gets called after the notification is sent. I moved the queueing to set_serial_state instead, and call it again from the call back in case the state changed while we were notifying of the last change.

And some other general clean up too.

SmittyHalibut avatar Mar 01 '25 17:03 SmittyHalibut

I had to move #include "Adafruit_USBD_CDC.h" before #include "Arduino.h" so that it would include my locally modified version, instead of the version that's included in architecture core libraries. Otherwise, automatic checks in github were failing.

Let me know if you'd prefer to accept the build-check failures and keep the #include where it is.

SmittyHalibut avatar Mar 01 '25 18:03 SmittyHalibut

Another failed build check, but this one doesn't look related to my changes: https://github.com/adafruit/Adafruit_TinyUSB_Arduino/actions/runs/13607387549/job/38040486407?pr=493

SmittyHalibut avatar Mar 01 '25 18:03 SmittyHalibut

I submitted https://github.com/adafruit/Adafruit_TinyUSB_Arduino/issues/500 for the build issues.

SmittyHalibut avatar Mar 01 '25 18:03 SmittyHalibut

Fixed merge conflicts.

SmittyHalibut avatar Mar 20 '25 22:03 SmittyHalibut