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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
diff --git a/libusb/usb.h b/libusb/usb.h
index b7af749..c9726ed 100644
--- a/libusb/usb.h
+++ b/libusb/usb.h
@@ -27,8 +27,10 @@
#include <unistd.h>
#include <stdlib.h>
+#include <stdint.h>
#include <limits.h>
+#include <sys/param.h>
#include <dirent.h>
/*
@@ -78,40 +80,40 @@
/* All standard descriptors have these 2 fields in common */
struct usb_descriptor_header {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
+ uint8_t bLength;
+ uint8_t bDescriptorType;
};
/* String descriptor */
struct usb_string_descriptor {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
- u_int16_t wData[1];
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t wData[1];
};
/* HID descriptor */
struct usb_hid_descriptor {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
- u_int16_t bcdHID;
- u_int8_t bCountryCode;
- u_int8_t bNumDescriptors;
- /* u_int8_t bReportDescriptorType; */
- /* u_int16_t wDescriptorLength; */
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t bcdHID;
+ uint8_t bCountryCode;
+ uint8_t bNumDescriptors;
+ /* uint8_t bReportDescriptorType; */
+ /* uint16_t wDescriptorLength; */
/* ... */
};
/* Endpoint descriptor */
#define USB_MAXENDPOINTS 32
struct usb_endpoint_descriptor {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
- u_int8_t bEndpointAddress;
- u_int8_t bmAttributes;
- u_int16_t wMaxPacketSize;
- u_int8_t bInterval;
- u_int8_t bRefresh;
- u_int8_t bSynchAddress;
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bEndpointAddress;
+ uint8_t bmAttributes;
+ uint16_t wMaxPacketSize;
+ uint8_t bInterval;
+ uint8_t bRefresh;
+ uint8_t bSynchAddress;
unsigned char *extra; /* Extra descriptors */
int extralen;
@@ -129,15 +131,15 @@ struct usb_endpoint_descriptor {
/* Interface descriptor */
#define USB_MAXINTERFACES 32
struct usb_interface_descriptor {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
- u_int8_t bInterfaceNumber;
- u_int8_t bAlternateSetting;
- u_int8_t bNumEndpoints;
- u_int8_t bInterfaceClass;
- u_int8_t bInterfaceSubClass;
- u_int8_t bInterfaceProtocol;
- u_int8_t iInterface;
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint8_t bInterfaceNumber;
+ uint8_t bAlternateSetting;
+ uint8_t bNumEndpoints;
+ uint8_t bInterfaceClass;
+ uint8_t bInterfaceSubClass;
+ uint8_t bInterfaceProtocol;
+ uint8_t iInterface;
struct usb_endpoint_descriptor *endpoint;
@@ -155,14 +157,14 @@ struct usb_interface {
/* Configuration descriptor information.. */
#define USB_MAXCONFIG 8
struct usb_config_descriptor {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
- u_int16_t wTotalLength;
- u_int8_t bNumInterfaces;
- u_int8_t bConfigurationValue;
- u_int8_t iConfiguration;
- u_int8_t bmAttributes;
- u_int8_t MaxPower;
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t wTotalLength;
+ uint8_t bNumInterfaces;
+ uint8_t bConfigurationValue;
+ uint8_t iConfiguration;
+ uint8_t bmAttributes;
+ uint8_t MaxPower;
struct usb_interface *interface;
@@ -172,28 +174,28 @@ struct usb_config_descriptor {
/* Device descriptor */
struct usb_device_descriptor {
- u_int8_t bLength;
- u_int8_t bDescriptorType;
- u_int16_t bcdUSB;
- u_int8_t bDeviceClass;
- u_int8_t bDeviceSubClass;
- u_int8_t bDeviceProtocol;
- u_int8_t bMaxPacketSize0;
- u_int16_t idVendor;
- u_int16_t idProduct;
- u_int16_t bcdDevice;
- u_int8_t iManufacturer;
- u_int8_t iProduct;
- u_int8_t iSerialNumber;
- u_int8_t bNumConfigurations;
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+ uint16_t bcdUSB;
+ uint8_t bDeviceClass;
+ uint8_t bDeviceSubClass;
+ uint8_t bDeviceProtocol;
+ uint8_t bMaxPacketSize0;
+ uint16_t idVendor;
+ uint16_t idProduct;
+ uint16_t bcdDevice;
+ uint8_t iManufacturer;
+ uint8_t iProduct;
+ uint8_t iSerialNumber;
+ uint8_t bNumConfigurations;
};
struct usb_ctrl_setup {
- u_int8_t bRequestType;
- u_int8_t bRequest;
- u_int16_t wValue;
- u_int16_t wIndex;
- u_int16_t wLength;
+ uint8_t bRequestType;
+ uint8_t bRequest;
+ uint16_t wValue;
+ uint16_t wIndex;
+ uint16_t wLength;
};
/*
@@ -254,7 +256,7 @@ struct usb_device {
void *dev; /* Darwin support */
- u_int8_t devnum;
+ uint8_t devnum;
unsigned char num_children;
struct usb_device **children;
@@ -266,7 +268,7 @@ struct usb_bus {
char dirname[PATH_MAX + 1];
struct usb_device *devices;
- u_int32_t location;
+ uint32_t location;
struct usb_device *root_dev;
};
|