Skip to content

Implementation of postcard-rpc using usb-gadget (OTG)#142

Merged
jamesmunns merged 11 commits into
jamesmunns:mainfrom
genkiinstruments:usb-gadget-server
Dec 4, 2025
Merged

Implementation of postcard-rpc using usb-gadget (OTG)#142
jamesmunns merged 11 commits into
jamesmunns:mainfrom
genkiinstruments:usb-gadget-server

Conversation

@dingari

@dingari dingari commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

Allows Linux systems with access to a UDC supporting OTG gadget mode to run as a postcard-rpc server (device mode).

Adds usb-gadget dependency and requires --features usb-gadget

I added a small ping example in the examples directory.

I've tested this on a Radxa CM5 board with both Linux and macOS hosts with good results.

Note: I've left send_log_str and send_log_fmt unimplemented (I don't use them and I don't understand fully how they work), but would probably be easy to port the impl from one of the eusb servers.

@dingari

dingari commented Oct 22, 2025

Copy link
Copy Markdown
Collaborator Author

I'm not really sure how the ci works here, but the server-usb-gadget example only builds (and makes sense) on Linux.

How can we tell the CI only to build that specific example on Linux, or somehow let rustc know not to attempt to link it?

@jamesmunns

Copy link
Copy Markdown
Owner

Hey @dingari, right now:

  • ci.sh runs on win/mac/linux
  • ci-stubs.sh runs on mac/linux

If you need this to only be run on linux, feel free to make a new ci-linuxonly.sh or something, and add a new step to https://github.com/jamesmunns/postcard-rpc/blob/main/.github/workflows/ci.yml.

@dingari

dingari commented Oct 23, 2025

Copy link
Copy Markdown
Collaborator Author

Makes sense, thanks! Fwiw it may just be enough to do cargo check on that specific example with a linux target. At least the CI script is OK on my Macbook. Let's see how it fares on GA.

@dingari

dingari commented Oct 23, 2025

Copy link
Copy Markdown
Collaborator Author

I rebased this on top of main (too bad missing the 0.12 release). I think this should be OK to merge in the next release?

P.s. I also filled in the send_log_* by referring to the eusb impl (although I feel like there's a lot of potential for reuse in that logic).

@jamesmunns

Copy link
Copy Markdown
Owner

Thanks @dingari! Let's see if CI is green now, happy to cut a 0.12.1 release once we have this ready.

@dingari

dingari commented Oct 24, 2025

Copy link
Copy Markdown
Collaborator Author

Cool, I just added max_usb_frame_size to init to make it conform with the new changes in 0.12.0.

@dingari

dingari commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator Author

Hey @jamesmunns any idea on when a new release might be released? :)

@jamesmunns jamesmunns merged commit 53ff965 into jamesmunns:main Dec 4, 2025
3 checks passed
@jamesmunns

Copy link
Copy Markdown
Owner

@dingari thanks for the reping! v0.12.1 is now released! 🎉

@dingari dingari deleted the usb-gadget-server branch February 11, 2026 12:23
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