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

@@ -81,6 +81,7 @@ func TestClaimAndRelease(t *testing.T) {
{1, 0, "Fast streaming"},
{1, 1, "Slower streaming"},
{1, 2, ""},
{3, 2, "Interface for https://github.com/google/gousb/issues/65"},
} {
if got, err := dev.InterfaceDescription(1, tc.intf, tc.alt); err != nil {
t.Errorf("%s.InterfaceDescription(1, %d, %d): %v", dev, tc.intf, tc.alt, err)