Use Protocol type for USB interface protocol.
This commit is contained in:
@@ -58,7 +58,7 @@ func Describe(val interface{}) string {
|
||||
func Classify(val interface{}) string {
|
||||
var (
|
||||
class, sub usb.Class
|
||||
proto uint8
|
||||
proto usb.Protocol
|
||||
)
|
||||
switch val := val.(type) {
|
||||
case *usb.Descriptor:
|
||||
|
@@ -63,7 +63,7 @@ func (c Class) String() string {
|
||||
// A SubClass contains the name of the subclass and any associated protocols.
|
||||
type SubClass struct {
|
||||
Name string
|
||||
Protocol map[uint8]string
|
||||
Protocol map[usb.Protocol]string
|
||||
}
|
||||
|
||||
// String returns the name of the SubClass.
|
||||
@@ -186,9 +186,9 @@ func ParseIDs(r io.Reader) (map[usb.ID]*Vendor, map[usb.Class]*Class, error) {
|
||||
}
|
||||
|
||||
if subclass.Protocol == nil {
|
||||
subclass.Protocol = make(map[uint8]string)
|
||||
subclass.Protocol = make(map[usb.Protocol]string)
|
||||
}
|
||||
subclass.Protocol[uint8(id)] = name
|
||||
subclass.Protocol[usb.Protocol(id)] = name
|
||||
|
||||
default:
|
||||
return fmt.Errorf("too many levels of nesting for class")
|
||||
|
@@ -64,7 +64,7 @@ var (
|
||||
0x01: {Name: "Direct Line"},
|
||||
0x02: {
|
||||
Name: "Abstract (modem)",
|
||||
Protocol: map[uint8]string{
|
||||
Protocol: map[usb.Protocol]string{
|
||||
0x00: "None",
|
||||
0x01: "AT-commands (v.25ter)",
|
||||
0x02: "AT-commands (PCCA101)",
|
||||
|
Reference in New Issue
Block a user