30 #define USB_CLASS_PER_INTERFACE 0
31 #define USB_CLASS_AUDIO 1
32 #define USB_CLASS_COMM 2
33 #define USB_CLASS_HID 3
34 #define USB_CLASS_PRINTER 7
35 #define USB_CLASS_PTP 6
36 #define USB_CLASS_MASS_STORAGE 8
37 #define USB_CLASS_HUB 9
38 #define USB_CLASS_DATA 10
39 #define USB_CLASS_VENDOR_SPEC 0xff
44 #define USB_DT_DEVICE 0x01
45 #define USB_DT_CONFIG 0x02
46 #define USB_DT_STRING 0x03
47 #define USB_DT_INTERFACE 0x04
48 #define USB_DT_ENDPOINT 0x05
50 #define USB_DT_HID 0x21
51 #define USB_DT_REPORT 0x22
52 #define USB_DT_PHYSICAL 0x23
53 #define USB_DT_HUB 0x29
58 #define USB_DT_DEVICE_SIZE 18
59 #define USB_DT_CONFIG_SIZE 9
60 #define USB_DT_INTERFACE_SIZE 9
61 #define USB_DT_ENDPOINT_SIZE 7
62 #define USB_DT_ENDPOINT_AUDIO_SIZE 9
63 #define USB_DT_HUB_NONVAR_SIZE 7
68 u_int8_t bDescriptorType;
74 u_int8_t bDescriptorType;
81 u_int8_t bDescriptorType;
83 u_int8_t bCountryCode;
84 u_int8_t bNumDescriptors;
91 #define USB_MAXENDPOINTS 32
94 u_int8_t bDescriptorType;
95 u_int8_t bEndpointAddress;
96 u_int8_t bmAttributes;
97 u_int16_t wMaxPacketSize;
100 u_int8_t bSynchAddress;
102 unsigned char *extra;
106 #define USB_ENDPOINT_ADDRESS_MASK 0x0f
107 #define USB_ENDPOINT_DIR_MASK 0x80
109 #define USB_ENDPOINT_TYPE_MASK 0x03
110 #define USB_ENDPOINT_TYPE_CONTROL 0
111 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
112 #define USB_ENDPOINT_TYPE_BULK 2
113 #define USB_ENDPOINT_TYPE_INTERRUPT 3
116 #define USB_MAXINTERFACES 32
119 u_int8_t bDescriptorType;
120 u_int8_t bInterfaceNumber;
121 u_int8_t bAlternateSetting;
122 u_int8_t bNumEndpoints;
123 u_int8_t bInterfaceClass;
124 u_int8_t bInterfaceSubClass;
125 u_int8_t bInterfaceProtocol;
130 unsigned char *extra;
134 #define USB_MAXALTSETTING 128
142 #define USB_MAXCONFIG 8
145 u_int8_t bDescriptorType;
146 u_int16_t wTotalLength;
147 u_int8_t bNumInterfaces;
148 u_int8_t bConfigurationValue;
149 u_int8_t iConfiguration;
150 u_int8_t bmAttributes;
155 unsigned char *extra;
162 u_int8_t bDescriptorType;
164 u_int8_t bDeviceClass;
165 u_int8_t bDeviceSubClass;
166 u_int8_t bDeviceProtocol;
167 u_int8_t bMaxPacketSize0;
171 u_int8_t iManufacturer;
173 u_int8_t iSerialNumber;
174 u_int8_t bNumConfigurations;
178 u_int8_t bRequestType;
188 #define USB_REQ_GET_STATUS 0x00
189 #define USB_REQ_CLEAR_FEATURE 0x01
191 #define USB_REQ_SET_FEATURE 0x03
193 #define USB_REQ_SET_ADDRESS 0x05
194 #define USB_REQ_GET_DESCRIPTOR 0x06
195 #define USB_REQ_SET_DESCRIPTOR 0x07
196 #define USB_REQ_GET_CONFIGURATION 0x08
197 #define USB_REQ_SET_CONFIGURATION 0x09
198 #define USB_REQ_GET_INTERFACE 0x0A
199 #define USB_REQ_SET_INTERFACE 0x0B
200 #define USB_REQ_SYNCH_FRAME 0x0C
202 #define USB_TYPE_STANDARD (0x00 << 5)
203 #define USB_TYPE_CLASS (0x01 << 5)
204 #define USB_TYPE_VENDOR (0x02 << 5)
205 #define USB_TYPE_RESERVED (0x03 << 5)
207 #define USB_RECIP_DEVICE 0x00
208 #define USB_RECIP_INTERFACE 0x01
209 #define USB_RECIP_ENDPOINT 0x02
210 #define USB_RECIP_OTHER 0x03
216 #define USB_ENDPOINT_IN 0x80
217 #define USB_ENDPOINT_OUT 0x00
220 #define USB_ERROR_BEGIN 500000
227 #define USB_LE16_TO_CPU(x) do { x = ((x & 0xff) << 8) | ((x & 0xff00) >> 8); } while(0)
229 #define USB_LE16_TO_CPU(x)
244 char filename[PATH_MAX + 1];
255 unsigned char num_children;
262 char dirname[PATH_MAX + 1];
270 struct usb_dev_handle;
271 typedef struct usb_dev_handle usb_dev_handle;
274 extern struct usb_bus *usb_busses;
283 usb_dev_handle *usb_open(
struct usb_device *dev);
284 int usb_close(usb_dev_handle *dev);
285 int usb_get_string(usb_dev_handle *dev,
int index,
int langid,
char *buf,
287 int usb_get_string_simple(usb_dev_handle *dev,
int index,
char *buf,
291 int usb_get_descriptor_by_endpoint(usb_dev_handle *udev,
int ep,
292 unsigned char type,
unsigned char index,
void *buf,
int size);
293 int usb_get_descriptor(usb_dev_handle *udev,
unsigned char type,
294 unsigned char index,
void *buf,
int size);
297 int usb_bulk_write(usb_dev_handle *dev,
int ep,
char *
bytes,
int size,
299 int usb_bulk_read(usb_dev_handle *dev,
int ep,
char *
bytes,
int size,
301 int usb_interrupt_write(usb_dev_handle *dev,
int ep,
char *
bytes,
int size,
303 int usb_interrupt_read(usb_dev_handle *dev,
int ep,
char *
bytes,
int size,
305 int usb_control_msg(usb_dev_handle *dev,
int requesttype,
int request,
306 int value,
int index,
char *
bytes,
int size,
int timeout);
307 int usb_set_configuration(usb_dev_handle *dev,
int configuration);
308 int usb_claim_interface(usb_dev_handle *dev,
int interface);
309 int usb_release_interface(usb_dev_handle *dev,
int interface);
310 int usb_set_altinterface(usb_dev_handle *dev,
int alternate);
311 int usb_resetep(usb_dev_handle *dev,
unsigned int ep);
312 int usb_clear_halt(usb_dev_handle *dev,
unsigned int ep);
313 int usb_reset(usb_dev_handle *dev);
316 #define LIBUSB_HAS_GET_DRIVER_NP 1
317 int usb_get_driver_np(usb_dev_handle *dev,
int interface,
char *name,
318 unsigned int namelen);
319 #define LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP 1
320 int usb_detach_kernel_driver_np(usb_dev_handle *dev,
int interface);
323 char *usb_strerror(
void);
326 void usb_set_debug(
int level);
327 int usb_find_busses(
void);
328 int usb_find_devices(
void);
330 struct usb_bus *usb_get_busses(
void);
Definition: compress.c:3289
Definition: compress.c:1548