usb: Allow partial packet writes, add error checking and documentation#848
Merged
Grazfather merged 75 commits intoZigEmbeddedGroup:mainfrom Jan 26, 2026
Merged
usb: Allow partial packet writes, add error checking and documentation#848Grazfather merged 75 commits intoZigEmbeddedGroup:mainfrom
Grazfather merged 75 commits intoZigEmbeddedGroup:mainfrom
Conversation
There was a problem hiding this comment.
🔍 Lint Results
Found 1 issue on changed lines in 1 file:
- core/src/core/usb/drivers/cdc.zig: 1 issue
ℹ️ Additional issues on unchanged lines
The following 14 issue(s) exist but are not on lines changed in this PR:
core/src/core/usb.zig:357: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb.zig:359: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb.zig:429: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/cdc.zig:217: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/hid.zig:93: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/hid.zig:103: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/hid.zig:116: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/types.zig:149: Suggestion: Rename `U16Le` to `U16_Le`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/raspberrypi/rp2xxx/src/custom_clock_config.zig:11: TODO style comments need to have a linked microzig issue on the same line.
examples/raspberrypi/rp2xxx/src/usb_cdc.zig:14: Suggestion: Rename `UsbSerial` to `USB_Serial`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:11: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:64: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:183: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:223: TODO style comments need to have a linked microzig issue on the same line.
Updating with new lint results
There was a problem hiding this comment.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 14 issue(s) exist but are not on lines changed in this PR:
core/src/core/usb.zig:358: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb.zig:360: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb.zig:430: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/cdc.zig:216: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/hid.zig:93: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/hid.zig:103: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/drivers/hid.zig:116: TODO style comments need to have a linked microzig issue on the same line.
core/src/core/usb/types.zig:149: Suggestion: Rename `U16Le` to `U16_Le`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/raspberrypi/rp2xxx/src/custom_clock_config.zig:11: TODO style comments need to have a linked microzig issue on the same line.
examples/raspberrypi/rp2xxx/src/usb_cdc.zig:14: Suggestion: Rename `UsbSerial` to `USB_Serial`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:11: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:64: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:183: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:223: TODO style comments need to have a linked microzig issue on the same line.
There was a problem hiding this comment.
🔍 Lint Results
ℹ️ Additional issues on unchanged lines
The following 6 issue(s) exist but are not on lines changed in this PR:
core/src/core/usb/descriptor/hid.zig:17: Suggestion: Rename `Hid` to `HID`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/raspberrypi/rp2xxx/src/custom_clock_config.zig:11: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:11: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:64: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:183: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:223: TODO style comments need to have a linked microzig issue on the same line.
There was a problem hiding this comment.
🔍 Lint Results
Found 6 issues on changed lines in 1 file:
- core/src/core/usb/types.zig: 6 issues
ℹ️ Additional issues on unchanged lines
The following 8 issue(s) exist but are not on lines changed in this PR:
core/src/core/usb/descriptor/hid.zig:17: Suggestion: Rename `Hid` to `HID`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
examples/raspberrypi/rp2xxx/src/custom_clock_config.zig:11: TODO style comments need to have a linked microzig issue on the same line.
examples/raspberrypi/rp2xxx/src/usb_hid.zig:83: TODO style comments need to have a linked microzig issue on the same line.
examples/raspberrypi/rp2xxx/src/usb_hid.zig:14: Suggestion: Rename `HidDriver` to `HID_Driver`, it _should_ be more in line with our [style guidelines](https://microzig.tech/docs/contributing/). This automation is not perfect so take it with a grain of salt.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:11: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:64: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:183: TODO style comments need to have a linked microzig issue on the same line.
port/raspberrypi/rp2xxx/src/hal/clocks/common.zig:223: TODO style comments need to have a linked microzig issue on the same line.
Updating with new lint results
All lint issues have been resolved
08c5a92 to
6867b90
Compare
All lint issues have been resolved
Grazfather
reviewed
Jan 25, 2026
Collaborator
Grazfather
left a comment
There was a problem hiding this comment.
Looks really good so far. Still have to review half of the files
b01afa4 to
87a8ca9
Compare
Grazfather
reviewed
Jan 25, 2026
Grazfather
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
usb_start_tx->ep_writev, now returns number of bytes writtenusb_start_rx->ep_readvandep_listen: This makes it easier to make interrupt-safe drivers