Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: logitech-hidpp: Add HIDPP_QUIRK_RESET_HI_RES_SCROLL

The Logitech G502 Hero Wireless's high resolution scrolling resets after
being unplugged without notifying the driver, causing extremely slow
scrolling.

The only indication of this is a battery update packet, so add a quirk to
detect when the device is unplugged and re-enable the scrolling.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=218037
Signed-off-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Stuart Hayhurst and committed by
Jiri Kosina
ed80cc46 d9b3014a

+21
+21
drivers/hid/hid-logitech-hidpp.c
··· 75 75 #define HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS BIT(27) 76 76 #define HIDPP_QUIRK_HI_RES_SCROLL_1P0 BIT(28) 77 77 #define HIDPP_QUIRK_WIRELESS_STATUS BIT(29) 78 + #define HIDPP_QUIRK_RESET_HI_RES_SCROLL BIT(30) 78 79 79 80 /* These are just aliases for now */ 80 81 #define HIDPP_QUIRK_KBD_SCROLL_WHEEL HIDPP_QUIRK_HIDPP_WHEELS ··· 194 193 void *private_data; 195 194 196 195 struct work_struct work; 196 + struct work_struct reset_hi_res_work; 197 197 struct kfifo delayed_work_fifo; 198 198 struct input_dev *delayed_input; 199 199 ··· 3838 3836 struct hidpp_report *answer = hidpp->send_receive_buf; 3839 3837 struct hidpp_report *report = (struct hidpp_report *)data; 3840 3838 int ret; 3839 + int last_online; 3841 3840 3842 3841 /* 3843 3842 * If the mutex is locked then we have a pending answer from a ··· 3880 3877 "See: https://gitlab.freedesktop.org/jwrdegoede/logitech-27mhz-keyboard-encryption-setup/\n"); 3881 3878 } 3882 3879 3880 + last_online = hidpp->battery.online; 3883 3881 if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_BATTERY) { 3884 3882 ret = hidpp20_battery_event_1000(hidpp, data, size); 3885 3883 if (ret != 0) ··· 3903 3899 ret = hidpp10_battery_event(hidpp, data, size); 3904 3900 if (ret != 0) 3905 3901 return ret; 3902 + } 3903 + 3904 + if (hidpp->quirks & HIDPP_QUIRK_RESET_HI_RES_SCROLL) { 3905 + if (last_online == 0 && hidpp->battery.online == 1) 3906 + schedule_work(&hidpp->reset_hi_res_work); 3906 3907 } 3907 3908 3908 3909 if (hidpp->quirks & HIDPP_QUIRK_HIDPP_WHEELS) { ··· 4283 4274 hidpp->delayed_input = input; 4284 4275 } 4285 4276 4277 + static void hidpp_reset_hi_res_handler(struct work_struct *work) 4278 + { 4279 + struct hidpp_device *hidpp = container_of(work, struct hidpp_device, reset_hi_res_work); 4280 + 4281 + hi_res_scroll_enable(hidpp); 4282 + } 4283 + 4286 4284 static DEVICE_ATTR(builtin_power_supply, 0000, NULL, NULL); 4287 4285 4288 4286 static struct attribute *sysfs_attrs[] = { ··· 4420 4404 } 4421 4405 4422 4406 INIT_WORK(&hidpp->work, hidpp_connect_event); 4407 + INIT_WORK(&hidpp->reset_hi_res_work, hidpp_reset_hi_res_handler); 4423 4408 mutex_init(&hidpp->send_mutex); 4424 4409 init_waitqueue_head(&hidpp->wait); 4425 4410 ··· 4516 4499 4517 4500 hid_hw_stop(hdev); 4518 4501 cancel_work_sync(&hidpp->work); 4502 + cancel_work_sync(&hidpp->reset_hi_res_work); 4519 4503 mutex_destroy(&hidpp->send_mutex); 4520 4504 } 4521 4505 ··· 4564 4546 { /* Keyboard MX5500 (Bluetooth-receiver in HID proxy mode) */ 4565 4547 LDJ_DEVICE(0xb30b), 4566 4548 .driver_data = HIDPP_QUIRK_HIDPP_CONSUMER_VENDOR_KEYS }, 4549 + { /* Logitech G502 Lightspeed Wireless Gaming Mouse */ 4550 + LDJ_DEVICE(0x407f), 4551 + .driver_data = HIDPP_QUIRK_RESET_HI_RES_SCROLL }, 4567 4552 4568 4553 { LDJ_DEVICE(HID_ANY_ID) }, 4569 4554