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

Split usbip protocol de/serialization from server handler #31

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

h7x4
Copy link
Collaborator

@h7x4 h7x4 commented Sep 6, 2023

This PR splits all byte de/serialization from the handler into its own contained module.
This might seem like a lot of extra boilerplate right now, but I'm planning to create another PR where I'll reuse this logic.

I've also marked all of these items as public API, which might be useful for people using the package only for reading and/or writing packages, rather than the server loop. Network monitoring software similar to wireshark might find this useful.

As a by-product, these things have also been fixed:

  • Setup env_logger before every test
  • Use consistent path/busid format for both default device and server
  • debug_assert that path/busid lengths don't overflow
  • Throw proper error message on old USB/IP version
  • Send proper USB/IP error on USBIP_CMD_SUBMIT with invalid ep
  • Flip wrongly placed traces for in/out transfer on USBIP_CMD_SUBMIT
  • Send proper USB/IP error on USBIP_CMD_UNLINK with no attached device
  • Handle iso_packet_descriptors properly
  • Multiple debug_asserts during de/serialization to ensure sane behaviour

This also fixes the following:

- Use consistent `path`/`busid` format for both default device and server
- `debug_assert` that `path`/`busid` lengths don't overflow
- Throw proper error message on old USB/IP version
- Send proper USB/IP error on `USBIP_CMD_SUBMIT` with invalid `ep`
- Flip wrongly placed traces for in/out transfer on `USBIP_CMD_SUBMIT`
- Send proper USB/IP error on `USBIP_CMD_UNLINK` with no attached device
- Handle `iso_packet_descriptor`s properly
- Multiple `debug_assert`s during de/serialization to ensure sane
  behaviour
@h7x4 h7x4 added the enhancement New feature or request label Sep 6, 2023
@h7x4 h7x4 mentioned this pull request Oct 26, 2023
9 tasks
@h7x4 h7x4 requested a review from jiegec October 26, 2023 11:46
@jiegec jiegec merged commit 5fe58fb into jiegec:master Oct 26, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants