8 #define EXTERN __declspec(dllimport)
9 #define LIBUSB_APIDECL __cdecl
25 #define LIBUSB_PATH_MAX 512
38 #define USB_CLASS_PER_INTERFACE 0
39 #define USB_CLASS_AUDIO 1
40 #define USB_CLASS_COMM 2
41 #define USB_CLASS_HID 3
42 #define USB_CLASS_PRINTER 7
43 #define USB_CLASS_MASS_STORAGE 8
44 #define USB_CLASS_HUB 9
45 #define USB_CLASS_DATA 10
46 #define USB_CLASS_VENDOR_SPEC 0xff
51 #define USB_DT_DEVICE 0x01
52 #define USB_DT_CONFIG 0x02
53 #define USB_DT_STRING 0x03
54 #define USB_DT_INTERFACE 0x04
55 #define USB_DT_ENDPOINT 0x05
57 #define USB_DT_HID 0x21
58 #define USB_DT_REPORT 0x22
59 #define USB_DT_PHYSICAL 0x23
60 #define USB_DT_HUB 0x29
65 #define USB_DT_DEVICE_SIZE 18
66 #define USB_DT_CONFIG_SIZE 9
67 #define USB_DT_INTERFACE_SIZE 9
68 #define USB_DT_ENDPOINT_SIZE 7
69 #define USB_DT_ENDPOINT_AUDIO_SIZE 9
70 #define USB_DT_HUB_NONVAR_SIZE 7
79 unsigned char bLength;
80 unsigned char bDescriptorType;
85 unsigned char bLength;
86 unsigned char bDescriptorType;
87 unsigned short wData[1];
92 unsigned char bLength;
93 unsigned char bDescriptorType;
94 unsigned short bcdHID;
95 unsigned char bCountryCode;
96 unsigned char bNumDescriptors;
100 #define USB_MAXENDPOINTS 32
102 unsigned char bLength;
103 unsigned char bDescriptorType;
104 unsigned char bEndpointAddress;
105 unsigned char bmAttributes;
106 unsigned short wMaxPacketSize;
107 unsigned char bInterval;
108 unsigned char bRefresh;
109 unsigned char bSynchAddress;
111 unsigned char *extra;
115 #define USB_ENDPOINT_ADDRESS_MASK 0x0f
116 #define USB_ENDPOINT_DIR_MASK 0x80
118 #define USB_ENDPOINT_TYPE_MASK 0x03
119 #define USB_ENDPOINT_TYPE_CONTROL 0
120 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 1
121 #define USB_ENDPOINT_TYPE_BULK 2
122 #define USB_ENDPOINT_TYPE_INTERRUPT 3
125 #define USB_MAXINTERFACES 32
127 unsigned char bLength;
128 unsigned char bDescriptorType;
129 unsigned char bInterfaceNumber;
130 unsigned char bAlternateSetting;
131 unsigned char bNumEndpoints;
132 unsigned char bInterfaceClass;
133 unsigned char bInterfaceSubClass;
134 unsigned char bInterfaceProtocol;
135 unsigned char iInterface;
139 unsigned char *extra;
143 #define USB_MAXALTSETTING 128
152 #define USB_MAXCONFIG 8
154 unsigned char bLength;
155 unsigned char bDescriptorType;
156 unsigned short wTotalLength;
157 unsigned char bNumInterfaces;
158 unsigned char bConfigurationValue;
159 unsigned char iConfiguration;
160 unsigned char bmAttributes;
161 unsigned char MaxPower;
165 unsigned char *extra;
171 unsigned char bLength;
172 unsigned char bDescriptorType;
173 unsigned short bcdUSB;
174 unsigned char bDeviceClass;
175 unsigned char bDeviceSubClass;
176 unsigned char bDeviceProtocol;
177 unsigned char bMaxPacketSize0;
178 unsigned short idVendor;
179 unsigned short idProduct;
180 unsigned short bcdDevice;
181 unsigned char iManufacturer;
182 unsigned char iProduct;
183 unsigned char iSerialNumber;
184 unsigned char bNumConfigurations;
188 unsigned char bRequestType;
189 unsigned char bRequest;
190 unsigned short wValue;
191 unsigned short wIndex;
192 unsigned short wLength;
198 #define USB_REQ_GET_STATUS 0x00
199 #define USB_REQ_CLEAR_FEATURE 0x01
201 #define USB_REQ_SET_FEATURE 0x03
203 #define USB_REQ_SET_ADDRESS 0x05
204 #define USB_REQ_GET_DESCRIPTOR 0x06
205 #define USB_REQ_SET_DESCRIPTOR 0x07
206 #define USB_REQ_GET_CONFIGURATION 0x08
207 #define USB_REQ_SET_CONFIGURATION 0x09
208 #define USB_REQ_GET_INTERFACE 0x0A
209 #define USB_REQ_SET_INTERFACE 0x0B
210 #define USB_REQ_SYNCH_FRAME 0x0C
212 #define USB_TYPE_STANDARD (0x00 << 5)
213 #define USB_TYPE_CLASS (0x01 << 5)
214 #define USB_TYPE_VENDOR (0x02 << 5)
215 #define USB_TYPE_RESERVED (0x03 << 5)
217 #define USB_RECIP_DEVICE 0x00
218 #define USB_RECIP_INTERFACE 0x01
219 #define USB_RECIP_ENDPOINT 0x02
220 #define USB_RECIP_OTHER 0x03
226 #define USB_ENDPOINT_IN 0x80
227 #define USB_ENDPOINT_OUT 0x00
230 #define USB_ERROR_BEGIN 500000
236 #define USB_LE16_TO_CPU(x)
245 char filename[LIBUSB_PATH_MAX];
254 unsigned char devnum;
256 unsigned char num_children;
263 char dirname[LIBUSB_PATH_MAX];
266 unsigned long location;
288 struct usb_dev_handle;
289 typedef struct usb_dev_handle usb_dev_handle;
293 #define usb_busses usb_get_busses()
309 usb_dev_handle * LIBUSB_APIDECL usb_open(
struct usb_device *dev);
311 int LIBUSB_APIDECL usb_close(usb_dev_handle *dev);
313 int LIBUSB_APIDECL usb_get_string(usb_dev_handle *dev,
int index,
int langid,
char *buf,
316 int LIBUSB_APIDECL usb_get_string_simple(usb_dev_handle *dev,
int index,
char *buf,
321 int LIBUSB_APIDECL usb_get_descriptor_by_endpoint(usb_dev_handle *udev,
int ep,
322 unsigned char type,
unsigned char index,
323 void *buf,
int size);
325 int LIBUSB_APIDECL usb_get_descriptor(usb_dev_handle *udev,
unsigned char type,
326 unsigned char index,
void *buf,
int size);
330 int LIBUSB_APIDECL usb_bulk_write(usb_dev_handle *dev,
int ep,
char *bytes,
int size,
333 int LIBUSB_APIDECL usb_bulk_read(usb_dev_handle *dev,
int ep,
char *bytes,
int size,
336 int LIBUSB_APIDECL usb_interrupt_write(usb_dev_handle *dev,
int ep,
char *bytes,
int size,
339 int LIBUSB_APIDECL usb_interrupt_read(usb_dev_handle *dev,
int ep,
char *bytes,
int size,
342 int LIBUSB_APIDECL usb_control_msg(usb_dev_handle *dev,
int requesttype,
int request,
343 int value,
int index,
char *bytes,
int size,
346 int LIBUSB_APIDECL usb_set_configuration(usb_dev_handle *dev,
int configuration);
348 int LIBUSB_APIDECL usb_claim_interface(usb_dev_handle *dev,
int interface);
350 int LIBUSB_APIDECL usb_release_interface(usb_dev_handle *dev,
int interface);
352 int LIBUSB_APIDECL usb_set_altinterface(usb_dev_handle *dev,
int alternate);
354 int LIBUSB_APIDECL usb_resetep(usb_dev_handle *dev,
unsigned int ep);
356 int LIBUSB_APIDECL usb_clear_halt(usb_dev_handle *dev,
unsigned int ep);
358 int LIBUSB_APIDECL usb_reset(usb_dev_handle *dev);
361 char * LIBUSB_APIDECL usb_strerror(
void);
364 void LIBUSB_APIDECL usb_init(
void);
366 void LIBUSB_APIDECL usb_set_debug(
int level);
368 int LIBUSB_APIDECL usb_find_busses(
void);
370 int LIBUSB_APIDECL usb_find_devices(
void);
374 struct usb_bus * LIBUSB_APIDECL usb_get_busses(
void);
379 #define LIBUSB_HAS_INSTALL_SERVICE_NP 1
381 int LIBUSB_APIDECL usb_install_service_np(
void);
383 void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance,
384 LPSTR cmd_line,
int cmd_show);
386 #define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1
388 int LIBUSB_APIDECL usb_uninstall_service_np(
void);
390 void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance,
391 LPSTR cmd_line,
int cmd_show);
393 #define LIBUSB_HAS_INSTALL_DRIVER_NP 1
395 int LIBUSB_APIDECL usb_install_driver_np(
const char *inf_file);
397 void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance,
398 LPSTR cmd_line,
int cmd_show);
400 #define LIBUSB_HAS_TOUCH_INF_FILE_NP 1
402 int LIBUSB_APIDECL usb_touch_inf_file_np(
const char *inf_file);
404 void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance,
405 LPSTR cmd_line,
int cmd_show);
407 #define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1
409 int LIBUSB_APIDECL usb_install_needs_restart_np(
void);
412 const struct usb_version * LIBUSB_APIDECL usb_get_version(
void);
415 int LIBUSB_APIDECL usb_isochronous_setup_async(usb_dev_handle *dev,
void **context,
416 unsigned char ep,
int pktsize);
418 int LIBUSB_APIDECL usb_bulk_setup_async(usb_dev_handle *dev,
void **context,
421 int LIBUSB_APIDECL usb_interrupt_setup_async(usb_dev_handle *dev,
void **context,
425 int LIBUSB_APIDECL usb_submit_async(
void *context,
char *bytes,
int size);
427 int LIBUSB_APIDECL usb_reap_async(
void *context,
int timeout);
429 int LIBUSB_APIDECL usb_reap_async_nocancel(
void *context,
int timeout);
431 int LIBUSB_APIDECL usb_cancel_async(
void *context);
433 int LIBUSB_APIDECL usb_free_async(
void **context);