libusb.h (37d0636aac290cc86ec7149a55167f6c21ad480f) libusb.h (7bdc064b0b644d15bd9614d9e7db5c4279736d75)
1/* $FreeBSD$ */
2/*-
3 * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 222 unchanged lines hidden (view full) ---

231 * http://libusb.sourceforge.net/api-1.0/group__lib.html
232 */
233enum libusb_debug_level {
234 LIBUSB_DEBUG_NO=0,
235 LIBUSB_DEBUG_FUNCTION=1,
236 LIBUSB_DEBUG_TRANSFER=2,
237};
238
1/* $FreeBSD$ */
2/*-
3 * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 222 unchanged lines hidden (view full) ---

231 * http://libusb.sourceforge.net/api-1.0/group__lib.html
232 */
233enum libusb_debug_level {
234 LIBUSB_DEBUG_NO=0,
235 LIBUSB_DEBUG_FUNCTION=1,
236 LIBUSB_DEBUG_TRANSFER=2,
237};
238
239#define LIBUSB_HOTPLUG_MATCH_ANY -1
240
241typedef enum {
242 LIBUSB_HOTPLUG_NO_FLAGS = 0,
243 LIBUSB_HOTPLUG_ENUMERATE = 1 << 0,
244} libusb_hotplug_flag;
245
246typedef enum {
247 LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 1,
248 LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 2,
249} libusb_hotplug_event;
250
239/* libusb structures */
240
241struct libusb_context;
242struct libusb_device;
243struct libusb_transfer;
244struct libusb_device_handle;
251/* libusb structures */
252
253struct libusb_context;
254struct libusb_device;
255struct libusb_transfer;
256struct libusb_device_handle;
257struct libusb_hotplug_callback_handle;
245
246struct libusb_pollfd {
247 int fd;
248 short events;
249};
250
251struct libusb_version {
252 const uint16_t major;

--- 5 unchanged lines hidden (view full) ---

258};
259
260typedef struct libusb_context libusb_context;
261typedef struct libusb_device libusb_device;
262typedef struct libusb_device_handle libusb_device_handle;
263typedef struct libusb_pollfd libusb_pollfd;
264typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data);
265typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data);
258
259struct libusb_pollfd {
260 int fd;
261 short events;
262};
263
264struct libusb_version {
265 const uint16_t major;

--- 5 unchanged lines hidden (view full) ---

271};
272
273typedef struct libusb_context libusb_context;
274typedef struct libusb_device libusb_device;
275typedef struct libusb_device_handle libusb_device_handle;
276typedef struct libusb_pollfd libusb_pollfd;
277typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data);
278typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data);
279typedef struct libusb_hotplug_callback_handle *libusb_hotplug_callback_handle;
266
267typedef struct libusb_device_descriptor {
268 uint8_t bLength;
269 uint8_t bDescriptorType;
270 uint16_t bcdUSB;
271 uint8_t bDeviceClass;
272 uint8_t bDeviceSubClass;
273 uint8_t bDeviceProtocol;

--- 260 unchanged lines hidden (view full) ---

534int libusb_bulk_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
535int libusb_interrupt_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
536
537/* Byte-order */
538
539uint16_t libusb_cpu_to_le16(uint16_t x);
540uint16_t libusb_le16_to_cpu(uint16_t x);
541
280
281typedef struct libusb_device_descriptor {
282 uint8_t bLength;
283 uint8_t bDescriptorType;
284 uint16_t bcdUSB;
285 uint8_t bDeviceClass;
286 uint8_t bDeviceSubClass;
287 uint8_t bDeviceProtocol;

--- 260 unchanged lines hidden (view full) ---

548int libusb_bulk_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
549int libusb_interrupt_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
550
551/* Byte-order */
552
553uint16_t libusb_cpu_to_le16(uint16_t x);
554uint16_t libusb_le16_to_cpu(uint16_t x);
555
556/* Hotplug support */
557
558typedef int (*libusb_hotplug_callback_fn)(libusb_context *ctx,
559 libusb_device *device, libusb_hotplug_event event, void *user_data);
560
561int libusb_hotplug_register_callback(libusb_context *ctx, libusb_hotplug_event events, libusb_hotplug_flag flags, int vendor_id, int product_id, int dev_class, libusb_hotplug_callback_fn cb_fn, void *user_data, libusb_hotplug_callback_handle *handle);
562void libusb_hotplug_deregister_callback(libusb_context *ctx, libusb_hotplug_callback_handle handle);
563
542#if 0
543{ /* indent fix */
544#endif
545#ifdef __cplusplus
546}
547
548#endif
549
550#endif /* __LIBUSB_H__ */
564#if 0
565{ /* indent fix */
566#endif
567#ifdef __cplusplus
568}
569
570#endif
571
572#endif /* __LIBUSB_H__ */