libusb.h   libusb.h 
/* /*
* Public libusb header file * Public libusbx header file
* Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org> * Copyright
* Copyright (c) 2001 Johannes Erdfelt <johannes@erdfelt.com> * Copyright
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
skipping to change at line 57 skipping to change at line 57
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <limits.h> #include <limits.h>
#if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__) #if defined(__linux) || defined(__APPLE__) || defined(__CYGWIN__)
#include <sys/time.h> #include <sys/time.h>
#endif #endif
/* 'interface' might be defined as a macro on Windows, so we need to /* 'interface' might be defined as a macro on Windows, so we need to
* undefine it so as not to break the current libusb API, because * undefine it so as not to break the current libusbx API, because
* libusb_config_descriptor has an 'interface' member * libusb_config_descriptor has an 'interface' member
* As this can be problematic if you include windows.h after libusb.h * As this can be problematic if you include windows.h after libusb.h
* in your sources, we force windows.h to be included first. */ * in your sources, we force windows.h to be included first. */
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
#include <windows.h> #include <windows.h>
#if defined(interface) #if defined(interface)
#undef interface #undef interface
#endif #endif
#endif #endif
/** \def LIBUSB_CALL /** \def LIBUSB_CALL
* \ingroup misc * \ingroup misc
* libusb's Windows calling convention. * libusbx's Windows calling convention.
* *
* Under Windows, the selection of available compilers and configurations * Under Windows, the selection of available compilers and configurations
* means that, unlike other platforms, there is not <em>one true calling * means that, unlike other platforms, there is not <em>one true calling
* convention</em> (calling convention: the manner in which parameters are * convention</em> (calling convention: the manner in which parameters are
* passed to funcions in the generated assembly code). * passed to funcions in the generated assembly code).
* *
* Matching the Windows API itself, libusb uses the WINAPI convention (whic h * Matching the Windows API itself, libusbx uses the WINAPI convention (whi ch
* translates to the <tt>stdcall</tt> convention) and guarantees that the * translates to the <tt>stdcall</tt> convention) and guarantees that the
* library is compiled in this way. The public header file also includes * library is compiled in this way. The public header file also includes
* appropriate annotations so that your own software will use the right * appropriate annotations so that your own software will use the right
* convention, even if another convention is being used by default within * convention, even if another convention is being used by default within
* your codebase. * your codebase.
* *
* The one consideration that you must apply in your software is to mark * The one consideration that you must apply in your software is to mark
* all functions which you use as libusb callbacks with this LIBUSB_CALL * all functions which you use as libusbx callbacks with this LIBUSB_CALL
* annotation, so that they too get compiled for the correct calling * annotation, so that they too get compiled for the correct calling
* convention. * convention.
* *
* On non-Windows operating systems, this macro is defined as nothing. This * On non-Windows operating systems, this macro is defined as nothing. This
* means that you can apply it to your code without worrying about * means that you can apply it to your code without worrying about
* cross-platform compatibility. * cross-platform compatibility.
*/ */
/* LIBUSB_CALL must be defined on both definition and declaration of libusb /* LIBUSB_CALL must be defined on both definition and declaration of libusb x
* functions. You'd think that declaration would be enough, but cygwin will * functions. You'd think that declaration would be enough, but cygwin will
* complain about conflicting types unless both are marked this way. * complain about conflicting types unless both are marked this way.
* The placement of this macro is important too; it must appear after the * The placement of this macro is important too; it must appear after the
* return type, before the function name. See internal documentation for * return type, before the function name. See internal documentation for
* API_EXPORTED. * API_EXPORTED.
*/ */
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
#define LIBUSB_CALL WINAPI #define LIBUSB_CALL WINAPI
#else #else
#define LIBUSB_CALL #define LIBUSB_CALL
skipping to change at line 489 skipping to change at line 489
/** Interval for polling endpoint for data transfers. */ /** Interval for polling endpoint for data transfers. */
uint8_t bInterval; uint8_t bInterval;
/** For audio devices only: the rate at which synchronization feedba ck /** For audio devices only: the rate at which synchronization feedba ck
* is provided. */ * is provided. */
uint8_t bRefresh; uint8_t bRefresh;
/** For audio devices only: the address if the synch endpoint */ /** For audio devices only: the address if the synch endpoint */
uint8_t bSynchAddress; uint8_t bSynchAddress;
/** Extra descriptors. If libusb encounters unknown endpoint descrip tors, /** Extra descriptors. If libusbx encounters unknown endpoint descri ptors,
* it will store them here, should you wish to parse them. */ * it will store them here, should you wish to parse them. */
const unsigned char *extra; const unsigned char *extra;
/** Length of the extra descriptors, in bytes. */ /** Length of the extra descriptors, in bytes. */
int extra_length; int extra_length;
}; };
/** \ingroup desc /** \ingroup desc
* A structure representing the standard USB interface descriptor. This * A structure representing the standard USB interface descriptor. This
* descriptor is documented in section 9.6.5 of the USB 2.0 specification. * descriptor is documented in section 9.6.5 of the USB 2.0 specification.
skipping to change at line 539 skipping to change at line 539
* bInterfaceClass and bInterfaceSubClass values */ * bInterfaceClass and bInterfaceSubClass values */
uint8_t bInterfaceProtocol; uint8_t bInterfaceProtocol;
/** Index of string descriptor describing this interface */ /** Index of string descriptor describing this interface */
uint8_t iInterface; uint8_t iInterface;
/** Array of endpoint descriptors. This length of this array is dete rmined /** Array of endpoint descriptors. This length of this array is dete rmined
* by the bNumEndpoints field. */ * by the bNumEndpoints field. */
const struct libusb_endpoint_descriptor *endpoint; const struct libusb_endpoint_descriptor *endpoint;
/** Extra descriptors. If libusb encounters unknown interface descri ptors, /** Extra descriptors. If libusbx encounters unknown interface descr iptors,
* it will store them here, should you wish to parse them. */ * it will store them here, should you wish to parse them. */
const unsigned char *extra; const unsigned char *extra;
/** Length of the extra descriptors, in bytes. */ /** Length of the extra descriptors, in bytes. */
int extra_length; int extra_length;
}; };
/** \ingroup desc /** \ingroup desc
* A collection of alternate settings for a particular USB interface. * A collection of alternate settings for a particular USB interface.
*/ */
skipping to change at line 597 skipping to change at line 597
/** Maximum power consumption of the USB device from this bus in thi s /** Maximum power consumption of the USB device from this bus in thi s
* configuration when the device is fully opreation. Expressed in un its * configuration when the device is fully opreation. Expressed in un its
* of 2 mA. */ * of 2 mA. */
uint8_t MaxPower; uint8_t MaxPower;
/** Array of interfaces supported by this configuration. The length of /** Array of interfaces supported by this configuration. The length of
* this array is determined by the bNumInterfaces field. */ * this array is determined by the bNumInterfaces field. */
const struct libusb_interface *interface; const struct libusb_interface *interface;
/** Extra descriptors. If libusb encounters unknown configuration /** Extra descriptors. If libusbx encounters unknown configuration
* descriptors, it will store them here, should you wish to parse th em. */ * descriptors, it will store them here, should you wish to parse th em. */
const unsigned char *extra; const unsigned char *extra;
/** Length of the extra descriptors, in bytes. */ /** Length of the extra descriptors, in bytes. */
int extra_length; int extra_length;
}; };
/** \ingroup asyncio /** \ingroup asyncio
* Setup packet for control transfers. */ * Setup packet for control transfers. */
struct libusb_control_setup { struct libusb_control_setup {
skipping to change at line 635 skipping to change at line 635
/** Index. Varies according to request, typically used to pass an in dex /** Index. Varies according to request, typically used to pass an in dex
* or offset */ * or offset */
uint16_t wIndex; uint16_t wIndex;
/** Number of bytes to transfer */ /** Number of bytes to transfer */
uint16_t wLength; uint16_t wLength;
}; };
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup))
/* libusb */ /* libusbx */
struct libusb_context; struct libusb_context;
struct libusb_device; struct libusb_device;
struct libusb_device_handle; struct libusb_device_handle;
/** \ingroup lib /** \ingroup lib
* Structure representing a libusb session. The concept of individual libus * Structure providing the version of libusbx currently in use
b */
struct libusb_version {
uint16_t major;
uint16_t minor;
uint16_t micro;
uint16_t nano;
};
/** \ingroup lib
* Structure representing a libusbx session. The concept of individual libu
sbx
* sessions allows for your program to use two libraries (or dynamically * sessions allows for your program to use two libraries (or dynamically
* load two modules) which both independently use libusb. This will prevent * load two modules) which both independently use libusb. This will prevent
* interference between the individual libusb users - for example * interference between the individual libusbx users - for example
* libusb_set_debug() will not affect the other user of the library, and * libusb_set_debug() will not affect the other user of the library, and
* libusb_exit() will not destroy resources that the other user is still * libusb_exit() will not destroy resources that the other user is still
* using. * using.
* *
* Sessions are created by libusb_init() and destroyed through libusb_exit( ). * Sessions are created by libusb_init() and destroyed through libusb_exit( ).
* If your application is guaranteed to only ever include a single libusb * If your application is guaranteed to only ever include a single libusbx
* user (i.e. you), you do not have to worry about contexts: pass NULL in * user (i.e. you), you do not have to worry about contexts: pass NULL in
* every function call where a context is required. The default context * every function call where a context is required. The default context
* will be used. * will be used.
* *
* For more information, see \ref contexts. * For more information, see \ref contexts.
*/ */
typedef struct libusb_context libusb_context; typedef struct libusb_context libusb_context;
/** \ingroup dev /** \ingroup dev
* Structure representing a USB device detected on the system. This is an * Structure representing a USB device detected on the system. This is an
skipping to change at line 691 skipping to change at line 701
* *
* A device handle is used to perform I/O and other operations. When finish ed * A device handle is used to perform I/O and other operations. When finish ed
* with a device handle, you should call libusb_close(). * with a device handle, you should call libusb_close().
*/ */
typedef struct libusb_device_handle libusb_device_handle; typedef struct libusb_device_handle libusb_device_handle;
/** \ingroup dev /** \ingroup dev
* Speed codes. Indicates the speed at which the device is operating. * Speed codes. Indicates the speed at which the device is operating.
*/ */
enum libusb_speed { enum libusb_speed {
/** The OS doesn't report or know the device speed. */ /** The OS doesn't report or know the device speed. */
LIBUSB_SPEED_UNKNOWN = 0, LIBUSB_SPEED_UNKNOWN = 0,
/** The device is operating at low speed (1.5MBit/s). */ /** The device is operating at low speed (1.5MBit/s). */
LIBUSB_SPEED_LOW = 1, LIBUSB_SPEED_LOW = 1,
/** The device is operating at full speed (12MBit/s). */ /** The device is operating at full speed (12MBit/s). */
LIBUSB_SPEED_FULL = 2, LIBUSB_SPEED_FULL = 2,
/** The device is operating at high speed (480MBit/s). */ /** The device is operating at high speed (480MBit/s). */
LIBUSB_SPEED_HIGH = 3, LIBUSB_SPEED_HIGH = 3,
/** The device is operating at super speed (5000MBit/s). */ /** The device is operating at super speed (5000MBit/s). */
LIBUSB_SPEED_SUPER = 4, LIBUSB_SPEED_SUPER = 4,
}; };
/** \ingroup misc /** \ingroup misc
* Error codes. Most libusb functions return 0 on success or one of these * Error codes. Most libusbx functions return 0 on success or one of these
* codes on failure. * codes on failure.
* You can call \ref libusb_error_name() to retrieve a string representatio n * You can call \ref libusb_error_name() to retrieve a string representatio n
* of an error code. * of an error code.
*/ */
enum libusb_error { enum libusb_error {
/** Success (no error) */ /** Success (no error) */
LIBUSB_SUCCESS = 0, LIBUSB_SUCCESS = 0,
/** Input/output error */ /** Input/output error */
LIBUSB_ERROR_IO = -1, LIBUSB_ERROR_IO = -1,
skipping to change at line 847 skipping to change at line 857
/** Status code for this packet */ /** Status code for this packet */
enum libusb_transfer_status status; enum libusb_transfer_status status;
}; };
struct libusb_transfer; struct libusb_transfer;
/** \ingroup asyncio /** \ingroup asyncio
* Asynchronous transfer callback function type. When submitting asynchrono us * Asynchronous transfer callback function type. When submitting asynchrono us
* transfers, you pass a pointer to a callback function of this type via th e * transfers, you pass a pointer to a callback function of this type via th e
* \ref libusb_transfer::callback "callback" member of the libusb_transfer * \ref libusb_transfer::callback "callback" member of the libusb_transfer
* structure. libusb will call this function later, when the transfer has * structure. libusbx will call this function later, when the transfer has
* completed or failed. See \ref asyncio for more information. * completed or failed. See \ref asyncio for more information.
* \param transfer The libusb_transfer struct the callback function is bein g * \param transfer The libusb_transfer struct the callback function is bein g
* notified about. * notified about.
*/ */
typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *t ransfer); typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *t ransfer);
/** \ingroup asyncio /** \ingroup asyncio
* The generic USB transfer structure. The user populates this structure an d * The generic USB transfer structure. The user populates this structure an d
* then submits it in order to request a transfer. After the transfer has * then submits it in order to request a transfer. After the transfer has
* completed, the library populates the transfer with the results and passe s * completed, the library populates the transfer with the results and passe s
skipping to change at line 931 skipping to change at line 941
* \ref libusb_has_capability(). * \ref libusb_has_capability().
*/ */
enum libusb_capability { enum libusb_capability {
/** The libusb_has_capability() API is available. */ /** The libusb_has_capability() API is available. */
LIBUSB_CAP_HAS_CAPABILITY = 0, LIBUSB_CAP_HAS_CAPABILITY = 0,
}; };
int LIBUSB_CALL libusb_init(libusb_context **ctx); int LIBUSB_CALL libusb_init(libusb_context **ctx);
void LIBUSB_CALL libusb_exit(libusb_context *ctx); void LIBUSB_CALL libusb_exit(libusb_context *ctx);
void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
const struct libusb_version * LIBUSB_CALL libusb_get_version(void);
int LIBUSB_CALL libusb_has_capability(uint32_t capability); int LIBUSB_CALL libusb_has_capability(uint32_t capability);
const char * LIBUSB_CALL libusb_error_name(int errcode); const char * LIBUSB_CALL libusb_error_name(int errcode);
ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx, ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx,
libusb_device ***list); libusb_device ***list);
void LIBUSB_CALL libusb_free_device_list(libusb_device **list, void LIBUSB_CALL libusb_free_device_list(libusb_device **list,
int unref_devices); int unref_devices);
libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev); libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev);
void LIBUSB_CALL libusb_unref_device(libusb_device *dev); void LIBUSB_CALL libusb_unref_device(libusb_device *dev);
 End of changes. 21 change blocks. 
28 lines changed or deleted 39 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/