File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1919LOG_CHANNEL (hid_log, " HID" );
2020
2121#ifdef ANDROID
22- std::vector<int > g_android_usb_devices;
22+ std::vector<android_usb_device > g_android_usb_devices;
2323std::mutex g_android_usb_devices_mutex;
2424#endif
2525
@@ -192,7 +192,15 @@ void hid_pad_handler<Device>::enumerate_devices()
192192 std::lock_guard lock (g_android_usb_devices_mutex);
193193 for (auto device : g_android_usb_devices)
194194 {
195- device_paths.insert (device);
195+ auto filter = [&](id_pair id)
196+ {
197+ return id.m_vid == device.vendorId && id.m_pid == device.productId ;
198+ };
199+
200+ if (std::find_if (m_ids.begin (), m_ids.end (), filter) != m_ids.end ())
201+ {
202+ device_paths.insert (device.fd );
203+ }
196204 }
197205 }
198206#else
Original file line number Diff line number Diff line change 1515#ifdef ANDROID
1616using hid_enumerated_device_type = int ;
1717using hid_enumerated_device_view = int ;
18+
19+ struct android_usb_device
20+ {
21+ int fd;
22+ u16 vendorId;
23+ u16 productId;
24+ };
25+
1826inline constexpr auto hid_enumerated_device_default = -1 ;
19- extern std::vector<int > g_android_usb_devices;
27+ extern std::vector<android_usb_device > g_android_usb_devices;
2028extern std::mutex g_android_usb_devices_mutex;
2129#else
2230using hid_enumerated_device_type = std::string;
You can’t perform that action at this time.
0 commit comments