summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorikarienator@chromium.org <ikarienator@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 08:54:26 +0000
committerikarienator@chromium.org <ikarienator@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 08:54:26 +0000
commitdbb6667c6c63b478e6c1c9b97bcece8843a490f9 (patch)
treea06b29d2e7fb18ad35d3e9d182ff1acc08bb5de9 /third_party
parent31c58b67ba484feb6647d4c8dad809bc2f5b374b (diff)
downloadchromium_src-dbb6667c6c63b478e6c1c9b97bcece8843a490f9.zip
chromium_src-dbb6667c6c63b478e6c1c9b97bcece8843a490f9.tar.gz
chromium_src-dbb6667c6c63b478e6c1c9b97bcece8843a490f9.tar.bz2
Usb backend refactor step 1: Introduce libusb_interrupt_handle_event API.
Currently the USB event handling thread is not safely exiting during shutdown due to the blocking and uninterruptable libusb_handle_event API. This issue is to introducing a way to safely interrupt it. BUG=223817 Review URL: https://chromiumcodereview.appspot.com/18648010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/libusb/README.chromium2
-rw-r--r--third_party/libusb/libusb.gyp2
-rw-r--r--third_party/libusb/src/libusb/interrupt.c11
-rw-r--r--third_party/libusb/src/libusb/interrupt.h20
4 files changed, 35 insertions, 0 deletions
diff --git a/third_party/libusb/README.chromium b/third_party/libusb/README.chromium
index 8354b8d..61f6e40 100644
--- a/third_party/libusb/README.chromium
+++ b/third_party/libusb/README.chromium
@@ -11,4 +11,6 @@ Windows, and Linux systems.
Local Modifications:
- config.h (empty) has been created to satisfy includes within the tree.
+- Exposing an API (libusb_interrupt_handle_event) to explicitly interrupt
+ libusb_handle_event.
- windows-build.patch has been applied.
diff --git a/third_party/libusb/libusb.gyp b/third_party/libusb/libusb.gyp
index 17fc433..46e9e6f 100644
--- a/third_party/libusb/libusb.gyp
+++ b/third_party/libusb/libusb.gyp
@@ -16,6 +16,8 @@
'src/libusb/io.c',
'src/libusb/sync.c',
'src/libusb/version.h',
+ 'src/libusb/interrupt.c',
+ 'src/libusb/interrupt.h',
],
'include_dirs': [
'src',
diff --git a/third_party/libusb/src/libusb/interrupt.c b/third_party/libusb/src/libusb/interrupt.c
new file mode 100644
index 0000000..addec78
--- /dev/null
+++ b/third_party/libusb/src/libusb/interrupt.c
@@ -0,0 +1,11 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "libusbi.h"
+
+int API_EXPORTED libusb_interrupt_handle_event(struct libusb_context* ctx) {
+ unsigned char dummy = 1;
+ USBI_GET_CONTEXT(ctx);
+ return usbi_write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy));
+}
diff --git a/third_party/libusb/src/libusb/interrupt.h b/third_party/libusb/src/libusb/interrupt.h
new file mode 100644
index 0000000..73fd275
--- /dev/null
+++ b/third_party/libusb/src/libusb/interrupt.h
@@ -0,0 +1,20 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_LIBUSB_SRC_LIBUSB_INTERRUPT_H
+#define THIRD_PARTY_LIBUSB_SRC_LIBUSB_INTERRUPT_H
+
+#include "libusb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int LIBUSB_CALL libusb_interrupt_handle_event(struct libusb_context* ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // THIRD_PARTY_LIBUSB_SRC_LIBUSB_INTERRUPT_H