Support malformed interface descriptors (#79)

* Add an invalid interface descriptor to one of the test devices.
* Add a test for getting that interface description.
* Handle the malformed interface/alternate setting descriptors, where
interface/alt numbers don't follow the spec (not 0-based, not contiguous
etc.)

Addresses issue #65.
This commit is contained in:
Sebastian Zagrodzki
2020-04-28 11:32:10 +02:00
committed by GitHub
parent 18f4c1d8a7
commit 9ad54830f4
5 changed files with 49 additions and 18 deletions

View File

@@ -23,8 +23,7 @@ import (
// InterfaceDesc contains information about a USB interface, extracted from
// the descriptor.
type InterfaceDesc struct {
// Number is the number of this interface, a zero-based index in the array
// of interfaces supported by the device configuration.
// Number is the number of this interface.
Number int
// AltSettings is a list of alternate settings supported by the interface.
AltSettings []InterfaceSetting