diff options
| author | Lucas Kent <[email protected]> | 2025-12-17 17:41:53 +1100 |
|---|---|---|
| committer | Lucas Kent <[email protected]> | 2025-12-18 07:44:16 +1100 |
| commit | 14d847e1b26ec35b91af50c573af32551437456c (patch) | |
| tree | 92c5be4f4eed2d9168985f21a0e608819f018036 /examples | |
| parent | cade3b5396fc91e41551d6a95d3393523c730c90 (diff) | |
Fix rp webusb example on windows
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/rp/src/bin/usb_webusb.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/rp/src/bin/usb_webusb.rs b/examples/rp/src/bin/usb_webusb.rs index 5cecb92f0..edc9a0c52 100644 --- a/examples/rp/src/bin/usb_webusb.rs +++ b/examples/rp/src/bin/usb_webusb.rs | |||
| @@ -26,6 +26,7 @@ use embassy_rp::usb::{Driver as UsbDriver, InterruptHandler}; | |||
| 26 | use embassy_usb::class::web_usb::{Config as WebUsbConfig, State, Url, WebUsb}; | 26 | use embassy_usb::class::web_usb::{Config as WebUsbConfig, State, Url, WebUsb}; |
| 27 | use embassy_usb::driver::{Driver, Endpoint, EndpointIn, EndpointOut}; | 27 | use embassy_usb::driver::{Driver, Endpoint, EndpointIn, EndpointOut}; |
| 28 | use embassy_usb::msos::{self, windows_version}; | 28 | use embassy_usb::msos::{self, windows_version}; |
| 29 | use embassy_usb::types::InterfaceNumber; | ||
| 29 | use embassy_usb::{Builder, Config}; | 30 | use embassy_usb::{Builder, Config}; |
| 30 | use {defmt_rtt as _, panic_probe as _}; | 31 | use {defmt_rtt as _, panic_probe as _}; |
| 31 | 32 | ||
| @@ -56,7 +57,7 @@ async fn main(_spawner: Spawner) { | |||
| 56 | let mut config_descriptor = [0; 256]; | 57 | let mut config_descriptor = [0; 256]; |
| 57 | let mut bos_descriptor = [0; 256]; | 58 | let mut bos_descriptor = [0; 256]; |
| 58 | let mut control_buf = [0; 64]; | 59 | let mut control_buf = [0; 64]; |
| 59 | let mut msos_descriptor = [0; 256]; | 60 | let mut msos_descriptor = [0; 512]; |
| 60 | 61 | ||
| 61 | let webusb_config = WebUsbConfig { | 62 | let webusb_config = WebUsbConfig { |
| 62 | max_packet_size: 64, | 63 | max_packet_size: 64, |
| @@ -83,6 +84,14 @@ async fn main(_spawner: Spawner) { | |||
| 83 | // In principle you might want to call msos_feature() just on a specific function, | 84 | // In principle you might want to call msos_feature() just on a specific function, |
| 84 | // if your device also has other functions that still use standard class drivers. | 85 | // if your device also has other functions that still use standard class drivers. |
| 85 | builder.msos_descriptor(windows_version::WIN8_1, 0); | 86 | builder.msos_descriptor(windows_version::WIN8_1, 0); |
| 87 | builder.msos_writer().configuration(0); | ||
| 88 | builder.msos_writer().function(InterfaceNumber(0)); | ||
| 89 | builder.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); | ||
| 90 | builder.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( | ||
| 91 | "DeviceInterfaceGUIDs", | ||
| 92 | msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), | ||
| 93 | )); | ||
| 94 | builder.msos_writer().function(InterfaceNumber(1)); | ||
| 86 | builder.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); | 95 | builder.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); |
| 87 | builder.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( | 96 | builder.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( |
| 88 | "DeviceInterfaceGUIDs", | 97 | "DeviceInterfaceGUIDs", |
