Rename IfClass/IfSubClass/IfProtocol to Class/SubClass/Protocol, these
fields occur within an interface descriptor.
This commit is contained in:
@@ -81,12 +81,12 @@ type InterfaceSetup struct {
|
||||
Number uint8
|
||||
// Alternate is the number of the alternate setting.
|
||||
Alternate uint8
|
||||
// IfClass is the USB-IF class code, as defined by the USB spec.
|
||||
IfClass Class
|
||||
// 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 Protocol
|
||||
// Class is the USB-IF class code, as defined by the USB spec.
|
||||
Class Class
|
||||
// SubClass is the USB-IF subclass code, as defined by the USB spec.
|
||||
SubClass Class
|
||||
// Protocol is USB protocol code, as defined by the USB spe.c
|
||||
Protocol Protocol
|
||||
// Endpoints has the list of endpoints available on this interface with
|
||||
// this alternate setting.
|
||||
Endpoints []EndpointInfo
|
||||
|
@@ -27,7 +27,7 @@ var testBulkInEP = EndpointInfo{
|
||||
var testBulkInSetup = InterfaceSetup{
|
||||
Number: 0,
|
||||
Alternate: 0,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
Endpoints: []EndpointInfo{testBulkInEP},
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ var testIsoOutEP = EndpointInfo{
|
||||
var testIsoOutSetup = InterfaceSetup{
|
||||
Number: 0,
|
||||
Alternate: 0,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
Endpoints: []EndpointInfo{testIsoOutEP},
|
||||
}
|
||||
|
@@ -37,13 +37,13 @@ var (
|
||||
Protocol: 255,
|
||||
Configs: []ConfigInfo{{
|
||||
Config: 1,
|
||||
MaxPower: 50, // * 2mA
|
||||
MaxPower: Milliamperes(100),
|
||||
Interfaces: []InterfaceInfo{{
|
||||
Number: 0,
|
||||
Setups: []InterfaceSetup{{
|
||||
Number: 0,
|
||||
Alternate: 0,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
Endpoints: []EndpointInfo{{
|
||||
Number: 1,
|
||||
Direction: EndpointDirectionOut,
|
||||
@@ -73,20 +73,20 @@ var (
|
||||
Protocol: 255,
|
||||
Configs: []ConfigInfo{{
|
||||
Config: 1,
|
||||
MaxPower: 50, // * 2mA
|
||||
MaxPower: Milliamperes(100),
|
||||
Interfaces: []InterfaceInfo{{
|
||||
Number: 0,
|
||||
Setups: []InterfaceSetup{{
|
||||
Number: 0,
|
||||
Alternate: 0,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
}},
|
||||
}, {
|
||||
Number: 1,
|
||||
Setups: []InterfaceSetup{{
|
||||
Number: 1,
|
||||
Alternate: 0,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
Endpoints: []EndpointInfo{{
|
||||
Number: 5,
|
||||
Direction: EndpointDirectionOut,
|
||||
@@ -103,7 +103,7 @@ var (
|
||||
}, {
|
||||
Number: 1,
|
||||
Alternate: 1,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
Endpoints: []EndpointInfo{{
|
||||
Number: 5,
|
||||
Direction: EndpointDirectionOut,
|
||||
@@ -118,7 +118,7 @@ var (
|
||||
}, {
|
||||
Number: 1,
|
||||
Alternate: 2,
|
||||
IfClass: ClassVendorSpec,
|
||||
Class: ClassVendorSpec,
|
||||
Endpoints: []EndpointInfo{{
|
||||
Number: 5,
|
||||
Direction: EndpointDirectionIn,
|
||||
|
@@ -241,11 +241,11 @@ func (libusbImpl) getDeviceDesc(d *libusbDevice) (*Descriptor, error) {
|
||||
descs := make([]InterfaceSetup, 0, len(alts))
|
||||
for _, alt := range alts {
|
||||
i := InterfaceSetup{
|
||||
Number: uint8(alt.bInterfaceNumber),
|
||||
Alternate: uint8(alt.bAlternateSetting),
|
||||
IfClass: Class(alt.bInterfaceClass),
|
||||
IfSubClass: Class(alt.bInterfaceSubClass),
|
||||
IfProtocol: Protocol(alt.bInterfaceProtocol),
|
||||
Number: uint8(alt.bInterfaceNumber),
|
||||
Alternate: uint8(alt.bAlternateSetting),
|
||||
Class: Class(alt.bInterfaceClass),
|
||||
SubClass: Class(alt.bInterfaceSubClass),
|
||||
Protocol: Protocol(alt.bInterfaceProtocol),
|
||||
}
|
||||
var ends []C.struct_libusb_endpoint_descriptor
|
||||
*(*reflect.SliceHeader)(unsafe.Pointer(&ends)) = reflect.SliceHeader{
|
||||
|
@@ -64,7 +64,7 @@ func Classify(val interface{}) string {
|
||||
case *usb.Descriptor:
|
||||
class, sub, proto = val.Class, val.SubClass, val.Protocol
|
||||
case usb.InterfaceSetup:
|
||||
class, sub, proto = usb.Class(val.IfClass), usb.Class(val.IfSubClass), val.IfProtocol
|
||||
class, sub, proto = val.Class, val.SubClass, val.Protocol
|
||||
default:
|
||||
return fmt.Sprintf("Unknown (%T)", val)
|
||||
}
|
||||
|
Reference in New Issue
Block a user