rust-embedded-community / usb-device

Experimental device-side USB framework for microcontrollers in Rust.
MIT License
437 stars 75 forks source link

Switch from libusb to rusb #59

Closed lkolbly closed 3 years ago

lkolbly commented 3 years ago

It appears that the original libusb is no longer maintained. In anticipation of adding isochronous endpoints to the test class (someday, anyway), this PR upgrades to rusb, which appears to be the most commonly used libusb fork.

The only change was replacing the lifetime parameter of DeviceHandles with a UsbContext, which I hardcoded to the Context struct.

I tested this by deploying test_class firmware to a imxrt1062 and running the test, all ten cases passed:

test_class_host starting
looking for device...

running 10 tests
test control_request ... ok
test control_data ... ok
test control_data_static ... ok
test control_error ... ok
test string_descriptors ... ok
test interface_descriptor ... ok
test bulk_loopback ... ok
test interrupt_loopback ... ok
test bench_bulk_write ... ok
  16 transfers of 65536 bytes in 1.027s -> 8.171Mbit/s
test bench_bulk_read ... ok
  16 transfers of 65536 bytes in 0.970s -> 8.651Mbit/s
0 failed, 10 succeeded

ALL TESTS PASSED!
mvirkkunen commented 3 years ago

Good idea, thanks!