333bc090cc77e44c94f8a926d1e04f31e6855a17
[openwrt/openwrt.git] / package / libs / libusb-compat / patches / 001-fix-musl-stdint.patch
1 --- a/libusb/usb.h
2 +++ b/libusb/usb.h
3 @@ -27,6 +27,7 @@
4
5 #include <unistd.h>
6 #include <stdlib.h>
7 +#include <stdint.h>
8 #include <limits.h>
9
10 #include <dirent.h>
11 @@ -78,40 +79,40 @@
12
13 /* All standard descriptors have these 2 fields in common */
14 struct usb_descriptor_header {
15 - u_int8_t bLength;
16 - u_int8_t bDescriptorType;
17 + uint8_t bLength;
18 + uint8_t bDescriptorType;
19 };
20
21 /* String descriptor */
22 struct usb_string_descriptor {
23 - u_int8_t bLength;
24 - u_int8_t bDescriptorType;
25 - u_int16_t wData[1];
26 + uint8_t bLength;
27 + uint8_t bDescriptorType;
28 + uint16_t wData[1];
29 };
30
31 /* HID descriptor */
32 struct usb_hid_descriptor {
33 - u_int8_t bLength;
34 - u_int8_t bDescriptorType;
35 - u_int16_t bcdHID;
36 - u_int8_t bCountryCode;
37 - u_int8_t bNumDescriptors;
38 - /* u_int8_t bReportDescriptorType; */
39 - /* u_int16_t wDescriptorLength; */
40 + uint8_t bLength;
41 + uint8_t bDescriptorType;
42 + uint16_t bcdHID;
43 + uint8_t bCountryCode;
44 + uint8_t bNumDescriptors;
45 + /* uint8_t bReportDescriptorType; */
46 + /* uint16_t wDescriptorLength; */
47 /* ... */
48 };
49
50 /* Endpoint descriptor */
51 #define USB_MAXENDPOINTS 32
52 struct usb_endpoint_descriptor {
53 - u_int8_t bLength;
54 - u_int8_t bDescriptorType;
55 - u_int8_t bEndpointAddress;
56 - u_int8_t bmAttributes;
57 - u_int16_t wMaxPacketSize;
58 - u_int8_t bInterval;
59 - u_int8_t bRefresh;
60 - u_int8_t bSynchAddress;
61 + uint8_t bLength;
62 + uint8_t bDescriptorType;
63 + uint8_t bEndpointAddress;
64 + uint8_t bmAttributes;
65 + uint16_t wMaxPacketSize;
66 + uint8_t bInterval;
67 + uint8_t bRefresh;
68 + uint8_t bSynchAddress;
69
70 unsigned char *extra; /* Extra descriptors */
71 int extralen;
72 @@ -129,15 +130,15 @@ struct usb_endpoint_descriptor {
73 /* Interface descriptor */
74 #define USB_MAXINTERFACES 32
75 struct usb_interface_descriptor {
76 - u_int8_t bLength;
77 - u_int8_t bDescriptorType;
78 - u_int8_t bInterfaceNumber;
79 - u_int8_t bAlternateSetting;
80 - u_int8_t bNumEndpoints;
81 - u_int8_t bInterfaceClass;
82 - u_int8_t bInterfaceSubClass;
83 - u_int8_t bInterfaceProtocol;
84 - u_int8_t iInterface;
85 + uint8_t bLength;
86 + uint8_t bDescriptorType;
87 + uint8_t bInterfaceNumber;
88 + uint8_t bAlternateSetting;
89 + uint8_t bNumEndpoints;
90 + uint8_t bInterfaceClass;
91 + uint8_t bInterfaceSubClass;
92 + uint8_t bInterfaceProtocol;
93 + uint8_t iInterface;
94
95 struct usb_endpoint_descriptor *endpoint;
96
97 @@ -155,14 +156,14 @@ struct usb_interface {
98 /* Configuration descriptor information.. */
99 #define USB_MAXCONFIG 8
100 struct usb_config_descriptor {
101 - u_int8_t bLength;
102 - u_int8_t bDescriptorType;
103 - u_int16_t wTotalLength;
104 - u_int8_t bNumInterfaces;
105 - u_int8_t bConfigurationValue;
106 - u_int8_t iConfiguration;
107 - u_int8_t bmAttributes;
108 - u_int8_t MaxPower;
109 + uint8_t bLength;
110 + uint8_t bDescriptorType;
111 + uint16_t wTotalLength;
112 + uint8_t bNumInterfaces;
113 + uint8_t bConfigurationValue;
114 + uint8_t iConfiguration;
115 + uint8_t bmAttributes;
116 + uint8_t MaxPower;
117
118 struct usb_interface *interface;
119
120 @@ -172,28 +173,28 @@ struct usb_config_descriptor {
121
122 /* Device descriptor */
123 struct usb_device_descriptor {
124 - u_int8_t bLength;
125 - u_int8_t bDescriptorType;
126 - u_int16_t bcdUSB;
127 - u_int8_t bDeviceClass;
128 - u_int8_t bDeviceSubClass;
129 - u_int8_t bDeviceProtocol;
130 - u_int8_t bMaxPacketSize0;
131 - u_int16_t idVendor;
132 - u_int16_t idProduct;
133 - u_int16_t bcdDevice;
134 - u_int8_t iManufacturer;
135 - u_int8_t iProduct;
136 - u_int8_t iSerialNumber;
137 - u_int8_t bNumConfigurations;
138 + uint8_t bLength;
139 + uint8_t bDescriptorType;
140 + uint16_t bcdUSB;
141 + uint8_t bDeviceClass;
142 + uint8_t bDeviceSubClass;
143 + uint8_t bDeviceProtocol;
144 + uint8_t bMaxPacketSize0;
145 + uint16_t idVendor;
146 + uint16_t idProduct;
147 + uint16_t bcdDevice;
148 + uint8_t iManufacturer;
149 + uint8_t iProduct;
150 + uint8_t iSerialNumber;
151 + uint8_t bNumConfigurations;
152 };
153
154 struct usb_ctrl_setup {
155 - u_int8_t bRequestType;
156 - u_int8_t bRequest;
157 - u_int16_t wValue;
158 - u_int16_t wIndex;
159 - u_int16_t wLength;
160 + uint8_t bRequestType;
161 + uint8_t bRequest;
162 + uint16_t wValue;
163 + uint16_t wIndex;
164 + uint16_t wLength;
165 };
166
167 /*
168 @@ -254,7 +255,7 @@ struct usb_device {
169
170 void *dev; /* Darwin support */
171
172 - u_int8_t devnum;
173 + uint8_t devnum;
174
175 unsigned char num_children;
176 struct usb_device **children;
177 @@ -266,7 +267,7 @@ struct usb_bus {
178 char dirname[PATH_MAX + 1];
179
180 struct usb_device *devices;
181 - u_int32_t location;
182 + uint32_t location;
183
184 struct usb_device *root_dev;
185 };