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:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user