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

@@ -15,6 +15,8 @@
package usb
import "fmt"
// Descriptor is a representation of a USB device descriptor.
type Descriptor struct {
// Bus information
@@ -37,3 +39,8 @@ type Descriptor struct {
// Configuration information
Configs []ConfigInfo
}
// String represents a human readable representation of the device in the descriptor.
func (d *Descriptor) String() string {
return fmt.Sprintf("vid=%s,pid=%s,bus=%d,addr=%d", d.Vendor, d.Product, d.Bus, d.Address)
}