Move CDC Comm back to Interface 0 for compat with Win7 drivers.

This commit is contained in:
Dan Halbert 2018-04-08 15:59:19 -04:00
parent e7305ce15f
commit 1e87a785b9

View File

@ -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]