-
Notifications
You must be signed in to change notification settings - Fork 134
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
Reading individual USB packets. #250
Comments
This is definitely something useful when it comes to communicating with embedded devices. Could you flesh out your idea and the goal bit more? Maybe there are already tailored solution to this readily available: For example postcard-rpc which supports raw USB transport and could be even used on top of existing USB serial protocols without interfering directly with the latter. And it allows to share the exact same protocol/interface definition code between the devices communicating. The serialport library operates on top of the device drivers which abstract the USB communication with the actual device away. Directly speaking to a USB serial device from the serialport crate is effectively incorporating a userspace driver for a certain USB serial protocol into the crate. |
My idea was simple: Instead of providing only Read/Write to be able to read a USB frame through methods. |
Do you know more about how to achieve this? I'm asking because I don't know of an interface where serialport could get/inspect the USB traffic from a USB serial device. The device driver abstracts this completely away an just exposes data and device control though the serial device serialport-rs operates on. |
As far as I saw, it can't. I thought that serialport uses something like I took a look at postcard-rpc and indeed there, at least for the cobs encoder/decoder, the crate itself allows you to find the frames' ends and decode each (see https://docs.rs/cobs/latest/cobs/fn.decode_in_place.html). I'm still looking around to get a general feeling this can be achieved (in serialport or not). I'm open to ideas too. |
USB data packets are usually up to 64 bytes and I would like to be able to read those packets instead of reading just raw bytes when they come (Read).
This could greatly improve building protocols for embedded firmware as you can use the same exact encoding on the device side and on the host side.
The text was updated successfully, but these errors were encountered: