Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

SmittyHalibut
Copy link

@SmittyHalibut SmittyHalibut commented Feb 22, 2025

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

I submitted #500 for the build issues.

@@ -1,2 +1,3 @@
pico_rp2040_tinyusb_host
CH32V20x_EVT
feather_rp2040_tinyusb
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #500

@@ -1,2 +1,3 @@
pico_rp2040_tinyusb_host
CH32V20x_EVT
feather_rp2040_tinyusb
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #500

@@ -1 +1,2 @@
pico_rp2040_tinyusb_host
feather_rp2040_tinyusb
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #500

@SmittyHalibut SmittyHalibut marked this pull request as ready for review March 1, 2025 18:43
@SmittyHalibut SmittyHalibut changed the title CDC Notification Endpoint, so we can send CTS/DSR/DCD/RI. CDC Notification Endpoint, so we can send DSR/DCD/RI. Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant