Skip to content

fix(cdc-acm): expose serial state notifications - #37

Merged
s00d merged 1 commit into
s00d:mainfrom
Oscariremma:fix/cdc-acm-serial-state
Jul 31, 2026
Merged

fix(cdc-acm): expose serial state notifications#37
s00d merged 1 commit into
s00d:mainfrom
Oscariremma:fix/cdc-acm-serial-state

Conversation

@Oscariremma

@Oscariremma Oscariremma commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

CDC ACM devices can report modem-state changes through an interrupt endpoint on the control interface.
This endpoint was previously left unread, which can cause some devices to stop processing subsequent USB traffic.

This PR reads CDC SERIAL_STATE notifications and exposes the reported carrier detect, data set ready, and ring indicator values through modem_status().
CTS remains unsupported because it is not part of the CDC serial-state notification.

Devices without a notification endpoint continue to return the default modem status.


Summary by cubic

Read CDC ACM interrupt-IN serial-state notifications and expose DCD, DSR, and RI via modem_status(). Also consume and manage the control interrupt endpoint to prevent stalls and clean up on failure or close.

  • New Features

    • Expose DCD, DSR, RI via modem_status() from CDC SERIAL_STATE notifications; CTS not supported.
    • Return default modem status when no notification endpoint is present.
  • Bug Fixes

    • Consume the control interrupt-IN endpoint and release it/interfaces on close or init failure to avoid stalls and allow retries.
    • Validate notification payloads and surface errors from malformed frames.

Written for commit 72204ea. Summary will update on new commits.

Review in cubic

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread crates/android-usb-serial/src/drivers/cdc_acm.rs Outdated
@Oscariremma
Oscariremma force-pushed the fix/cdc-acm-serial-state branch from 9078bb6 to 72204ea Compare July 29, 2026 14:42
@s00d
s00d merged commit 0f5a944 into s00d:main Jul 31, 2026
1 check passed
@s00d

s00d commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR — merged.

Published as android-usb-serial 0.1.1 (plugin 3.0.2).

Follow-up on main: malformed / unrelated interrupt frames are skipped instead of killing the notification reader (same approach as usb-serial-for-android), plus wIndex filtering and padded packet support.

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.

2 participants