Default USB to use composite_with_iads, which "just works" in most cases

This commit is contained in:
Eekle 2024-12-24 12:53:06 +01:00
parent f58efe9c62
commit 0f4b9c7451

View File

@ -84,11 +84,14 @@ pub struct Config<'a> {
/// Configures the device as a composite device with interface association descriptors.
///
/// If set to `true`, the following fields should have the given values:
/// If set to `true` (default), the following fields should have the given values:
///
/// - `device_class` = `0xEF`
/// - `device_sub_class` = `0x02`
/// - `device_protocol` = `0x01`
///
/// If set to `false`, those fields must be set correctly for the classes that will be
/// installed on the USB device.
pub composite_with_iads: bool,
/// Whether the device has its own power source.
@ -117,9 +120,9 @@ impl<'a> Config<'a> {
/// Create default configuration with the provided vid and pid values.
pub const fn new(vid: u16, pid: u16) -> Self {
Self {
device_class: 0x00,
device_sub_class: 0x00,
device_protocol: 0x00,
device_class: 0xEF,
device_sub_class: 0x02,
device_protocol: 0x01,
max_packet_size_0: 64,
vendor_id: vid,
product_id: pid,
@ -130,7 +133,7 @@ impl<'a> Config<'a> {
serial_number: None,
self_powered: false,
supports_remote_wakeup: false,
composite_with_iads: false,
composite_with_iads: true,
max_power: 100,
}
}