aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb/src
diff options
context:
space:
mode:
authorEekle <[email protected]>2024-12-24 12:53:06 +0100
committerEekle <[email protected]>2024-12-24 12:53:06 +0100
commit0f4b9c7451b0849857a4bf712194e847db9e5730 (patch)
treef12aebf8620602167e2a66683286cc0930d529b5 /embassy-usb/src
parentf58efe9c6297ede1e813d702f60d90745530cb51 (diff)
Default USB to use composite_with_iads, which "just works" in most cases
Diffstat (limited to 'embassy-usb/src')
-rw-r--r--embassy-usb/src/builder.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/embassy-usb/src/builder.rs b/embassy-usb/src/builder.rs
index 008a10f72..c19e13fe0 100644
--- a/embassy-usb/src/builder.rs
+++ b/embassy-usb/src/builder.rs
@@ -84,11 +84,14 @@ pub struct Config<'a> {
84 84
85 /// Configures the device as a composite device with interface association descriptors. 85 /// Configures the device as a composite device with interface association descriptors.
86 /// 86 ///
87 /// If set to `true`, the following fields should have the given values: 87 /// If set to `true` (default), the following fields should have the given values:
88 /// 88 ///
89 /// - `device_class` = `0xEF` 89 /// - `device_class` = `0xEF`
90 /// - `device_sub_class` = `0x02` 90 /// - `device_sub_class` = `0x02`
91 /// - `device_protocol` = `0x01` 91 /// - `device_protocol` = `0x01`
92 ///
93 /// If set to `false`, those fields must be set correctly for the classes that will be
94 /// installed on the USB device.
92 pub composite_with_iads: bool, 95 pub composite_with_iads: bool,
93 96
94 /// Whether the device has its own power source. 97 /// Whether the device has its own power source.
@@ -117,9 +120,9 @@ impl<'a> Config<'a> {
117 /// Create default configuration with the provided vid and pid values. 120 /// Create default configuration with the provided vid and pid values.
118 pub const fn new(vid: u16, pid: u16) -> Self { 121 pub const fn new(vid: u16, pid: u16) -> Self {
119 Self { 122 Self {
120 device_class: 0x00, 123 device_class: 0xEF,
121 device_sub_class: 0x00, 124 device_sub_class: 0x02,
122 device_protocol: 0x00, 125 device_protocol: 0x01,
123 max_packet_size_0: 64, 126 max_packet_size_0: 64,
124 vendor_id: vid, 127 vendor_id: vid,
125 product_id: pid, 128 product_id: pid,
@@ -130,7 +133,7 @@ impl<'a> Config<'a> {
130 serial_number: None, 133 serial_number: None,
131 self_powered: false, 134 self_powered: false,
132 supports_remote_wakeup: false, 135 supports_remote_wakeup: false,
133 composite_with_iads: false, 136 composite_with_iads: true,
134 max_power: 100, 137 max_power: 100,
135 } 138 }
136 } 139 }