Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement with patch: Exposing usb overlapped event #10

Open
mcuee opened this issue Jun 23, 2018 · 1 comment
Open

Enhancement with patch: Exposing usb overlapped event #10

mcuee opened this issue Jun 23, 2018 · 1 comment

Comments

@mcuee
Copy link
Owner

mcuee commented Jun 23, 2018

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 mcuee changed the title Feature request: Exposing usb overlapped event Enhancement with patch: Exposing usb overlapped event Jun 23, 2018
@mcuee mcuee added the wontfix label Jun 23, 2018
@mcuee
Copy link
Owner Author

mcuee commented Jun 23, 2018

libusb-win32 project is in a support only mode. Mailing list support is still provided, no changes to the codes and release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant