Bug 601853

Summary: X.Org keyboard option AutoRepeat is ignored
Product: [Fedora] Fedora Reporter: oli kron <kron24>
Component: xorg-x11-drv-evdevAssignee: Peter Hutterer <peter.hutterer>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 13CC: lxiang, mcepl, mpartap, xgl-maint
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-18 04:47:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
my xorg.conf
/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf - autogenerated keyboard setup
/etc/X11/xorg.conf.d/01-vk-keyboard.conf - my keyboard setup
my ~/.xinitrc
dmesg none

Description oli kron 2010-06-08 18:46:53 UTC
Description of problem:
I created /etc/X11/xorg.conf.d/01-vk-keyboard.conf:
Section "InputClass"
        Identifier      "vk-keyboard"
        MatchIsKeyboard "on"
        Option          "XkbModel"      "pc105+inet"
        Option          "XkbLayout"     "us,cz"
        Option          "AutoRepeat"    "300 40"
        Option          "XkbOptions"    "grp:switch,grp:alt_shift_toggle,terminate:ctrl_alt_bksp,"

It works fine except AutoRepeat. It is completely ignored,
there is no mention in Xorg.0.log:
[  4619.707] (II) XINPUT: Adding extended input device "DELL DELL USB Keyboard" (type: KEYBOARD)
[  4619.707] (**) Option "xkb_rules" "evdev"
[  4619.707] (**) Option "xkb_model" "pc105+inet"
[  4619.707] (**) Option "xkb_layout" "us,cz"
[  4619.707] (**) Option "xkb_options" "grp:switch,grp:alt_shift_toggle,terminate:ctrl_alt_bksp,"

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create a config like above
2. Start X with some simple window manager (which doesn't set its autorepeat) - fluxbox in my case
3. Re-attach a keyboard, follow /var/log/Xorg.0.log, read/test the actual autorepeat state (xset q)
Actual results:
Autorepeat has default values (660 25).
No info in /var/log/Xorg.0.log.

Expected results:
Autorepeat should have configured values (300 40).
The log should have some info about Option "AutoRepeat".

Additional info:
There is an upstream bug for older (1.6) X.Org which may be related:
The only differences are the version and the configuration format.

I didn't found any acceptable workaround. I played with udev: the problem
is that X.org configuration runs *after* udev tasks. To have whatever
working I created and registered a dirty udev script for adding a keyboard:
if [ "$ACTION" = "add" ] ; then
        export ACTION=setmyautorepeat
        nohup $0 >/dev/null 2>&1 &
if [ "$ACTION" = "setmyautorepeat" ] ; then
        sleep 2
        xset -display :0.0 r rate 300 40

Comment 1 Matěj Cepl 2010-06-08 21:14:11 UTC
Thanks for the bug report.  We have reviewed the information you have provided above, and there is some additional information we require that will be helpful in our diagnosis of this issue.

Please attach

* your X server config file (/etc/X11/xorg.conf, including those additional files in /etc/X11/xorg.conf.d ... if you have anything else than what's mentioned in the comment 0),
* X server log file (/var/log/Xorg.*.log)
* output of the dmesg command, and
* system log (/var/log/messages)

to the bug report as individual uncompressed file attachments using the bugzilla file attachment link above.

We will review this issue again once you've had a chance to attach this information.

Thanks in advance.

Comment 2 oli kron 2010-06-09 04:43:04 UTC
Created attachment 422429 [details]
my xorg.conf

Comment 3 oli kron 2010-06-09 04:45:14 UTC
Created attachment 422430 [details]
/etc/X11/xorg.conf.d/00-system-setup-keyboard.conf - autogenerated keyboard setup

Comment 4 oli kron 2010-06-09 04:46:59 UTC
Created attachment 422431 [details]
/etc/X11/xorg.conf.d/01-vk-keyboard.conf - my keyboard setup

Comment 5 oli kron 2010-06-09 04:47:45 UTC
Created attachment 422432 [details]
my ~/.xinitrc

Comment 6 oli kron 2010-06-09 04:51:42 UTC
Created attachment 422434 [details]

You can see at the end of the file how an external USB keyboard is being attached. No AutoRepeat mentioned.

Comment 7 oli kron 2010-06-09 04:52:43 UTC
Created attachment 422435 [details]

Comment 8 oli kron 2010-06-09 04:53:12 UTC
Created attachment 422436 [details]

Comment 9 oli kron 2010-06-09 05:17:48 UTC
Hi Matej,

thanks for taking this.

I attached files you requested but I'm not sure if they help.
It seems to me like an upstream feature instead of bug. I can't
find the AutoRepeat option in any current man page, maybe it's
no longer supported as "too confusing for new users" :-)


Comment 10 Matěj Cepl 2010-06-09 14:07:46 UTC
I am afraid you are right. yes, kbd(4) says nothing about this option and it seems to me that it is possible that in the new configuration world (https://fedoraproject.org/wiki/Input_device_configuration) this option has not made it.

Passing the bug to the developer for confirmation, but I have my doubts.

Comment 11 oli kron 2010-06-09 15:10:42 UTC
I'm absorbing the idea the option went away...

Anybody following this thread, is there a better way
to pass autorepeat parameters than my horrible udev

Sigh. 20 years of UNIX experience isn't enough to
configure X. :-)


Comment 12 Peter Hutterer 2010-06-18 04:47:49 UTC
AutoRepeat was removed from the keyboard driver with version 1.4.0. All the repeat code is now handled in the server.

besides, only the keyboard driver supported that option, nowadays (unless you tweak the options to avoid hotplugging) we use the evdev driver. Which also relies on autorepeat being set by the session.

sorry, you can't tweak this in the config file.

Comment 13 oli kron 2010-06-18 06:16:12 UTC
Hi Peter and thanks for the info.

I can live with autorepeat having been removed from config
files (although it makes no sense to me). Still there's
xset(*) and I can use it from .xinitrc. But the question is:
How to set autorepeat for hotplug keyboards? I use simple
window managers and I need to configure autorepeat outside
of them, on a "lower" level. Please, can you give me any


(*) I hope xset will not be removed from then next X.org
    release :-)

