Browse Source

Don't count interfaces with alternate settings multiple times

main
Tobias Müller 3 years ago
parent
commit
0409f985b5
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      usb_protocol/emitters/descriptors/standard.py

+ 2
- 2
usb_protocol/emitters/descriptors/standard.py View File

@@ -129,8 +129,8 @@ class ConfigurationDescriptorEmitter(ComplexDescriptorEmitter):


def _pre_emit(self): def _pre_emit(self):


# Count our interfaces.
self.bNumInterfaces = self._type_counts[StandardDescriptorNumbers.INTERFACE]
# Count our interfaces. Alternate settings of the same interface do not count multiple times.
self.bNumInterfaces = len(set([subordinate[2] for subordinate in self._subordinates if (subordinate[1] == StandardDescriptorNumbers.INTERFACE)]))


# Figure out our total length. # Figure out our total length.
subordinate_length = sum(len(sub) for sub in self._subordinates) subordinate_length = sum(len(sub) for sub in self._subordinates)


Loading…
Cancel
Save