Skip to content

Add USB and HID stream transports - #444

Open
chuxubank wants to merge 5 commits into
flyte:developfrom
OpenXingZhi:feat/usb-streams
Open

chuxubank wants to merge 5 commits into
flyte:developfrom
OpenXingZhi:feat/usb-streams

Conversation

@chuxubank

Copy link
Copy Markdown
Contributor

Summary

  • add configurable PyUSB and HID stream transports
  • install the USB runtime/build dependencies required by container deployments
  • release the configured USB interface exactly once during cleanup
  • add a mocked cleanup regression test and run it in CI

The branch was rebuilt on the latest upstream/develop; device-specific demo scripts and unrelated fork CI changes were intentionally excluded.

Verification

  • pytest mqtt_io/tests/test_stream_usb.py: 1 passed
  • pylint -d fixme mqtt_io: 10.00/10
  • strict mypy mqtt_io: 67 source files, no issues
  • Behave suite: 7 features and 27 scenarios passed
  • uv build: sdist and wheel built successfully
  • workflow YAML parsed and the USB test step was confirmed

Runtime note

A physical USB/HID device was not available for hardware validation. Dockerfile checking was attempted, but the local Docker daemon was not running.

@chuxubank
chuxubank force-pushed the feat/usb-streams branch 2 times, most recently from 3098094 to f4327bc Compare September 22, 2026 09:43
@chuxubank

Copy link
Copy Markdown
Contributor Author

Moved device reopen/retry out of this branch onto a separate PR. This branch is back to the USB and HID transports, the ARM image dependencies, and the poller drain.

@chuxubank

Copy link
Copy Markdown
Contributor Author

Moved the USB read contract into this pull request: a timeout is an empty read, any other USB error is raised, and the default read timeout is 1000 ms. Device reopen stays in #446.

@BenjiU BenjiU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good.
Thanks for your contribution

Release the configured USB interface during cleanup and cover the behavior with a focused CI regression test.
CI failed on linux/arm/v7 because hidapi has no wheel and its setup
looks up libusb via pkg-config, which was missing from the runtime image.
A read that returns data is followed immediately by another read, so a
frame already split across two device buffers is not held for read_interval.
One millisecond is shorter than a USB transfer, so the default timeout
made an idle scanner look like it had no data. Keep a timeout as an empty
read, and raise any other USB error.
CI rejected the untyped return on _patched.
@chuxubank

chuxubank commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest develop (59da598).

Conflict resolution keeps both behaviors: a failed read still reopens the stream, and a read that returns data is still published immediately instead of waiting another read_interval. Also annotated _patched so the strict mypy check that failed on the previous head can pass.

This branch has not been deployed

No deployments
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