stm32f3xx-hal icon indicating copy to clipboard operation
stm32f3xx-hal copied to clipboard

usb_serial.rs example doesn't work out-of-box

Open kebonly opened this issue 1 year ago • 0 comments

Hello, I'm trying to get the example/usb_serial.rs to work, but I'm getting the following errors at compile time. I am running this on STM32F303VC Discovery board, but the problem seems to be coming from various USB crates.

To run the example, I pass in the feature flag as well like so: cargo run --example usb_serial --features="ld stm32f303xc usb cortex-m/critical-section-single-core"

149 | pub struct UsbBusAllocator<B: UsbBus> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `UsbBusAllocator<_>` is defined in crate `usb_device`
   --> /Users/kevinly/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.3.2/src/bus.rs:152:1
    |
152 | pub struct UsbBusAllocator<B: UsbBus> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `usb_device` are being used?
note: associated function defined here
   --> /Users/kevinly/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usb-device-0.3.2/src/device_builder.rs:85:12
    |
85  |     pub fn new(alloc: &'a UsbBusAllocator<B>, vid_pid: UsbVidPid) -> UsbDeviceBuilder<'a, B> {
    |            ^^^

error[E0599]: no method named `manufacturer` found for struct `usb_device::device::UsbDeviceBuilder` in the current scope
  --> examples/usb_serial.rs:71:10
   |
70 |       let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
   |  _______________________-
71 | |         .manufacturer("Fake company")
   | |         -^^^^^^^^^^^^ method not found in `UsbDeviceBuilder<'_, _>`
   | |_________|
   |

Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `stm32f3xx-hal` (example "usb_serial") due to 3 previous errors

kebonly avatar Jul 10 '24 04:07 kebonly