mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-28 21:01:06 +00:00
custom bcd usb version
This commit is contained in:
parent
1a1d5c4689
commit
d0b1819aa5
@ -15,6 +15,11 @@ pub struct Config<'a> {
|
||||
pub(crate) vendor_id: u16,
|
||||
pub(crate) product_id: u16,
|
||||
|
||||
/// Device BCD USB version.
|
||||
///
|
||||
/// Default: `0x02` ("2.1")
|
||||
pub bcd_usb: u16,
|
||||
|
||||
/// Device class code assigned by USB.org. Set to `0xff` for vendor-specific
|
||||
/// devices that do not conform to any class.
|
||||
///
|
||||
@ -108,6 +113,7 @@ impl<'a> Config<'a> {
|
||||
vendor_id: vid,
|
||||
product_id: pid,
|
||||
device_release: 0x0010,
|
||||
bcd_usb: 0x02,
|
||||
manufacturer: None,
|
||||
product: None,
|
||||
serial_number: None,
|
||||
|
@ -326,11 +326,11 @@ pub(crate) fn device_descriptor(config: &Config) -> [u8; 18] {
|
||||
18, // bLength
|
||||
0x01, // bDescriptorType
|
||||
0x10,
|
||||
0x02, // bcdUSB 2.1
|
||||
config.device_class, // bDeviceClass
|
||||
config.device_sub_class, // bDeviceSubClass
|
||||
config.device_protocol, // bDeviceProtocol
|
||||
config.max_packet_size_0, // bMaxPacketSize0
|
||||
(config.bcd_usb >> 8) as u8, // bcdUSB
|
||||
config.device_class, // bDeviceClass
|
||||
config.device_sub_class, // bDeviceSubClass
|
||||
config.device_protocol, // bDeviceProtocol
|
||||
config.max_packet_size_0, // bMaxPacketSize0
|
||||
config.vendor_id as u8,
|
||||
(config.vendor_id >> 8) as u8, // idVendor
|
||||
config.product_id as u8,
|
||||
@ -353,13 +353,13 @@ pub(crate) fn device_qualifier_descriptor(config: &Config) -> [u8; 10] {
|
||||
10, // bLength
|
||||
0x06, // bDescriptorType
|
||||
0x10,
|
||||
0x02, // bcdUSB 2.1
|
||||
config.device_class, // bDeviceClass
|
||||
config.device_sub_class, // bDeviceSubClass
|
||||
config.device_protocol, // bDeviceProtocol
|
||||
config.max_packet_size_0, // bMaxPacketSize0
|
||||
1, // bNumConfigurations
|
||||
0, // Reserved
|
||||
(config.bcd_usb >> 8) as u8, // bcdUSB
|
||||
config.device_class, // bDeviceClass
|
||||
config.device_sub_class, // bDeviceSubClass
|
||||
config.device_protocol, // bDeviceProtocol
|
||||
config.max_packet_size_0, // bMaxPacketSize0
|
||||
1, // bNumConfigurations
|
||||
0, // Reserved
|
||||
]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user