0069-hid-Reduce-default-mouse-polling-interval-to-60Hz.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 4b8b269bc8793dd4367ed6e858bfdec4e0d2e850 Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Mon, 14 Jul 2014 22:02:09 +0100
  4. Subject: [PATCH] hid: Reduce default mouse polling interval to 60Hz
  5. Reduces overhead when using X
  6. ---
  7. drivers/hid/usbhid/hid-core.c | 10 +++++++---
  8. 1 file changed, 7 insertions(+), 3 deletions(-)
  9. --- a/drivers/hid/usbhid/hid-core.c
  10. +++ b/drivers/hid/usbhid/hid-core.c
  11. @@ -49,7 +49,7 @@
  12. * Module parameters.
  13. */
  14. -static unsigned int hid_mousepoll_interval;
  15. +static unsigned int hid_mousepoll_interval = ~0;
  16. module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
  17. MODULE_PARM_DESC(mousepoll, "Polling interval of mice");
  18. @@ -1093,8 +1093,12 @@ static int usbhid_start(struct hid_devic
  19. }
  20. /* Change the polling interval of mice. */
  21. - if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
  22. - interval = hid_mousepoll_interval;
  23. + if (hid->collection->usage == HID_GD_MOUSE) {
  24. + if (hid_mousepoll_interval == ~0 && interval < 16)
  25. + interval = 16;
  26. + else if (hid_mousepoll_interval != ~0 && hid_mousepoll_interval != 0)
  27. + interval = hid_mousepoll_interval;
  28. + }
  29. ret = -ENOMEM;
  30. if (usb_endpoint_dir_in(endpoint)) {