From 1e87a785b925657c5ab8fe14e76509debca663a3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 8 Apr 2018 15:59:19 -0400 Subject: [PATCH] Move CDC Comm back to Interface 0 for compat with Win7 drivers. --- ports/atmel-samd/tools/gen_usb_descriptor.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ports/atmel-samd/tools/gen_usb_descriptor.py b/ports/atmel-samd/tools/gen_usb_descriptor.py index d376996620..4669110fb7 100644 --- a/ports/atmel-samd/tools/gen_usb_descriptor.py +++ b/ports/atmel-samd/tools/gen_usb_descriptor.py @@ -169,7 +169,7 @@ hid_interfaces = [ # This will renumber the endpoints to make them unique across descriptors, # and renumber the interfaces in order. But we still need to fix up certain # interface cross-references. -interfaces = util.join_interfaces(hid_interfaces, msc_interfaces, cdc_interfaces) +interfaces = util.join_interfaces(cdc_interfaces, msc_interfaces, hid_interfaces) # Now adjust the CDC interface cross-references. @@ -196,14 +196,16 @@ configuration = standard.ConfigurationDescriptor( descriptor_list = [] descriptor_list.append(device) descriptor_list.append(configuration) -descriptor_list.extend(hid_interfaces) +descriptor_list.append(cdc_iad) +descriptor_list.extend(cdc_interfaces) descriptor_list.extend(msc_interfaces) # Put the CDC IAD just before the CDC interfaces. # There appears to be a bug in the Windows composite USB driver that requests the # HID report descriptor with the wrong interface number if the HID interface is not given -# first. However, it still fetches the descriptor anyway. -descriptor_list.append(cdc_iad) -descriptor_list.extend(cdc_interfaces) +# first. However, it still fetches the descriptor anyway. We could reorder the interfaces but +# the Windows 7 Adafruit_usbser.inf file thinks CDC is at Interface 0, so we'll leave it +# there for backwards compatibility. +descriptor_list.extend(hid_interfaces) string_descriptors = [standard.StringDescriptor(string) for string in StringIndex.strings_in_order()] serial_number_descriptor = string_descriptors[SERIAL_NUMBER_INDEX]