From 5ce5e8afec932ebeebc9a3e78f26717efaa273c6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 20 Aug 2015 14:45:16 +1000 Subject: [PATCH] hidraw: add a workaround for the logitech receivers The vid/pid combo for the hidraw device is that of the receiver, not that of the device (which we get from the event node). Signed-off-by: Peter Hutterer --- src/libratbag-hidraw.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/libratbag-hidraw.c b/src/libratbag-hidraw.c index e812be6b..a7b399c9 100644 --- a/src/libratbag-hidraw.c +++ b/src/libratbag-hidraw.c @@ -57,11 +57,21 @@ ratbag_open_hidraw(struct ratbag_device *ratbag) "error while getting info from device"); goto err; } + /* Check if the device actually matches the input node */ if (info.bustype != ratbag->ids.bustype || - info.vendor != ratbag->ids.vendor || - info.product != ratbag->ids.product) { - errno = EINVAL; + info.vendor != ratbag->ids.vendor) { + errno -EINVAL; + goto err; + } + + /* On the Logitech receiver, the hid device has the pid of the + * receiver, not of the actual device */ + if (info.product != ratbag->ids.product && + (info.vendor == USB_VENDOR_ID_LOGITECH && + info.product != (int16_t)USB_DEVICE_ID_UNIFYING_RECEIVER && + info.product != (int16_t)USB_DEVICE_ID_UNIFYING_RECEIVER2)) { + errno = -EINVAL; goto err; }