Skip to content

Commit

Permalink
Merge remote-tracking branch 'signal11/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marije Baalman committed Sep 12, 2013
2 parents ca24d2d + a88c724 commit db6cbcf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
config.h.in
config.sub
config.*
configure
depcomp
install-sh
Expand All @@ -18,8 +16,5 @@ testgui/Makefile.in
windows/Makefile.in

Makefile
config.h
config.log
config.status
stamp-h1
libtool
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Prerequisites:

If you downloaded the source directly from the git repository (using
git clone), you'll need Autotools:
sudo apt-get install autotools-dev
sudo apt-get install autotools-dev autoconf automake libtool

FreeBSD:
---------
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ case $host in

# HIDAPI/libusb libs
AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE+=" -lrt"], [hidapi_lib_error librt])
PKG_CHECK_MODULES([libusb], [libusb-1.0], true, [hidapi_lib_error libusb-1.0])
PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.9], true, [hidapi_lib_error libusb-1.0])
LIBS_LIBUSB_PRIVATE+=" $libusb_LIBS"
CFLAGS_LIBUSB+=" $libusb_CFLAGS"
;;
Expand Down
12 changes: 8 additions & 4 deletions libusb/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ struct hid_device_ {
pthread_cond_t condition;
pthread_barrier_t barrier; /* Ensures correct startup sequence */
int shutdown_thread;
int cancelled;
struct libusb_transfer *transfer;

/* List of received input reports. */
Expand Down Expand Up @@ -690,10 +691,12 @@ static void read_callback(struct libusb_transfer *transfer)
}
else if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
dev->shutdown_thread = 1;
dev->cancelled = 1;
return;
}
else if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
dev->shutdown_thread = 1;
dev->cancelled = 1;
return;
}
else if (transfer->status == LIBUSB_TRANSFER_TIMED_OUT) {
Expand All @@ -708,6 +711,7 @@ static void read_callback(struct libusb_transfer *transfer)
if (res != 0) {
LOG("Unable to submit URB. libusb error code: %d\n", res);
dev->shutdown_thread = 1;
dev->cancelled = 1;
}
}

Expand Down Expand Up @@ -757,10 +761,10 @@ static void *read_thread(void *param)

/* Cancel any transfer that may be pending. This call will fail
if no transfers are pending, but that's OK. */
if (libusb_cancel_transfer(dev->transfer) == 0) {
/* The transfer was cancelled, so wait for its completion. */
libusb_handle_events(usb_context);
}
libusb_cancel_transfer(dev->transfer);

while (!dev->cancelled)
libusb_handle_events_completed(usb_context, &dev->cancelled);

/* Now that the read thread is stopping, Wake any threads which are
waiting on data (in hid_read_timeout()). Do this under a mutex to
Expand Down
1 change: 1 addition & 0 deletions mac/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
process_pending_events();

/* Get a list of the Devices */
IOHIDManagerSetDeviceMatching(hid_mgr, NULL);
CFSetRef device_set = IOHIDManagerCopyDevices(hid_mgr);

/* Convert the list into a C array so we can iterate easily. */
Expand Down

0 comments on commit db6cbcf

Please sign in to comment.