This patch changes libusb_handle_events to
libusb_handle_events_timeout_completed, which is non-blocking and does
not cause applications to hang.
Change-Id: Ieebfcab3ae827b158345e09c41d6c136a7ed0e18
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
static gboolean usb_host_poll_cb(GIOChannel *source, GIOCondition condition, gpointer data)
{
usb_host_context_h ctx = data;
+ int ret;
+ struct timeval tv = {0, 0};
_I("usb_host_poll_cb");
- if (libusb_handle_events(ctx->lusb_ctx) == 0)
- return TRUE;
+ ret = libusb_handle_events_timeout_completed(ctx->lusb_ctx, &tv, NULL);
+ if (ret < 0) {
+ _E("Could not handle events");
+ return FALSE;
+ }
- return FALSE;
+ return TRUE;
}
static int add_fd_watch(int fd, short events, void *user_data)