Use Protocol type for USB interface protocol.
This commit is contained in:
@@ -86,7 +86,7 @@ type InterfaceSetup struct {
|
||||
// IfClass is the USB-IF subclass code, as defined by the USB spec.
|
||||
IfSubClass Class
|
||||
// IfProtocol is USB protocol code, as defined by the USB spe.c
|
||||
IfProtocol uint8
|
||||
IfProtocol Protocol
|
||||
// Endpoints has the list of endpoints available on this interface with
|
||||
// this alternate setting.
|
||||
Endpoints []EndpointInfo
|
||||
|
@@ -19,6 +19,7 @@ package usb
|
||||
import "C"
|
||||
import "strconv"
|
||||
|
||||
// Class represents a USB-IF class or subclass code.
|
||||
type Class uint8
|
||||
|
||||
const (
|
||||
@@ -58,6 +59,14 @@ func (c Class) String() string {
|
||||
return strconv.Itoa(int(c))
|
||||
}
|
||||
|
||||
// Protocol is the interface class protocol, qualified by the values
|
||||
// of interface class and subclass.
|
||||
type Protocol uint8
|
||||
|
||||
func (p Protocol) String() string {
|
||||
return strconv.Itoa(int(p))
|
||||
}
|
||||
|
||||
type DescriptorType uint8
|
||||
|
||||
const (
|
||||
|
@@ -29,9 +29,9 @@ type Descriptor struct {
|
||||
Product ID // The Product identifier
|
||||
|
||||
// Protocol information
|
||||
Class Class // The class of this device
|
||||
SubClass Class // The sub-class (within the class) of this device
|
||||
Protocol uint8 // The protocol (within the sub-class) of this device
|
||||
Class Class // The class of this device
|
||||
SubClass Class // The sub-class (within the class) of this device
|
||||
Protocol Protocol // The protocol (within the sub-class) of this device
|
||||
|
||||
// Configuration information
|
||||
Configs []ConfigInfo
|
||||
|
@@ -245,7 +245,7 @@ func (libusbImpl) getDeviceDesc(d *libusbDevice) (*Descriptor, error) {
|
||||
Alternate: uint8(alt.bAlternateSetting),
|
||||
IfClass: Class(alt.bInterfaceClass),
|
||||
IfSubClass: Class(alt.bInterfaceSubClass),
|
||||
IfProtocol: uint8(alt.bInterfaceProtocol),
|
||||
IfProtocol: Protocol(alt.bInterfaceProtocol),
|
||||
}
|
||||
var ends []C.struct_libusb_endpoint_descriptor
|
||||
*(*reflect.SliceHeader)(unsafe.Pointer(&ends)) = reflect.SliceHeader{
|
||||
@@ -278,7 +278,7 @@ func (libusbImpl) getDeviceDesc(d *libusbDevice) (*Descriptor, error) {
|
||||
Product: ID(desc.idProduct),
|
||||
Class: Class(desc.bDeviceClass),
|
||||
SubClass: Class(desc.bDeviceSubClass),
|
||||
Protocol: uint8(desc.bDeviceProtocol),
|
||||
Protocol: Protocol(desc.bDeviceProtocol),
|
||||
Configs: cfgs,
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user