Start decoding descriptor in Go, rather than relying on libusb helper

functions. Descriptor format is defined explicitly by the USB spec.
This commit is contained in:
Sebastian Zagrodzki
2017-05-06 23:42:52 +02:00
parent b0df83bff6
commit 5f9276965f
3 changed files with 190 additions and 5 deletions

View File

@@ -25,8 +25,9 @@ import (
// DeviceDesc is a representation of a USB device descriptor.
type DeviceDesc struct {
// Bus information
Bus int // The bus on which the device was detected
Address int // The address of the device on the bus
Bus int // The bus on which the device was detected
Address int // The address of the device on the bus
Speed Speed // The negotiated operating speed for the device
// Version information
Spec BCD // USB Specification Release Number
@@ -37,9 +38,10 @@ type DeviceDesc 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 Protocol // 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
MaxControlPacketSize int // Maximum size of the control transfer
// Configuration information
Configs map[int]ConfigDesc