libusb.h   libusb.h 
skipping to change at line 24 skipping to change at line 24
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __LIBUSB_H__ #ifndef __LIBUSB_H__
#define __LIBUSB_H__ #define __LIBUSB_H__
#include <endian.h>
#include <stdint.h> #include <stdint.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#define bswap16(x) (((x & 0xff) << 8) | (x >> 8)) #ifdef __cplusplus
#if __BYTE_ORDER == __LITTLE_ENDIAN extern "C" {
#define libusb_cpu_to_le16(x) (x)
#define libusb_le16_to_cpu(x) (x)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define libusb_le16_to_cpu(x) bswap16(x)
#define libusb_cpu_to_le16(x) bswap16(x)
#else
#error "Unrecognized endianness"
#endif #endif
/** \def libusb_cpu_to_le16 /** \def libusb_cpu_to_le16
* \ingroup misc * \ingroup misc
* Convert a 16-bit value from host-endian to little-endian format. On * Convert a 16-bit value from host-endian to little-endian format. On
* little endian systems, this function does nothing. On big endian systems , * little endian systems, this function does nothing. On big endian systems ,
* the bytes are swapped. * the bytes are swapped.
* \param x the host-endian value to convert * \param x the host-endian value to convert
* \returns the value in little-endian byte order * \returns the value in little-endian byte order
*/ */
#define libusb_cpu_to_le16(x) ({ \
union { \
uint8_t b8[2]; \
uint16_t b16; \
} _tmp; \
uint16_t _tmp2 = (uint16_t)(x); \
_tmp.b8[1] = _tmp2 >> 8; \
_tmp.b8[0] = _tmp2 & 0xff; \
_tmp.b16; \
})
/** \def libusb_le16_to_cpu /** \def libusb_le16_to_cpu
* \ingroup misc * \ingroup misc
* Convert a 16-bit value from little-endian to host-endian format. On * Convert a 16-bit value from little-endian to host-endian format. On
* little endian systems, this function does nothing. On big endian systems , * little endian systems, this function does nothing. On big endian systems ,
* the bytes are swapped. * the bytes are swapped.
* \param x the little-endian value to convert * \param x the little-endian value to convert
* \returns the value in host-endian byte order * \returns the value in host-endian byte order
*/ */
#define libusb_le16_to_cpu libusb_cpu_to_le16
#ifdef __cplusplus
extern "C" {
#endif
/* standard USB stuff */ /* standard USB stuff */
/** \ingroup desc /** \ingroup desc
* Device and/or Interface Class codes */ * Device and/or Interface Class codes */
enum libusb_class_code { enum libusb_class_code {
/** In the context of a \ref libusb_device_descriptor "device descri ptor", /** In the context of a \ref libusb_device_descriptor "device descri ptor",
* this bDeviceClass value indicates that each interface specifies i ts * this bDeviceClass value indicates that each interface specifies i ts
* own class information and all interfaces operate independently. * own class information and all interfaces operate independently.
*/ */
skipping to change at line 692 skipping to change at line 691
/** Amount of data that was actually transferred */ /** Amount of data that was actually transferred */
unsigned int actual_length; unsigned int actual_length;
/** 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
* Asynchronous transfer callback function type. When submitting asynchrono
us
* 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
* structure. libusb will call this function later, when the transfer has
* completed or failed. See \ref asyncio for more information.
* \param transfer The libusb_transfer struct the callback function is bein
g
* notified about.
*/
typedef void (*libusb_transfer_cb_fn)(struct libusb_transfer *transfer); typedef void (*libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
/** \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
* it back to the user. * it back to the user.
*/ */
struct libusb_transfer { struct libusb_transfer {
/** Handle of the device that this transfer will be submitted to */ /** Handle of the device that this transfer will be submitted to */
skipping to change at line 749 skipping to change at line 757
void *user_data; void *user_data;
/** Data buffer */ /** Data buffer */
unsigned char *buffer; unsigned char *buffer;
/** Number of isochronous packets. Only used for I/O with isochronou s /** Number of isochronous packets. Only used for I/O with isochronou s
* endpoints. */ * endpoints. */
int num_iso_packets; int num_iso_packets;
/** Isochronous packet descriptors, for isochronous transfers only. */ /** Isochronous packet descriptors, for isochronous transfers only. */
struct libusb_iso_packet_descriptor iso_packet_desc[0]; struct libusb_iso_packet_descriptor iso_packet_desc
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
[] /* valid C99 code */
#else
[0] /* non-standard, but usually working code */
#endif
;
}; };
int libusb_init(libusb_context **ctx); int libusb_init(libusb_context **ctx);
void libusb_exit(libusb_context *ctx); void libusb_exit(libusb_context *ctx);
void libusb_set_debug(libusb_context *ctx, int level); void libusb_set_debug(libusb_context *ctx, int level);
ssize_t libusb_get_device_list(libusb_context *ctx, ssize_t libusb_get_device_list(libusb_context *ctx,
libusb_device ***list); libusb_device ***list);
void libusb_free_device_list(libusb_device **list, int unref_devices); void libusb_free_device_list(libusb_device **list, int unref_devices);
libusb_device *libusb_ref_device(libusb_device *dev); libusb_device *libusb_ref_device(libusb_device *dev);
 End of changes. 6 change blocks. 
15 lines changed or deleted 32 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/