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

usbio: migrate to nusb instead of the libusb-rs #10

Open
XVilka opened this issue Jun 20, 2024 · 5 comments
Open

usbio: migrate to nusb instead of the libusb-rs #10

XVilka opened this issue Jun 20, 2024 · 5 comments

Comments

@XVilka
Copy link

XVilka commented Jun 20, 2024

Currently, libusb-rs is unmaintained. What's worse, latest Rust (1.79) isn't able to compile it anymore because of the cargo changes:

Two most promising alternatives are:

@orangecms
Copy link

I'm using rusb in another project:
https://github.com/orangecms/sg_boot

You're suggesting nusb in the title, could you elaborate a bit what your opinion is on each? :)

@XVilka
Copy link
Author

XVilka commented Aug 10, 2024

Both are fine, it's just nusb is pure Rust, not a binding to anything like rusb

@orangecms
Copy link

I gave it a shot: https://github.com/platform-system-interface/fastboot/tree/nusb

The getvar example sorta works, but my target device hangs after it. I do get the expected reponse though.

Any idea?

I essentially rewrote the usbio crate based on https://github.com/probe-rs/probe-rs/blob/bba1bb553cc8b80902f498b7e7be4ba085197dcf/probe-rs/src/probe/usb_util.rs

@orangecms
Copy link

I figured it out:

Per https://android.googlesource.com/platform/system/core/+/master/fastboot/README.md the read buffer must be max. 512 bytes for super speed, but the current code has FB_MAX_REPLY_LEN set to 64 - changing that to 512 lets me do multiple runs. :)

orangecms added a commit to platform-system-interface/fastboot that referenced this issue Aug 11, 2024
The libusb wrapper is outdated. nusb is a fully native Rust USB library.
This resolves JustPretender#10 <JustPretender#10>.
@orangecms
Copy link

I've cleaned it up and pushed everything to main.

https://github.com/platform-system-interface/fastboot

Should we move there to continue discussions? Feel free to open issues, I just enabled it. :)

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

No branches or pull requests

2 participants