mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
make loader windows-friendly for usb serial
This commit is contained in:
parent
01957c3b65
commit
3bd79d0328
2 changed files with 22 additions and 1 deletions
|
|
@ -159,7 +159,7 @@ pub fn get_descriptor_request(this: &mut CorigineUsb, value: u16, _index: usize,
|
||||||
match (value >> 8) as u8 {
|
match (value >> 8) as u8 {
|
||||||
USB_DT_DEVICE => {
|
USB_DT_DEVICE => {
|
||||||
crate::println!("USB_DT_DEVICE");
|
crate::println!("USB_DT_DEVICE");
|
||||||
let mut device_descriptor = DeviceDescriptor::default_composite();
|
let mut device_descriptor = DeviceDescriptor::composite_with_iad();
|
||||||
device_descriptor.b_max_packet_size0 = 64;
|
device_descriptor.b_max_packet_size0 = 64;
|
||||||
|
|
||||||
let len = length.min(core::mem::size_of::<DeviceDescriptor>());
|
let len = length.min(core::mem::size_of::<DeviceDescriptor>());
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,7 @@ impl DeviceDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn default_composite() -> Self {
|
pub fn default_composite() -> Self {
|
||||||
Self {
|
Self {
|
||||||
b_length: core::mem::size_of::<Self>() as u8,
|
b_length: core::mem::size_of::<Self>() as u8,
|
||||||
|
|
@ -186,6 +187,26 @@ impl DeviceDescriptor {
|
||||||
b_num_configurations: 1,
|
b_num_configurations: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Windows-friendly composite: EF/02/01 indicates IAD-present composite
|
||||||
|
pub fn composite_with_iad() -> Self {
|
||||||
|
Self {
|
||||||
|
b_length: core::mem::size_of::<Self>() as u8,
|
||||||
|
b_descriptor_type: USB_DT_DEVICE,
|
||||||
|
b_cd_usb: 0x0200,
|
||||||
|
b_device_class: 0xEF, // Miscellaneous
|
||||||
|
b_device_sub_class: 0x02, // Common Class
|
||||||
|
b_device_protocol: 0x01, // Interface Association Descriptor (IAD)
|
||||||
|
b_max_packet_size0: 0x40,
|
||||||
|
id_vendor: VENDOR_ID,
|
||||||
|
id_product: PRODUCT_ID,
|
||||||
|
b_cd_device: 0x0101,
|
||||||
|
i_manufacturer: 0x01,
|
||||||
|
i_product: 0x02,
|
||||||
|
i_serial_number: 0x03,
|
||||||
|
b_num_configurations: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl AsRef<[u8]> for DeviceDescriptor {
|
impl AsRef<[u8]> for DeviceDescriptor {
|
||||||
fn as_ref(&self) -> &[u8] {
|
fn as_ref(&self) -> &[u8] {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue