hid-core: Configurable USB HID Mouse Interrupt Polling Interval
And, here's an updated version of hid-core.c:
---
drivers/usb/input/hid-core.c +14 -1
@@ -37,13 +37,20 @@* Version Information */ -#define DRIVER_VERSION "v2.0" +#define DRIVER_VERSION "v2.01"#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"#define DRIVER_DESC "USB HID core driver"#define DRIVER_LICENSE "GPL"static char *hid_types[] = {"Device" ,"Pointer" ,"Mouse" ,"Device" ,"Joystick" ,"Gamepad" ,"Keyboard" ,"Keypad" ,"Multi-Axis Controller" }; +/* +* Module parameters. +*/ + +static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 ); +MODULE_PARM_DESC (mousepoll,"Polling interval of mice" );/* * Register a new report for a device.
@@ -1695,6 +1702,12 @@if (dev->speed ==USB_SPEED_HIGH ) interval =1 << (interval -1 ); +/* Change the polling interval of mice. */ +if (hid->collection->usage ==HID_GD_MOUSE && hid_mousepoll_interval >0 ) + interval = hid_mousepoll_interval; +else + hid_mousepoll_interval = interval; +if (endpoint->bEndpointAddress &USB_DIR_IN ) {if (hid->urbin)continue ;
Quoted 14 lines · Mikkel Krautz
And, here's an updated version of
hid-core.c:Signed-off-by Mikkel Krautz <[email protected]>---
drivers/usb/input/hid-core.c +1
-1@@ -37,13 +37,20 @@* Version Information */ -#define DRIVER_VERSION "v2.0" +#define DRIVER_VERSION "v2.01"#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"#define DRIVER_DESC "USB HID core driver"
drivers/usb/input/hid-core.c line 52
Quoted 10 lines
drivers/usb/input/hid-core.c +6
-0#define DRIVER_LICENSE "GPL"static char *hid_types[] = {"Device" ,"Pointer" ,"Mouse" ,"Device" ,"Joystick" ,"Gamepad" ,"Keyboard" ,"Keypad" ,"Multi-Axis Controller" }; +/* +* Module parameters. +*/ + +static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 );
Why is it writable by root? IOW, will writing a new value to it change the operational value dynamically?
Also, from the kernel-parameters.txt patch:
+ usbhid.mousepoll=
+ [USBHID] The interval at wich mice are to be polled at.
(a) "which"
(b) drop one of the "at"s... either one.
Quoted 17 lines
drivers/usb/input/hid-core.c +7
-0+MODULE_PARM_DESC (mousepoll,"Polling interval of mice" );/* * Register a new report for a device. @@ -1695,6 +1702,12 @@if (dev->speed ==USB_SPEED_HIGH ) interval =1 << (interval -1 ); +/* Change the polling interval of mice. */ +if (hid->collection->usage ==HID_GD_MOUSE && hid_mousepoll_interval >0 ) + interval = hid_mousepoll_interval; +else + hid_mousepoll_interval = interval; +if (endpoint->bEndpointAddress &USB_DIR_IN ) {if (hid->urbin)continue ;
Signature · 1 line
~Randy
Quoted 7 lines · Randy.Dunlap
Quoted 6 lines · Mikkel Krautz
And, here's an updated version of
hid-core.c:Signed-off-by Mikkel Krautz <[email protected]>---
drivers/usb/input/hid-core.c +0
-0
...
Quoted 11 lines
drivers/usb/input/hid-core.c line 52
Quoted 3 lines
drivers/usb/input/hid-core.c +3
-0+ +static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 );Why is it writable by root? IOW, will writing a new value to it change the operational value dynamically?
Also, from the kernel-parameters.txt patch:
(quoted diff) +2
-0+ usbhid.mousepoll= + [USBHID] The interval at wich mice are to be polled at.
Quoted 2 lines
(a) "which"
(b) drop one of the "at"s... either one.
Is listing module parameters in kernel-parameters.txt the right thing to do? (There are lots of them, not many are listed)
I see some options that might be better:
- Kconfig magic which extracts module_param* and MODULE_PARM_DESC from sources and appends them to help text.
- a userspace script, that goes trough all modules and generates kernel-module-parameters.txt for example.
- modinfo like tool (but i think it would require source or descriptions compiled in kernel)
Domen
Quoted 12 lines · Domen Puncer
Quoted 10 lines · Randy.Dunlap
drivers/usb/input/hid-core.c line 52
Quoted 2 lines
drivers/usb/input/hid-core.c +2
-0+static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 );Why is it writable by root? IOW, will writing a new value to it change the operational value dynamically?
Also, from the kernel-parameters.txt patch:
(quoted diff) +2
-0+ usbhid.mousepoll= + [USBHID] The interval at wich mice are to be polled at.
Quoted 6 lines
Quoted 2 lines
(a) "which"
(b) drop one of the "at"s... either one.Is listing module parameters in kernel-parameters.txt the right thing to do? (There are lots of them, not many are listed)
It's currently the right thing to do, but some automated overhaul sure would make sense.
Quoted 7 lines
I see some options that might be better:
-Kconfigmagic which extracts module_param* andMODULE_PARM_DESCfrom sources and appends them to help text.
- a userspace script, that goes trough all modules and generates kernel-module-parameters.txt for example.
- modinfo like tool (but i think it would require source or descriptions compiled in kernel)
Signature · 1 line
~Randy
A message that is not in the archive (sent off-list or not yet received): [email protected]
Are you talking about the following line?
+ else
+ hid_mousepoll_interval = interval;
If so, I put it there, to fill a tiny gap, i felt was missing.
If no parameter is passed, hid_mousepoll_interval is obviously 0.
If a user, who doesn't pass the parameter to usbhid, reads '/sys/module/usbhid/parameters/mousepoll', the answer would be "0", which is incorrect, no?
Thanks,
Mikkel
Quoted 52 lines · Vojtech Pavlik
Quoted 29 lines · Mikkel Krautz
And, here's an updated version of
hid-core.c:Signed-off-by Mikkel Krautz <[email protected]>---
drivers/usb/input/hid-core.c +8
-1@@ -37,13 +37,20 @@* Version Information */ -#define DRIVER_VERSION "v2.0" +#define DRIVER_VERSION "v2.01"#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"#define DRIVER_DESC "USB HID core driver"#define DRIVER_LICENSE "GPL"static char *hid_types[] = {"Device" ,"Pointer" ,"Mouse" ,"Device" ,"Joystick" ,"Gamepad" ,"Keyboard" ,"Keypad" ,"Multi-Axis Controller" }; +/* +* Module parameters. +*/ + +static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 ); +MODULE_PARM_DESC (mousepoll,"Polling interval of mice" );/* * Register a new report for a device. drivers/usb/input/hid-core.c line 1709
Quoted 8 lines
drivers/usb/input/hid-core.c +5
-0@@ -1695,6 +1702,12 @@if (dev->speed ==USB_SPEED_HIGH ) interval =1 << (interval -1 ); +/* Change the polling interval of mice. */ +if (hid->collection->usage ==HID_GD_MOUSE && hid_mousepoll_interval >0 ) + interval = hid_mousepoll_interval; +else + hid_mousepoll_interval = interval;This line is trying to achieve what?
drivers/usb/input/hid-core.c line 1713
Quoted 6 lines
drivers/usb/input/hid-core.c +1
-0+if (endpoint->bEndpointAddress &USB_DIR_IN ) {if (hid->urbin)continue ;--
Vojtech Pavlik
SuSE Labs, SuSE CR
Sorry, I now realise that my way of doing this only sets hid_mousepoll_interval to the latest-plugged-in mouse's polling interval.
How should I handle this? Just remove the line, and keep the "0 feature"?
Thanks,
Mikkel
Quoted 70 lines · Mikkel Krautz
Are you talking about the following line?
drivers/usb/input/hid-core.c +2
-0+else + hid_mousepoll_interval = interval;If so, I put it there, to fill a tiny gap, i felt was missing.
If no parameter is passed,
hid_mousepoll_intervalis obviously 0.If a user, who doesn't pass the parameter to usbhid, reads '
/sys/module/usbhid/parameters/mousepoll', the answer would be "0", which is incorrect, no?Thanks,
MikkelQuoted 52 lines · Vojtech Pavlik
Quoted 29 lines · Mikkel Krautz
And, here's an updated version of
hid-core.c:Signed-off-by Mikkel Krautz <[email protected]>---
drivers/usb/input/hid-core.c +8
-1@@ -37,13 +37,20 @@* Version Information */ -#define DRIVER_VERSION "v2.0" +#define DRIVER_VERSION "v2.01"#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"#define DRIVER_DESC "USB HID core driver"#define DRIVER_LICENSE "GPL"static char *hid_types[] = {"Device" ,"Pointer" ,"Mouse" ,"Device" ,"Joystick" ,"Gamepad" ,"Keyboard" ,"Keypad" ,"Multi-Axis Controller" }; +/* +* Module parameters. +*/ + +static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 ); +MODULE_PARM_DESC (mousepoll,"Polling interval of mice" );/* * Register a new report for a device. drivers/usb/input/hid-core.c line 1709
Quoted 8 lines
drivers/usb/input/hid-core.c +5
-0@@ -1695,6 +1702,12 @@if (dev->speed ==USB_SPEED_HIGH ) interval =1 << (interval -1 ); +/* Change the polling interval of mice. */ +if (hid->collection->usage ==HID_GD_MOUSE && hid_mousepoll_interval >0 ) + interval = hid_mousepoll_interval; +else + hid_mousepoll_interval = interval;This line is trying to achieve what?
drivers/usb/input/hid-core.c line 1713
Quoted 6 lines
drivers/usb/input/hid-core.c +1
-0+if (endpoint->bEndpointAddress &USB_DIR_IN ) {if (hid->urbin)continue ;--
Vojtech Pavlik
SuSE Labs, SuSE CR
A message that is not in the archive (sent off-list or not yet received): [email protected]
Alright, I'll send it in a bit!
Thanks,
Mikkel
Quoted 91 lines · Vojtech Pavlik
Quoted 5 lines · Mikkel Krautz
Sorry, I now realise that my way of doing this only sets
hid_mousepoll_intervalto the latest-plugged-in mouse's polling interval.How should I handle this? Just remove the line, and keep the "0 feature"?
Yes. And please merge both the patches (documentation and code) into one.
Quoted 77 lines
Thanks,
MikkelQuoted 70 lines · Mikkel Krautz
Are you talking about the following line?
drivers/usb/input/hid-core.c +2
-0+else + hid_mousepoll_interval = interval;If so, I put it there, to fill a tiny gap, i felt was missing.
If no parameter is passed,
hid_mousepoll_intervalis obviously 0.If a user, who doesn't pass the parameter to usbhid, reads '
/sys/module/usbhid/parameters/mousepoll', the answer would be "0", which is incorrect, no?Thanks,
MikkelQuoted 52 lines · Vojtech Pavlik
Quoted 29 lines · Mikkel Krautz
And, here's an updated version of
hid-core.c:Signed-off-by Mikkel Krautz <[email protected]>---
drivers/usb/input/hid-core.c +8
-1@@ -37,13 +37,20 @@* Version Information */ -#define DRIVER_VERSION "v2.0" +#define DRIVER_VERSION "v2.01"#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik"#define DRIVER_DESC "USB HID core driver"#define DRIVER_LICENSE "GPL"static char *hid_types[] = {"Device" ,"Pointer" ,"Mouse" ,"Device" ,"Joystick" ,"Gamepad" ,"Keyboard" ,"Keypad" ,"Multi-Axis Controller" }; +/* +* Module parameters. +*/ + +static unsigned int hid_mousepoll_interval; +module_param_named (mousepoll, hid_mousepoll_interval, uint,0644 ); +MODULE_PARM_DESC (mousepoll,"Polling interval of mice" );/* * Register a new report for a device. drivers/usb/input/hid-core.c line 1709
Quoted 8 lines
drivers/usb/input/hid-core.c +5
-0@@ -1695,6 +1702,12 @@if (dev->speed ==USB_SPEED_HIGH ) interval =1 << (interval -1 ); +/* Change the polling interval of mice. */ +if (hid->collection->usage ==HID_GD_MOUSE && hid_mousepoll_interval >0 ) + interval = hid_mousepoll_interval; +else + hid_mousepoll_interval = interval;This line is trying to achieve what?
drivers/usb/input/hid-core.c line 1713
Quoted 6 lines
drivers/usb/input/hid-core.c +1
-0+if (endpoint->bEndpointAddress &USB_DIR_IN ) {if (hid->urbin)continue ;--
Vojtech Pavlik
SuSE Labs, SuSE CR--
Vojtech Pavlik
SuSE Labs, SuSE CR