openocd: avoid documentation rebuild to fix build issues
[buildroot-gz.git] / package / libusb-compat / 0001-Use-C99-standard-fixed-width-integer-types-in-usb.h.patch
blobad71199c4c90f7fa52c206eb66376fde2cb6a446
1 From 2e9b6bbebb7cf1ef0095516ec6d5203deb3822e8 Mon Sep 17 00:00:00 2001
2 From: Nathan Hjelm <hjelmn@me.com>
3 Date: Fri, 9 Oct 2015 15:03:10 -0600
4 Subject: [PATCH 1/1] Use C99 standard fixed width integer types in usb.h
6 This patch modifies the integer types in usb.h of the form u_int* to the
7 C99 standard uint* types.
9 Based on patch from Gwenhael Goavec-Merou.
11 Backported from upstream commit
12 https://github.com/libusb/libusb-compat-0.1/commit/2e9b6bbebb7cf1ef0095516ec6d5203deb3822e8.
14 Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
15 Signed-off-by: Nathan Hjelm <hjelmn@me.com>
16 ---
17 libusb/usb.h | 130 ++++++++++++++++++++++++++++++++---------------------------
18 1 file changed, 70 insertions(+), 60 deletions(-)
20 diff --git a/libusb/usb.h b/libusb/usb.h
21 index 84e730f..d2c30aa 100644
22 --- a/libusb/usb.h
23 +++ b/libusb/usb.h
24 @@ -2,6 +2,7 @@
25 * Prototypes, structure definitions and macros.
27 * Copyright (c) 2000-2003 Johannes Erdfelt <johannes@erdfelt.com>
28 + * Copyright (c) 2015 Nathan Hjelm <hjelmn@cs.unm.edu>
30 * This library is free software; you can redistribute it and/or
31 * modify it under the terms of the GNU Lesser General Public
32 @@ -22,8 +23,8 @@
33 * distribution for details.
36 -#ifndef __USB_H__
37 -#define __USB_H__
38 +#ifndef USB_H
39 +#define USB_H
41 #include <unistd.h>
42 #include <stdlib.h>
43 @@ -31,6 +32,15 @@
45 #include <dirent.h>
47 +/* stdint.h is not available on older MSVC */
48 +#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H))
49 +typedef unsigned __int8 uint8_t;
50 +typedef unsigned __int16 uint16_t;
51 +typedef unsigned __int32 uint32_t;
52 +#else
53 +#include <stdint.h>
54 +#endif
57 * USB spec information
59 @@ -78,40 +88,40 @@
61 /* All standard descriptors have these 2 fields in common */
62 struct usb_descriptor_header {
63 - u_int8_t bLength;
64 - u_int8_t bDescriptorType;
65 + uint8_t bLength;
66 + uint8_t bDescriptorType;
69 /* String descriptor */
70 struct usb_string_descriptor {
71 - u_int8_t bLength;
72 - u_int8_t bDescriptorType;
73 - u_int16_t wData[1];
74 + uint8_t bLength;
75 + uint8_t bDescriptorType;
76 + uint16_t wData[1];
79 /* HID descriptor */
80 struct usb_hid_descriptor {
81 - u_int8_t bLength;
82 - u_int8_t bDescriptorType;
83 - u_int16_t bcdHID;
84 - u_int8_t bCountryCode;
85 - u_int8_t bNumDescriptors;
86 - /* u_int8_t bReportDescriptorType; */
87 - /* u_int16_t wDescriptorLength; */
88 + uint8_t bLength;
89 + uint8_t bDescriptorType;
90 + uint16_t bcdHID;
91 + uint8_t bCountryCode;
92 + uint8_t bNumDescriptors;
93 + /* uint8_t bReportDescriptorType; */
94 + /* uint16_t wDescriptorLength; */
95 /* ... */
98 /* Endpoint descriptor */
99 #define USB_MAXENDPOINTS 32
100 struct usb_endpoint_descriptor {
101 - u_int8_t bLength;
102 - u_int8_t bDescriptorType;
103 - u_int8_t bEndpointAddress;
104 - u_int8_t bmAttributes;
105 - u_int16_t wMaxPacketSize;
106 - u_int8_t bInterval;
107 - u_int8_t bRefresh;
108 - u_int8_t bSynchAddress;
109 + uint8_t bLength;
110 + uint8_t bDescriptorType;
111 + uint8_t bEndpointAddress;
112 + uint8_t bmAttributes;
113 + uint16_t wMaxPacketSize;
114 + uint8_t bInterval;
115 + uint8_t bRefresh;
116 + uint8_t bSynchAddress;
118 unsigned char *extra; /* Extra descriptors */
119 int extralen;
120 @@ -129,15 +139,15 @@ struct usb_endpoint_descriptor {
121 /* Interface descriptor */
122 #define USB_MAXINTERFACES 32
123 struct usb_interface_descriptor {
124 - u_int8_t bLength;
125 - u_int8_t bDescriptorType;
126 - u_int8_t bInterfaceNumber;
127 - u_int8_t bAlternateSetting;
128 - u_int8_t bNumEndpoints;
129 - u_int8_t bInterfaceClass;
130 - u_int8_t bInterfaceSubClass;
131 - u_int8_t bInterfaceProtocol;
132 - u_int8_t iInterface;
133 + uint8_t bLength;
134 + uint8_t bDescriptorType;
135 + uint8_t bInterfaceNumber;
136 + uint8_t bAlternateSetting;
137 + uint8_t bNumEndpoints;
138 + uint8_t bInterfaceClass;
139 + uint8_t bInterfaceSubClass;
140 + uint8_t bInterfaceProtocol;
141 + uint8_t iInterface;
143 struct usb_endpoint_descriptor *endpoint;
145 @@ -155,14 +165,14 @@ struct usb_interface {
146 /* Configuration descriptor information.. */
147 #define USB_MAXCONFIG 8
148 struct usb_config_descriptor {
149 - u_int8_t bLength;
150 - u_int8_t bDescriptorType;
151 - u_int16_t wTotalLength;
152 - u_int8_t bNumInterfaces;
153 - u_int8_t bConfigurationValue;
154 - u_int8_t iConfiguration;
155 - u_int8_t bmAttributes;
156 - u_int8_t MaxPower;
157 + uint8_t bLength;
158 + uint8_t bDescriptorType;
159 + uint16_t wTotalLength;
160 + uint8_t bNumInterfaces;
161 + uint8_t bConfigurationValue;
162 + uint8_t iConfiguration;
163 + uint8_t bmAttributes;
164 + uint8_t MaxPower;
166 struct usb_interface *interface;
168 @@ -172,28 +182,28 @@ struct usb_config_descriptor {
170 /* Device descriptor */
171 struct usb_device_descriptor {
172 - u_int8_t bLength;
173 - u_int8_t bDescriptorType;
174 - u_int16_t bcdUSB;
175 - u_int8_t bDeviceClass;
176 - u_int8_t bDeviceSubClass;
177 - u_int8_t bDeviceProtocol;
178 - u_int8_t bMaxPacketSize0;
179 - u_int16_t idVendor;
180 - u_int16_t idProduct;
181 - u_int16_t bcdDevice;
182 - u_int8_t iManufacturer;
183 - u_int8_t iProduct;
184 - u_int8_t iSerialNumber;
185 - u_int8_t bNumConfigurations;
186 + uint8_t bLength;
187 + uint8_t bDescriptorType;
188 + uint16_t bcdUSB;
189 + uint8_t bDeviceClass;
190 + uint8_t bDeviceSubClass;
191 + uint8_t bDeviceProtocol;
192 + uint8_t bMaxPacketSize0;
193 + uint16_t idVendor;
194 + uint16_t idProduct;
195 + uint16_t bcdDevice;
196 + uint8_t iManufacturer;
197 + uint8_t iProduct;
198 + uint8_t iSerialNumber;
199 + uint8_t bNumConfigurations;
202 struct usb_ctrl_setup {
203 - u_int8_t bRequestType;
204 - u_int8_t bRequest;
205 - u_int16_t wValue;
206 - u_int16_t wIndex;
207 - u_int16_t wLength;
208 + uint8_t bRequestType;
209 + uint8_t bRequest;
210 + uint16_t wValue;
211 + uint16_t wIndex;
212 + uint16_t wLength;
216 @@ -254,7 +264,7 @@ struct usb_device {
218 void *dev; /* Darwin support */
220 - u_int8_t devnum;
221 + uint8_t devnum;
223 unsigned char num_children;
224 struct usb_device **children;
225 @@ -266,7 +276,7 @@ struct usb_bus {
226 char dirname[PATH_MAX + 1];
228 struct usb_device *devices;
229 - u_int32_t location;
230 + uint32_t location;
232 struct usb_device *root_dev;
235 2.4.9