aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-usb/src/builder.rs6
-rw-r--r--embassy-usb/src/descriptor.rs24
2 files changed, 18 insertions, 12 deletions
diff --git a/embassy-usb/src/builder.rs b/embassy-usb/src/builder.rs
index e1bf8041f..c7d83e710 100644
--- a/embassy-usb/src/builder.rs
+++ b/embassy-usb/src/builder.rs
@@ -15,6 +15,11 @@ pub struct Config<'a> {
15 pub(crate) vendor_id: u16, 15 pub(crate) vendor_id: u16,
16 pub(crate) product_id: u16, 16 pub(crate) product_id: u16,
17 17
18 /// Device BCD USB version.
19 ///
20 /// Default: `0x02` ("2.1")
21 pub bcd_usb: u16,
22
18 /// Device class code assigned by USB.org. Set to `0xff` for vendor-specific 23 /// Device class code assigned by USB.org. Set to `0xff` for vendor-specific
19 /// devices that do not conform to any class. 24 /// devices that do not conform to any class.
20 /// 25 ///
@@ -108,6 +113,7 @@ impl<'a> Config<'a> {
108 vendor_id: vid, 113 vendor_id: vid,
109 product_id: pid, 114 product_id: pid,
110 device_release: 0x0010, 115 device_release: 0x0010,
116 bcd_usb: 0x02,
111 manufacturer: None, 117 manufacturer: None,
112 product: None, 118 product: None,
113 serial_number: None, 119 serial_number: None,
diff --git a/embassy-usb/src/descriptor.rs b/embassy-usb/src/descriptor.rs
index 06ebe0481..8824a0355 100644
--- a/embassy-usb/src/descriptor.rs
+++ b/embassy-usb/src/descriptor.rs
@@ -326,11 +326,11 @@ pub(crate) fn device_descriptor(config: &Config) -> [u8; 18] {
326 18, // bLength 326 18, // bLength
327 0x01, // bDescriptorType 327 0x01, // bDescriptorType
328 0x10, 328 0x10,
329 0x02, // bcdUSB 2.1 329 (config.bcd_usb >> 8) as u8, // bcdUSB
330 config.device_class, // bDeviceClass 330 config.device_class, // bDeviceClass
331 config.device_sub_class, // bDeviceSubClass 331 config.device_sub_class, // bDeviceSubClass
332 config.device_protocol, // bDeviceProtocol 332 config.device_protocol, // bDeviceProtocol
333 config.max_packet_size_0, // bMaxPacketSize0 333 config.max_packet_size_0, // bMaxPacketSize0
334 config.vendor_id as u8, 334 config.vendor_id as u8,
335 (config.vendor_id >> 8) as u8, // idVendor 335 (config.vendor_id >> 8) as u8, // idVendor
336 config.product_id as u8, 336 config.product_id as u8,
@@ -353,13 +353,13 @@ pub(crate) fn device_qualifier_descriptor(config: &Config) -> [u8; 10] {
353 10, // bLength 353 10, // bLength
354 0x06, // bDescriptorType 354 0x06, // bDescriptorType
355 0x10, 355 0x10,
356 0x02, // bcdUSB 2.1 356 (config.bcd_usb >> 8) as u8, // bcdUSB
357 config.device_class, // bDeviceClass 357 config.device_class, // bDeviceClass
358 config.device_sub_class, // bDeviceSubClass 358 config.device_sub_class, // bDeviceSubClass
359 config.device_protocol, // bDeviceProtocol 359 config.device_protocol, // bDeviceProtocol
360 config.max_packet_size_0, // bMaxPacketSize0 360 config.max_packet_size_0, // bMaxPacketSize0
361 1, // bNumConfigurations 361 1, // bNumConfigurations
362 0, // Reserved 362 0, // Reserved
363 ] 363 ]
364} 364}
365 365