From 257c0d9b563f91d6613a8dd8c6bb4be0a1366036 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 26 Mar 2013 10:14:52 +0100 Subject: Initial import --- libusbhp/libusbhp.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 libusbhp/libusbhp.h (limited to 'libusbhp/libusbhp.h') diff --git a/libusbhp/libusbhp.h b/libusbhp/libusbhp.h new file mode 100644 index 0000000..46558ee --- /dev/null +++ b/libusbhp/libusbhp.h @@ -0,0 +1,64 @@ +#ifndef __LIBUSBHP_H__ +#define __LIBUSBHP_H__ + +#ifdef WIN32 +#ifdef BUILD_DLL +/* DLL export */ +#define EXPORT __declspec(dllexport) +#else +/* EXE import */ +#define EXPORT __declspec(dllimport) +#endif +#include +#else +#define EXPORT +#include +#endif + +struct libusbhp_t; + +struct libusbhp_device_t { + unsigned short idVendor; + unsigned short idProduct; +}; + +typedef void (*libusbhp_hotplug_cb_fn)(struct libusbhp_device_t *device, + void *user_data); + +EXPORT + int libusbhp_init(struct libusbhp_t **handle); + +EXPORT + void libusbhp_exit(struct libusbhp_t *handle); + +EXPORT + int libusbhp_handle_events_timeout(struct libusbhp_t *handle, struct timeval *tv); + +EXPORT + void libusbhp_register_hotplug_listeners(struct libusbhp_t *handle, + libusbhp_hotplug_cb_fn connected_cb, + libusbhp_hotplug_cb_fn disconnected_cb, + void *user_data); + + +/*** +// Libusbx implementation: + +typedef void LIBUSB_CALL (*libusb_hotplug_cb_fn)(struct libusb_device *device, + void *user_data); + +int LIBUSB_CALL libusb_init(libusb_context **ctx); +void LIBUSB_CALL libusb_exit(libusb_context *ctx); +void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); +const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode); +const struct libusb_version * LIBUSB_CALL libusb_getversion(void); + +void LIBUSB_CALL libusb_register_hotplug_listeners(libusb_context *ctx, + libusb_hotplug_cb_fn connected_cb, + libusb_hotplug_cb_fn disconnected_cb, void *user_data); +void LIBUSB_CALL libusb_unregister_hotplug_listeners(libusb_context *ctx); +int LIBUSB_CALL libusb_get_status(libusb_device *dev); + + ***/ + +#endif/*__LIBUSBHP_H__*/ -- cgit v1.2.3