Enhancement with patch: Exposing usb overlapped event
mcuee opened this issue · 1 comments
mcuee commented
https://sourceforge.net/p/libusb-win32/patches/12/
Updated: 2014-08-20 Created: 2011-03-14 Creator: Piotr Foltyn
Exposing usb overlapped event to the upper code layers.
Index: libusb/src/usb.h
===================================================================
--- libusb/src/usb.h (revision 381)
+++ libusb/src/usb.h (working copy)
@@ -401,6 +401,7 @@
int usb_interrupt_setup_async(usb_dev_handle *dev, void **context,
unsigned char ep);
+ int usb_get_overlapped_event_handle(void *context, void **eventHandle);
int usb_submit_async(void *context, char *bytes, int size);
int usb_reap_async(void *context, int timeout);
int usb_reap_async_nocancel(void *context, int timeout);
Index: libusb/src/windows.c
===================================================================
--- libusb/src/windows.c (revision 381)
+++ libusb/src/windows.c (working copy)
@@ -417,6 +417,26 @@
return 0;
}
+int usb_get_overlapped_event_handle(void *context, void **eventHandle)
+{
+ usb_context_t *pUsbContext = (usb_context_t *)context;
+ HANDLE *pEventHandle = (HANDLE *)eventHandle;
+
+ if (NULL == pUsbContext) {
+ usb_error("usb_get_overlapped_event_handle: invalid context");
+ return -EINVAL;
+ }
+
+ if (NULL == pEventHandle) {
+ usb_error("usb_get_overlapped_event_handle: invalid event handle");
+ return -EINVAL;
+ }
+
+ *pEventHandle = &pUsbContext->ol.hEvent;
+
+ return 0;
+}
+
int usb_submit_async(void *context, char *bytes, int size)
{
usb_context_t *c = (usb_context_t *)context;
mcuee commented
libusb-win32 project is in a support only mode. Mailing list support is still provided, no changes to the codes and release.