Comment 14 Peter Hutterer 2010-06-21 04:23:52 UTC
you essentially need to run your xset commands each time you plug in a new keyboard. sorry, that's the right approach now - except that ideally the desktop does that.

xset won't be removed anytime soon, so don't worry about that.

Comment 15 oli kron 2010-06-23 15:38:28 UTC
Thanks for your answer but it didn't address my problem.
I know that I have to run xset. The problem is: what is
"the right" way to run it automatically. As I've mentioned
in the initial message I use a very dirty workaround with
udev script. I'll copy and comment it:

if [ "$ACTION" = "add" ] ; then
        # A keyboard has been plugged. It's useless
        # to run xset here because X.org configuration
        # will run *after* this udev script. Just
        # "register" this script to run again in
        # background with different ACTION and exit.
        export ACTION=setmyautorepeat
        nohup $0 >/dev/null 2>&1 &
if [ "$ACTION" = "setmyautorepeat" ] ; then
        # Now we are in backgroud. Let's wait for some
        # time so X.org can do its own configuration.
        sleep 2
        # Let's hope:
        # - the configuration has finished, and
        # - the display is :0.0
        # It's time for xset, eventually.
        xset -display :0.0 r rate 300 40

Do you see why I consider this a dirty workaround? I believe
there must be a better way to trigger xset.

I hope there was a very good reason to remove AutoRepeat :-)


Comment 16 Peter Hutterer 2010-06-24 22:56:15 UTC
(In reply to comment #15) 
> I hope there was a very good reason to remove AutoRepeat :-)

the driver had its own repeat code which conflicted with the XKB code. so you end up with different repeat settings, sometimes even for different keys. Once we made XKB mandatory, having _one_ location only that handles key repeats seemed like the right thing to do.

as for the udev script - there's race condition in there as you've spotted correctly. if you're running xset before the new device is added to the list, settings will overwrite each other. see also

the correct way to handle this is to write a simple daemon that listens for DevicePresenceNotify or XIHierarchyEvents. 

this way you'll only trigger when the device is really present. mind you, it'll probably be better to contact the upstream of your favourite desktop environment and help them with that there.

Comment 17 oli kron 2010-06-25 10:52:46 UTC
Hi Peter,

thank you very much for being patient with me. I accept
the current state as a technical necessity. I'm not going
to fork X.org :-)

I'll try to find some solution with the developers of my
WM. Meanwhile, the udev script has to do its dirty work...

Once again, thanks for your answers and blog spots.


Comment 18 Marcel Partap 2012-06-30 01:15:05 UTC
Hmm. The real source of the problem is that xorg RESETS the current keyboard repeat rate after a keyboard has connected AND THE FIRST KEY HAS BEEN PRESSED! What the? Test case:

1. # xset r rate 190 70
2. # watch -d -n 0.3 'xset q|grep auto'
3. unplug keyboard
4. REplug keyboard
5. PRESS key
6. watch your custom setting being stomped by 
xorg-server/xkb/xkbAccessX.c:46:int XkbDfltRepeatDelay = 660;
xorg-server/xkb/xkbAccessX.c-47-int XkbDfltRepeatInterval = 40;

...there surely must be a better approach than to reset everything in AccessXInit(), lol C;

Comment 19 Peter Hutterer 2012-07-23 04:48:47 UTC
as posted above, please read http://who-t.blogspot.com/2010/06/keyboard-configuration-its-complicated.html, especially the "Pulling out the cards" section.

xset and xmodmap both share the same problem.

Comment 20 Lingzhu Xiang 2013-04-02 06:55:20 UTC
(In reply to comment #15)
> Thanks for your answer but it didn't address my problem.
> I know that I have to run xset. The problem is: what is
> "the right" way to run it automatically. As I've mentioned

FYI I use /usr/bin/X -ardelay 200 -arinterval 30 and it works fine with keyboard hotplugging.