Introduce two more layers between device and endpoint:

device -> active config -> claimed interface -> endpoints.
Device can have at most one active config. A config can have
multiple claimed interfaces, each with a specific alt setting.
An interface with an alt setting defines a list of endpoints.
This commit is contained in:
Sebastian Zagrodzki
2017-04-29 00:01:11 +02:00
parent d193e605a4
commit 5f122b4dcd
10 changed files with 309 additions and 250 deletions

View File

@@ -31,9 +31,19 @@ func TestOpenEndpoint(t *testing.T) {
}
defer dev.Close()
if err != nil {
t.Fatalf("OpenDeviceWithVidPid(0x8888, 0x0002): got error %v, want nil", err)
t.Fatalf("OpenDeviceWithVidPid(0x8888, 0x0002): %v", err)
}
got, err := dev.InEndpoint(1, 1, 1, 6)
cfg, err := dev.Config(1)
if err != nil {
t.Fatalf("%s Config(1): %v", dev, err)
}
defer cfg.Close()
intf, err := cfg.Interface(1, 1)
if err != nil {
t.Fatalf("%s Interface(1, 1): %v", cfg, err)
}
defer intf.Close()
got, err := intf.InEndpoint(6)
if err != nil {
t.Fatalf("InEndpoint(cfg=1, if=1, alt=1, ep=6IN): got error %v, want nil", err)
}