From d349fae010f6c780d76e89c5d6b81d45119137c0 Mon Sep 17 00:00:00 2001 From: Arnav Singh Date: Sat, 3 Aug 2024 21:55:23 -0700 Subject: [PATCH] Fix libusb enumeration to handle PINE64 PinePhone modem. The PINE64 PinePhone modem exposes itself as an adb-accessible device over USB but its device class is LIBUSB_CLASS_MISCELLANEOUS, so allow that too. --- vendor/adb/client/usb_libusb.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/adb/client/usb_libusb.cpp b/vendor/adb/client/usb_libusb.cpp index 6133e7c8..9af91eb7 100644 --- a/vendor/adb/client/usb_libusb.cpp +++ b/vendor/adb/client/usb_libusb.cpp @@ -364,8 +364,8 @@ struct LibusbConnection : public Connection { } bool FindInterface(libusb_device_descriptor* device_desc) { - if (device_desc->bDeviceClass != LIBUSB_CLASS_PER_INTERFACE) { - // Assume that all Android devices have the device class set to per interface. + if (device_desc->bDeviceClass != LIBUSB_CLASS_PER_INTERFACE && device_desc->bDeviceClass != LIBUSB_CLASS_MISCELLANEOUS) { + // Assume that all Android devices have the device class set to per interface or miscellaneous. // TODO: Is this assumption valid? VLOG(USB) << "skipping device with incorrect class at " << device_address_; return false; @@ -1039,7 +1039,7 @@ void usb_init() { static_cast(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), LIBUSB_HOTPLUG_ENUMERATE, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY, - LIBUSB_CLASS_PER_INTERFACE, hotplug_callback, nullptr, nullptr); + LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, nullptr, nullptr); if (rc != LIBUSB_SUCCESS) { LOG(FATAL) << "failed to register libusb hotplug callback"; -- 2.46.0