Merge "adb: fix deadlock." am: 68599f5759
am: d5a2cdb72c
Change-Id: I671768311d2c2969bc5797efc43c84175b417ae7
This commit is contained in:
commit
a08c949c7a
1 changed files with 9 additions and 5 deletions
|
|
@ -427,11 +427,15 @@ static void device_disconnected(libusb_device* device) {
|
||||||
|
|
||||||
static int hotplug_callback(libusb_context*, libusb_device* device, libusb_hotplug_event event,
|
static int hotplug_callback(libusb_context*, libusb_device* device, libusb_hotplug_event event,
|
||||||
void*) {
|
void*) {
|
||||||
if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
|
// We're called with the libusb lock taken. Call these on the main thread outside of this
|
||||||
device_connected(device);
|
// function so that the usb_handle mutex is always taken before the libusb mutex.
|
||||||
} else if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) {
|
fdevent_run_on_main_thread([device, event]() {
|
||||||
device_disconnected(device);
|
if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
|
||||||
}
|
device_connected(device);
|
||||||
|
} else if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) {
|
||||||
|
device_disconnected(device);
|
||||||
|
}
|
||||||
|
});
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue