adb: add libusb implementation for Linux/Darwin.
Add a libusb-based implementation alongside the existing native
implementations, controlled by the ADB_LIBUSB environment variable.
Windows will need more work for the usb driver.
Bug: http://b/31321337
Test: python test_device.py on linux/darwin, with ADB_LIBUSB=0 and 1
Change-Id: Ib68fb2c6c05475eae3ff4cc19f55802a6f489bb7
diff --git a/adb/client/main.cpp b/adb/client/main.cpp
index d583516..97a54fd 100644
--- a/adb/client/main.cpp
+++ b/adb/client/main.cpp
@@ -28,6 +28,7 @@
#include <android-base/errors.h>
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/quick_exit.h>
#include <android-base/stringprintf.h>
#include "adb.h"
@@ -86,7 +87,7 @@
static BOOL WINAPI ctrlc_handler(DWORD type) {
// TODO: Consider trying to kill a starting up adb server (if we're in
// launch_server) by calling GenerateConsoleCtrlEvent().
- exit(STATUS_CONTROL_C_EXIT);
+ android::base::quick_exit(STATUS_CONTROL_C_EXIT);
return TRUE;
}
#endif
@@ -108,6 +109,10 @@
}
SetConsoleCtrlHandler(ctrlc_handler, TRUE);
+#else
+ signal(SIGINT, [](int) {
+ android::base::quick_exit(0);
+ });
#endif
init_transport_registration();