Rename IfClass/IfSubClass/IfProtocol to Class/SubClass/Protocol, these

fields occur within an interface descriptor.
This commit is contained in:
Sebastian Zagrodzki
2017-04-09 18:44:32 +02:00
parent f91d53931a
commit 168b501d53
5 changed files with 21 additions and 21 deletions

View File

@@ -81,12 +81,12 @@ type InterfaceSetup struct {
Number uint8 Number uint8
// Alternate is the number of the alternate setting. // Alternate is the number of the alternate setting.
Alternate uint8 Alternate uint8
// IfClass is the USB-IF class code, as defined by the USB spec. // Class is the USB-IF class code, as defined by the USB spec.
IfClass Class Class Class
// IfClass is the USB-IF subclass code, as defined by the USB spec. // SubClass is the USB-IF subclass code, as defined by the USB spec.
IfSubClass Class SubClass Class
// IfProtocol is USB protocol code, as defined by the USB spe.c // Protocol is USB protocol code, as defined by the USB spe.c
IfProtocol Protocol Protocol Protocol
// Endpoints has the list of endpoints available on this interface with // Endpoints has the list of endpoints available on this interface with
// this alternate setting. // this alternate setting.
Endpoints []EndpointInfo Endpoints []EndpointInfo

View File

@@ -27,7 +27,7 @@ var testBulkInEP = EndpointInfo{
var testBulkInSetup = InterfaceSetup{ var testBulkInSetup = InterfaceSetup{
Number: 0, Number: 0,
Alternate: 0, Alternate: 0,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
Endpoints: []EndpointInfo{testBulkInEP}, Endpoints: []EndpointInfo{testBulkInEP},
} }
@@ -43,6 +43,6 @@ var testIsoOutEP = EndpointInfo{
var testIsoOutSetup = InterfaceSetup{ var testIsoOutSetup = InterfaceSetup{
Number: 0, Number: 0,
Alternate: 0, Alternate: 0,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
Endpoints: []EndpointInfo{testIsoOutEP}, Endpoints: []EndpointInfo{testIsoOutEP},
} }

View File

@@ -37,13 +37,13 @@ var (
Protocol: 255, Protocol: 255,
Configs: []ConfigInfo{{ Configs: []ConfigInfo{{
Config: 1, Config: 1,
MaxPower: 50, // * 2mA MaxPower: Milliamperes(100),
Interfaces: []InterfaceInfo{{ Interfaces: []InterfaceInfo{{
Number: 0, Number: 0,
Setups: []InterfaceSetup{{ Setups: []InterfaceSetup{{
Number: 0, Number: 0,
Alternate: 0, Alternate: 0,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{ Endpoints: []EndpointInfo{{
Number: 1, Number: 1,
Direction: EndpointDirectionOut, Direction: EndpointDirectionOut,
@@ -73,20 +73,20 @@ var (
Protocol: 255, Protocol: 255,
Configs: []ConfigInfo{{ Configs: []ConfigInfo{{
Config: 1, Config: 1,
MaxPower: 50, // * 2mA MaxPower: Milliamperes(100),
Interfaces: []InterfaceInfo{{ Interfaces: []InterfaceInfo{{
Number: 0, Number: 0,
Setups: []InterfaceSetup{{ Setups: []InterfaceSetup{{
Number: 0, Number: 0,
Alternate: 0, Alternate: 0,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
}}, }},
}, { }, {
Number: 1, Number: 1,
Setups: []InterfaceSetup{{ Setups: []InterfaceSetup{{
Number: 1, Number: 1,
Alternate: 0, Alternate: 0,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{ Endpoints: []EndpointInfo{{
Number: 5, Number: 5,
Direction: EndpointDirectionOut, Direction: EndpointDirectionOut,
@@ -103,7 +103,7 @@ var (
}, { }, {
Number: 1, Number: 1,
Alternate: 1, Alternate: 1,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{ Endpoints: []EndpointInfo{{
Number: 5, Number: 5,
Direction: EndpointDirectionOut, Direction: EndpointDirectionOut,
@@ -118,7 +118,7 @@ var (
}, { }, {
Number: 1, Number: 1,
Alternate: 2, Alternate: 2,
IfClass: ClassVendorSpec, Class: ClassVendorSpec,
Endpoints: []EndpointInfo{{ Endpoints: []EndpointInfo{{
Number: 5, Number: 5,
Direction: EndpointDirectionIn, Direction: EndpointDirectionIn,

View File

@@ -243,9 +243,9 @@ func (libusbImpl) getDeviceDesc(d *libusbDevice) (*Descriptor, error) {
i := InterfaceSetup{ i := InterfaceSetup{
Number: uint8(alt.bInterfaceNumber), Number: uint8(alt.bInterfaceNumber),
Alternate: uint8(alt.bAlternateSetting), Alternate: uint8(alt.bAlternateSetting),
IfClass: Class(alt.bInterfaceClass), Class: Class(alt.bInterfaceClass),
IfSubClass: Class(alt.bInterfaceSubClass), SubClass: Class(alt.bInterfaceSubClass),
IfProtocol: Protocol(alt.bInterfaceProtocol), Protocol: Protocol(alt.bInterfaceProtocol),
} }
var ends []C.struct_libusb_endpoint_descriptor var ends []C.struct_libusb_endpoint_descriptor
*(*reflect.SliceHeader)(unsafe.Pointer(&ends)) = reflect.SliceHeader{ *(*reflect.SliceHeader)(unsafe.Pointer(&ends)) = reflect.SliceHeader{

View File

@@ -64,7 +64,7 @@ func Classify(val interface{}) string {
case *usb.Descriptor: case *usb.Descriptor:
class, sub, proto = val.Class, val.SubClass, val.Protocol class, sub, proto = val.Class, val.SubClass, val.Protocol
case usb.InterfaceSetup: 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: default:
return fmt.Sprintf("Unknown (%T)", val) return fmt.Sprintf("Unknown (%T)", val)
} }