Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f8dc5c7 authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "adb: fix deadlock." am: 68599f57 am: d5a2cdb7 am: a08c949c

am: 86d63c89

Change-Id: I7c45e6fcf3327d97ff15adbaa47df7ad08d4d0b2
parents 76080e71 86d63c89
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -427,11 +427,15 @@ static void device_disconnected(libusb_device* device) {

static int hotplug_callback(libusb_context*, libusb_device* device, libusb_hotplug_event event,
                            void*) {
    // We're called with the libusb lock taken. Call these on the main thread outside of this
    // function so that the usb_handle mutex is always taken before the libusb mutex.
    fdevent_run_on_main_thread([device, event]() {
        if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED) {
            device_connected(device);
        } else if (event == LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT) {
            device_disconnected(device);
        }
    });
    return 0;
}