Si vous êtes prêt à compiler votre propre noyau, en modifiant drivers/hid/usbhid/hid-core.c
est une option.
J'ai eu un problème similaire car je veux changer le taux de polling de mon clavier et de ma tablette à dessin. J'ai donc modifié mon hid-core.c depuis un certain temps maintenant.
Il semble que les noyaux les plus récents (4.12 et plus) ont déjà le paramètre usbhid.jspoll mais toujours pas de paramètre pour les claviers.
Avec les noyaux plus anciens que 4.12, j'ai modifié mon hid-core.c comme suit, pour que mousepoll affecte tous les périphériques qu'il manipule :
--- a/linux-4.11-original/drivers/hid/usbhid/hid-core.c
+++ b/linux-4.11/drivers/hid/usbhid/hid-core.c
@@ -1081,9 +1081,14 @@ static int usbhid_start(struct hid_device *hid)
hid->name, endpoint->bInterval, interval);
}
- /* Change the polling interval of mice. */
- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
+ /* Change the polling interval of mice.
+ EDIT 2016-09-03: poll everything with mousepoll
+ */
+ if (/*hid->collection->usage == HID_GD_MOUSE &&*/ hid_mousepoll_interval > 0) {
+ printk(KERN_INFO "%s: Changed interval to mousepoll: %d -> %d\n",
+ hid->name, interval, hid_mousepoll_interval);
interval = hid_mousepoll_interval;
+ }
Et pour les versions 4.12 et plus, je l'ai modifié différemment car je ne voulais pas casser le usbhid.jspoll qui fonctionne :
--- a/linux-4.12.4-original/drivers/hid/usbhid/hid-core.c
+++ b/linux-4.12.4/drivers/hid/usbhid/hid-core.c
@@ -56,6 +56,10 @@ static unsigned int hid_jspoll_interval;
module_param_named(jspoll, hid_jspoll_interval, uint, 0644);
MODULE_PARM_DESC(jspoll, "Polling interval of joysticks");
+static unsigned int hid_elsepoll_interval;
+module_param_named(elsepoll, hid_elsepoll_interval, uint, 0644);
+MODULE_PARM_DESC(elsepoll, "Polling interval of non-mouse non-joysticks");
+
@@ -1083,15 +1087,31 @@ static int usbhid_start(struct hid_device *hid)
}
/* Change the polling interval of mice and joysticks. */
+ /* EDIT 2017-08-03:
+ added elsepoll
+ always print to KERN_INFO when one of mousepoll, jspoll, elsepoll takes effect.
+ */
switch (hid->collection->usage) {
case HID_GD_MOUSE:
- if (hid_mousepoll_interval > 0)
+ if (hid_mousepoll_interval > 0) {
+ printk(KERN_INFO "%s: Changed interval to mousepoll: %d -> %d\n",
+ hid->name, interval, hid_mousepoll_interval);
interval = hid_mousepoll_interval;
+ }
break;
case HID_GD_JOYSTICK:
- if (hid_jspoll_interval > 0)
+ if (hid_jspoll_interval > 0) {
+ printk(KERN_INFO "%s: Changed interval to jspoll: %d -> %d\n",
+ hid->name, interval, hid_jspoll_interval);
interval = hid_jspoll_interval;
+ }
break;
+ default:
+ if (hid_elsepoll_interval > 0) {
+ printk(KERN_INFO "%s: Changed interval to elsepoll: %d -> %d\n",
+ hid->name, interval, hid_elsepoll_interval);
+ interval = hid_elsepoll_interval;
+ }
Maintenant pour obtenir un sondage de 1000Hz (intervalle de 1ms) sur les gamepads et claviers :
-
si intégré ou incertain : ajouter usbhid.mousepoll=1
o usbhid.jspoll=1 usbhid.elsepoll=1
à la ligne de commande du noyau et redémarrez.
-
si module : écrire options usbhid mousepoll=1
o options usbhid jspoll=1 elsepoll=1
a /etc/modprobe.d/usbhid.conf
Si vous voulez juste rmmod usbhid;modprobe usbhid
Après avoir modifié le fichier ci-dessus, vous devez débrancher et rebrancher un périphérique USB pour modifier son intervalle d'interrogation. même si les messages du noyau semblent suggérer le contraire. .
Après avoir redémarré ou rechargé usbhid, pour vérifier son fonctionnement, débranchez et rebranchez les périphériques USB et exécutez dmesg |grep poll
Attendez-vous à quelque chose comme ça sur les dernières lignes :
[476243.420106] daskeyboard: Changed interval to elsepoll: 10 -> 1
[476243.497161] daskeyboard: Changed interval to elsepoll: 10 -> 1
[476251.633110] USB Gamepad : Changed interval to jspoll: 17 -> 1
[476260.726864] Wacom Co.,Ltd. Intuos PS: Changed interval to elsepoll: 2 -> 1
[476260.730403] Wacom Co.,Ltd. Intuos PS: Changed interval to elsepoll: 2 -> 1
Les dispositifs ici sont 04d9:2013
, 0810:0003
y 056a:030e
0 votes
Les claviers USB ont-ils un délai d'interrogation ?