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

feat: Receive data over USB #35

Merged
merged 5 commits into from
Aug 20, 2024
Merged

feat: Receive data over USB #35

merged 5 commits into from
Aug 20, 2024

Conversation

kienvo
Copy link
Member

@kienvo kienvo commented Jul 11, 2024

Resolve #24

Changes:

  • Enable debugging over uart. It's required to modify Makefile to turn debugging on.
  • Remove usbdev header and .c files from StdPeriphDriver. The library only have 4 endpoint supported while the chip have capable of 8. And its design is kind of cumbersome.
  • Redesign usbdev to handle device requests and route to interfaces. Each interface will have their own request handler.
  • Add a composite hiddev to receive data from led-name-badge-ls32. This hiddev was implemented for sending data to the host for future uses.
  • Add a composite cdc-acm serial to easily receive data from the host. e.g. stty -F /dev/ttyACM0 raw && cat ledbadge.bin > /dev/ttyACM0. This cdc serial was implemented for sending data to the host and act like an uart tx, which could be useful for logging.

Summary by Sourcery

This pull request adds the ability to receive data over USB by implementing a composite HID device and a CDC-ACM serial interface. It also includes a redesign of the USB device handling to support more endpoints and introduces debugging over UART.

  • New Features:
    • Introduced USB data reception capability with a composite HID device for receiving data from led-name-badge-ls32 and a composite CDC-ACM serial interface for data reception from the host.
  • Enhancements:
    • Redesigned USB device handling to support up to 8 endpoints, improving flexibility and performance.
    • Added debugging over UART, which can be enabled by modifying the Makefile.
  • Build:
    • Updated Makefile to include new USB source files and allow enabling debugging by uncommenting a line.

@mariobehling
Copy link
Member

@sourcery-ai review

Copy link
Contributor

sourcery-ai bot commented Jul 22, 2024

Reviewer's Guide by Sourcery

This pull request implements the feature to receive data over USB by redesigning the USB device handling and adding new composite devices for HID and CDC-ACM serial communication. It also enables debugging over UART and removes the old USB device implementation from the StdPeriphDriver.

File-Level Changes

Files Changes
src/usb/composite/hiddev.c
src/usb/composite/cdc-serial.c
src/usb/dev.c
src/usb/ctrl.c
src/usb/setup.c
src/usb/utils.c
src/usb/debug.c
src/usb/utils.h
src/usb/usb.h
src/usb/debug.h
Added new USB device handling implementation, including HID and CDC-ACM serial functionalities, control endpoint handling, setup, utilities, and debugging.
CH5xx_ble_firmware_library/StdPeriphDriver/inc/CH58x_usbdev.h
CH5xx_ble_firmware_library/StdPeriphDriver/CH58x_usbdev.c
Removed old USB device implementation from StdPeriphDriver.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @kienvo - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Hard-coded USB vendor information found. (link)
  • Hard-coded USB product information found. (link)
  • Hard-coded USB serial number found. (link)
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🔴 Security: 3 blocking issues
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@fcartegnie fcartegnie merged commit f5874d6 into fossasia:master Aug 20, 2024
1 check passed
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.

Receive data over USB
3 participants