diff options
| author | Timo Kröger <[email protected]> | 2022-05-12 07:59:33 +0200 |
|---|---|---|
| committer | Timo Kröger <[email protected]> | 2022-05-12 08:05:13 +0200 |
| commit | 2a7afe4262fd3ff8288c6381598a8794a7beee37 (patch) | |
| tree | b17b54760d820c61913204afab6b39cc899392c8 | |
| parent | 69e0f9f0fea8731fa23b4b62707ca2641f5f301a (diff) | |
Make usb_serial examples work on windows
Windows shows `error 10` when using CDC ACM on non composite devices.
Workaround is to use IADS:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help
| -rw-r--r-- | examples/nrf/src/bin/usb_serial.rs | 7 | ||||
| -rw-r--r-- | examples/nrf/src/bin/usb_serial_multitask.rs | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/examples/nrf/src/bin/usb_serial.rs b/examples/nrf/src/bin/usb_serial.rs index bc41c2acf..f607781a8 100644 --- a/examples/nrf/src/bin/usb_serial.rs +++ b/examples/nrf/src/bin/usb_serial.rs | |||
| @@ -43,6 +43,13 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 43 | config.max_power = 100; | 43 | config.max_power = 100; |
| 44 | config.max_packet_size_0 = 64; | 44 | config.max_packet_size_0 = 64; |
| 45 | 45 | ||
| 46 | // Required for windows compatiblity. | ||
| 47 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | ||
| 48 | config.device_class = 0xEF; | ||
| 49 | config.device_sub_class = 0x02; | ||
| 50 | config.device_protocol = 0x01; | ||
| 51 | config.composite_with_iads = true; | ||
| 52 | |||
| 46 | // Create embassy-usb DeviceBuilder using the driver and config. | 53 | // Create embassy-usb DeviceBuilder using the driver and config. |
| 47 | // It needs some buffers for building the descriptors. | 54 | // It needs some buffers for building the descriptors. |
| 48 | let mut device_descriptor = [0; 256]; | 55 | let mut device_descriptor = [0; 256]; |
diff --git a/examples/nrf/src/bin/usb_serial_multitask.rs b/examples/nrf/src/bin/usb_serial_multitask.rs index 31e0af483..e165cd434 100644 --- a/examples/nrf/src/bin/usb_serial_multitask.rs +++ b/examples/nrf/src/bin/usb_serial_multitask.rs | |||
| @@ -60,6 +60,13 @@ async fn main(spawner: Spawner, p: Peripherals) { | |||
| 60 | config.max_power = 100; | 60 | config.max_power = 100; |
| 61 | config.max_packet_size_0 = 64; | 61 | config.max_packet_size_0 = 64; |
| 62 | 62 | ||
| 63 | // Required for windows compatiblity. | ||
| 64 | // https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/kconfig/CONFIG_CDC_ACM_IAD.html#help | ||
| 65 | config.device_class = 0xEF; | ||
| 66 | config.device_sub_class = 0x02; | ||
| 67 | config.device_protocol = 0x01; | ||
| 68 | config.composite_with_iads = true; | ||
| 69 | |||
| 63 | struct Resources { | 70 | struct Resources { |
| 64 | device_descriptor: [u8; 256], | 71 | device_descriptor: [u8; 256], |
| 65 | config_descriptor: [u8; 256], | 72 | config_descriptor: [u8; 256], |
