-
Notifications
You must be signed in to change notification settings - Fork 25
/
usbdef_linux.go
75 lines (66 loc) · 1.45 KB
/
usbdef_linux.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package hid
const UsbHidClass = 3
type deviceDesc struct {
Length uint8
DescriptorType uint8
USB uint16
DeviceClass uint8
DeviceSubClass uint8
DeviceProtocol uint8
MaxPacketSize uint8
Vendor uint16
Product uint16
Revision uint16
ManufacturerIndex uint8
ProductIndex uint8
SerialIndex uint8
NumConfigurations uint8
}
type configDesc struct {
Length uint8
DescriptorType uint8
TotalLength uint16
NumInterfaces uint8
ConfigurationValue uint8
Configuration uint8
Attributes uint8
MaxPower uint8
}
type interfaceDesc struct {
Length uint8
DescriptorType uint8
Number uint8
AltSetting uint8
NumEndpoints uint8
InterfaceClass uint8
InterfaceSubClass uint8
InterfaceProtocol uint8
InterfaceIndex uint8
}
type endpointDesc struct {
Length uint8
DescriptorType uint8
Address uint8
Attributes uint8
MaxPacketSize uint16
Interval uint8
}
type hidReportDesc struct {
Length uint8
DescriptorType uint8
}
const (
USBDEVFS_CONNECT = 0x5517
USBDEVFS_DISCONNECT = 0x5516
USBDEVFS_CLAIM = 0x8004550f
USBDEVFS_RELEASE = 0x80045510
)
const DevBusUsb = "/dev/bus/usb"
const (
UsbDescTypeDevice = 1
UsbDescTypeConfig = 2
UsbDescTypeString = 3
UsbDescTypeInterface = 4
UsbDescTypeEndpoint = 5
UsbDescTypeReport = 33
)