Skip to content

Commit 1e87a78

Browse files
committed
Move CDC Comm back to Interface 0 for compat with Win7 drivers.
1 parent e7305ce commit 1e87a78

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

ports/atmel-samd/tools/gen_usb_descriptor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def strings_in_order(cls):
169169
# This will renumber the endpoints to make them unique across descriptors,
170170
# and renumber the interfaces in order. But we still need to fix up certain
171171
# interface cross-references.
172-
interfaces = util.join_interfaces(hid_interfaces, msc_interfaces, cdc_interfaces)
172+
interfaces = util.join_interfaces(cdc_interfaces, msc_interfaces, hid_interfaces)
173173

174174
# Now adjust the CDC interface cross-references.
175175

@@ -196,14 +196,16 @@ def strings_in_order(cls):
196196
descriptor_list = []
197197
descriptor_list.append(device)
198198
descriptor_list.append(configuration)
199-
descriptor_list.extend(hid_interfaces)
199+
descriptor_list.append(cdc_iad)
200+
descriptor_list.extend(cdc_interfaces)
200201
descriptor_list.extend(msc_interfaces)
201202
# Put the CDC IAD just before the CDC interfaces.
202203
# There appears to be a bug in the Windows composite USB driver that requests the
203204
# HID report descriptor with the wrong interface number if the HID interface is not given
204-
# first. However, it still fetches the descriptor anyway.
205-
descriptor_list.append(cdc_iad)
206-
descriptor_list.extend(cdc_interfaces)
205+
# first. However, it still fetches the descriptor anyway. We could reorder the interfaces but
206+
# the Windows 7 Adafruit_usbser.inf file thinks CDC is at Interface 0, so we'll leave it
207+
# there for backwards compatibility.
208+
descriptor_list.extend(hid_interfaces)
207209

208210
string_descriptors = [standard.StringDescriptor(string) for string in StringIndex.strings_in_order()]
209211
serial_number_descriptor = string_descriptors[SERIAL_NUMBER_INDEX]

0 commit comments

Comments
 (0)