summaryrefslogtreecommitdiff
path: root/libusbhp/libusbhp.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-26 10:14:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-26 10:14:52 +0100
commit257c0d9b563f91d6613a8dd8c6bb4be0a1366036 (patch)
treec50e75a48654dad22bcb25000691f0b976523019 /libusbhp/libusbhp.h
Initial import
Diffstat (limited to 'libusbhp/libusbhp.h')
-rw-r--r--libusbhp/libusbhp.h64
1 files changed, 64 insertions, 0 deletions
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 <Winsock2.h>
+#else
+#define EXPORT
+#include <sys/time.h>
+#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__*/