Skip to content

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

Open
@kebonly

Description

@kebonly

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions