diff options
author | Pete Batard <pbatard@gmail.com> | 2010-01-20 20:29:45 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-01-20 20:29:45 +0000 |
commit | 5590301e7fb72350ca26fffa01174b96b02e8da6 (patch) | |
tree | 170c1723e06c3d6e3e7ddfedb6bc98b49bd538b8 /libusb/os/windows_compat.c | |
parent | 8242029421bb27e7568ca9be29982b902d62d681 (diff) | |
download | libusb-5590301e7fb72350ca26fffa01174b96b02e8da6.tar.gz |
r93: HID part 2 (WIP)
- added composite HID device support in xusb.c
- fixed signed/unsigned bug in windows_compat.c (Orin Eman)
- added support for synchronous completion of async requests
- composite HID device support (ClassGUID fallback for driver unavail., read interface number from MI_##, extra path for HID)
- generic interface_by_endpoint and get_valid_interface
- added HID struct in priv
- HID submit_control_transfer
Diffstat (limited to 'libusb/os/windows_compat.c')
-rw-r--r-- | libusb/os/windows_compat.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libusb/os/windows_compat.c b/libusb/os/windows_compat.c index 503ff90..98ff0e5 100644 --- a/libusb/os/windows_compat.c +++ b/libusb/os/windows_compat.c @@ -119,7 +119,7 @@ static inline int _open_osfhandle(intptr_t osfhandle, int flags) #define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0) // public fd data -const struct winfd INVALID_WINFD = {-1, NULL, NULL, RW_NONE}; +const struct winfd INVALID_WINFD = {-1, NULL, NULL, RW_NONE, FALSE}; struct winfd poll_fd[MAX_FDS]; // internal fd data struct { @@ -321,6 +321,7 @@ int pipe_for_poll(int filedes[2]) poll_fd[i].handle = handle[j]; poll_fd[i].overlapped = (j==0)?overlapped0:overlapped1; poll_fd[i].rw = RW_READ+j; + poll_fd[i].completed_synchronously = FALSE; j++; if (j==1) { // Start a 1 byte nonblocking read operation @@ -518,7 +519,8 @@ struct winfd overlapped_to_winfd(OVERLAPPED* overlapped) */ int poll(struct pollfd *fds, unsigned int nfds, int timeout) { - unsigned int i, index, triggered = 0; + unsigned i, triggered = 0; + int index; HANDLE *handles_to_wait_on = malloc(nfds*sizeof(HANDLE)); int *handle_to_index = malloc(nfds*sizeof(int)); DWORD nb_handles_to_wait_on = 0; @@ -574,7 +576,8 @@ int poll(struct pollfd *fds, unsigned int nfds, int timeout) printb("poll: fd[%d]=%d (overlapped = %p) got events %04X\n", i, poll_fd[index].fd, poll_fd[index].overlapped, fds[i].events); // The following macro only works if overlapped I/O was reported pending - if (HasOverlappedIoCompleted(poll_fd[index].overlapped)) { + if ( (HasOverlappedIoCompleted(poll_fd[index].overlapped)) + || (poll_fd[index].completed_synchronously) ) { printb(" completed\n"); // checks above should ensure this works: fds[i].revents = fds[i].events; @@ -594,7 +597,7 @@ int poll(struct pollfd *fds, unsigned int nfds, int timeout) if (nb_handles_to_wait_on != 0) { printb("poll: starting %d ms wait for %d handles...\n", timeout, (int)nb_handles_to_wait_on); ret = WaitForMultipleObjects(nb_handles_to_wait_on, handles_to_wait_on, - FALSE, (timeout==-1)?INFINITE:timeout); + FALSE, (timeout==-1)?INFINITE:(DWORD)timeout); if (((ret-WAIT_OBJECT_0) >= 0) && ((ret-WAIT_OBJECT_0) < nb_handles_to_wait_on)) { printb(" completed after wait\n"); |