Am Samstag 06 März 2010 16:44:00 schrieb Hendrik Sattler: > Am Freitag 05 März 2010 19:33:08 schrieb Bastien Nocera: > > It should work, but it doesn't. > > Looking at the source of libusb, this is a bit messed up, there. > In os/linux_usb.c, the only add the FD for POLLOUT (forgetting POLLIN) and > in os/darwin_usb.c, the only add it for POLLIN (forgetting POLLOUT). > Someone should go upstream and fix that! > Current suggestion: the wanted fd is always the last fd in the pollfd list, > ignoring the events field. This will then also work with MacOS X. > And that's also why your POLLOUT fd worked (the other one are all POLLIN) > on Linux.
Try the patch below. It can only work with one connection per process (already working on it). --- diff --git a/lib/usb1obex.c b/lib/usb1obex.c index 1292af6..857a837 100644 --- a/lib/usb1obex.c +++ b/lib/usb1obex.c @@ -357,6 +357,7 @@ static int usbobex_get_fd(void) const struct libusb_pollfd **usbfds; const struct libusb_pollfd *usbfd; int i = 0; + int fd = INVALID_SOCKET; DEBUG(4, "Getting the USB file descriptor"); @@ -367,11 +368,11 @@ static int usbobex_get_fd(void) } while ((usbfd = usbfds[i++]) != NULL) { - if (usbfd->events & POLLIN) - return usbfd->fd; + /* the wanted one is always the last one */ + fd = usbfd->fd } - return INVALID_SOCKET; + return fd; } /* ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Openobex-users mailing list Openobex-users@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/openobex-users