4

How can I get my keyboard repeat rate to apply to a hotplugged USB keyboard?

I made a udev rule to set the keyboard repeat delay and rate, /etc/udev/rules.d/99-usb-keyboard.rules with the following contents:

ACTION=="add", SUBSYSTEM=="usb", RUN+="/home/michael/bin/keyboard_settings.sh"

keyboard_settings.sh:

#!/bin/bash

# Set keyboard repeat delay and rate
xset -display :0.0 r rate 250 40

udev seems to see this, using the command udevadm test /sys/bus/usb/devices/3-2\:1.0/

read rules file: /etc/udev/rules.d/99-usb-keyboard.rules
rules contain 393216 bytes tokens (32768 * 12 bytes), 37438 bytes strings
31709 strings (264322 bytes), 28154 de-duplicated (230440 bytes), 3556 trie nodes used
IMPORT builtin 'hwdb' /lib/udev/rules.d/50-udev-default.rules:11
RUN '/home/myuser/bin/keyboard_settings.sh' /etc/udev/rules.d/99-usb-keyboard.rules:1
unable to create temporary db file '/run/udev/data/+usb:3-2:1.0.tmp': Permission denied
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0
DEVTYPE=usb_interface
DRIVER=usbhid
ID_VENDOR_FROM_DATABASE=Hewlett-Packard
INTERFACE=3/1/1
MODALIAS=usb:v03F0p0325d0102dc00dsc00dp00ic03isc01ip01in00
PRODUCT=3f0/325/102
SUBSYSTEM=usb
TYPE=0/0/0
USEC_INITIALIZED=4145997461
run: '/home/myuser/bin/keyboard_settings.sh'

And yet, this doesn't actually change the repeat rate. The laptop keyboard has the correct settings, but the external USB keyboard does not. Is Xorg overwriting the settings after the udev rule is applied? How can I find out?

I get this in the Xorg.0.log, indicating that X11 is fussing with things, but none of the rules in /usr/share/X11/xorg.conf.d/ do anything to keyboards.

[164570.705] (II) config/udev: Adding input device Lite-On Technology Corp. HP Basic USB Keyboard (/dev/input/event6)
[164570.705] (**) Lite-On Technology Corp. HP Basic USB Keyboard: Applying InputClass "evdev keyboard catchall"
[164570.705] (**) Lite-On Technology Corp. HP Basic USB Keyboard: Applying InputClass "Keyboard Defaults"
[164570.705] (II) Using input driver 'evdev' for 'Lite-On Technology Corp. HP Basic USB Keyboard'
[164570.705] (**) Lite-On Technology Corp. HP Basic USB Keyboard: always reports core events
[164570.705] (**) evdev: Lite-On Technology Corp. HP Basic USB Keyboard: Device: "/dev/input/event6"
[164570.705] (--) evdev: Lite-On Technology Corp. HP Basic USB Keyboard: Vendor 0x3f0 Product 0x325
[164570.705] (--) evdev: Lite-On Technology Corp. HP Basic USB Keyboard: Found keys
[164570.705] (II) evdev: Lite-On Technology Corp. HP Basic USB Keyboard: Configuring as keyboard
[164570.705] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/input/input34/event6"
[164570.705] (II) XINPUT: Adding extended input device "Lite-On Technology Corp. HP Basic USB Keyboard" (type: KEYBOARD, id 11)
[164570.705] (**) Option "xkb_rules" "evdev"
[164570.705] (**) Option "xkb_model" "pc105"
[164570.705] (**) Option "xkb_layout" "us"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.