diff --git a/usb/config.go b/usb/config.go index 95a0669..43624c0 100644 --- a/usb/config.go +++ b/usb/config.go @@ -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 diff --git a/usb/endpoint_info_test.go b/usb/endpoint_info_test.go index 9063168..702c8c4 100644 --- a/usb/endpoint_info_test.go +++ b/usb/endpoint_info_test.go @@ -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}, } diff --git a/usb/fakelibusb_test.go b/usb/fakelibusb_test.go index 0052c92..bcfd512 100644 --- a/usb/fakelibusb_test.go +++ b/usb/fakelibusb_test.go @@ -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, diff --git a/usb/libusb.go b/usb/libusb.go index e7c6dd3..5950618 100644 --- a/usb/libusb.go +++ b/usb/libusb.go @@ -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{ diff --git a/usbid/describe.go b/usbid/describe.go index c3dbc8c..7ba6855 100644 --- a/usbid/describe.go +++ b/usbid/describe.go @@ -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) }