From c96f096577bb1d90096ae3801afd3cf25cdd51f4 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 24 Oct 2013 21:54:35 +1100 Subject: [PATCH] Add wrappers for usb_read_cancellable and usb_read_timeout_cancellable --- usbutils.c | 2 +- usbutils.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/usbutils.c b/usbutils.c index 232e19f0..19d1854b 100644 --- a/usbutils.c +++ b/usbutils.c @@ -2314,7 +2314,7 @@ static int usb_submit_transfer(struct usb_transfer *ut, struct libusb_transfer * INIT_LIST_HEAD(&ut->ct.list); list_add(&ct_list, &ut->ct.list); } else - ut->cancellable = false;; + ut->cancellable = false; cg_wunlock(&cgusb_fd_lock); return err; diff --git a/usbutils.h b/usbutils.h index 98e37289..2750c098 100644 --- a/usbutils.h +++ b/usbutils.h @@ -394,6 +394,9 @@ void *usb_resource_thread(void *userdata); #define usb_read(cgpu, buf, bufsiz, read, cmd) \ _usb_read(cgpu, DEFAULT_INTINFO, DEFAULT_EP_IN, buf, bufsiz, read, DEVTIMEOUT, NULL, cmd, false, false) +#define usb_read_cancellable(cgpu, buf, bufsiz, read, cmd) \ + _usb_read(cgpu, DEFAULT_INTINFO, DEFAULT_EP_IN, buf, bufsiz, read, DEVTIMEOUT, NULL, cmd, false, true) + #define usb_read_ii(cgpu, intinfo, buf, bufsiz, read, cmd) \ _usb_read(cgpu, intinfo, DEFAULT_EP_IN, buf, bufsiz, read, DEVTIMEOUT, NULL, cmd, false, false) @@ -427,6 +430,9 @@ void *usb_resource_thread(void *userdata); #define usb_read_timeout(cgpu, buf, bufsiz, read, timeout, cmd) \ _usb_read(cgpu, DEFAULT_INTINFO, DEFAULT_EP_IN, buf, bufsiz, read, timeout, NULL, cmd, false, false) +#define usb_read_timeout_cancellable(cgpu, buf, bufsiz, read, timeout, cmd) \ + _usb_read(cgpu, DEFAULT_INTINFO, DEFAULT_EP_IN, buf, bufsiz, read, timeout, NULL, cmd, false, true) + #define usb_read_ii_timeout(cgpu, intinfo, buf, bufsiz, read, timeout, cmd) \ _usb_read(cgpu, intinfo, DEFAULT_EP_IN, buf, bufsiz, read, timeout, NULL, cmd, false, false)