You are not logged in.

#1 2009-10-06 12:25:13

Mogger
Member
From: Sweden
Registered: 2008-12-07
Posts: 153
Website

USB keyboard and hotplugging, xmodmap settings are reset

My problem is well described by this bug report. I use a USB keyboard with a custom layout, and use xmodmap to remap some keys, for example Page Up/Down. However, this settings is reset from time to time - very annoying.

The problem seems to that evdev is reloaded for unknown reason. A part of my Xorg.0.log can look like this:

(II) config/hal: removing device TypeMatrix.com USB Keyboard
(II) TypeMatrix.com USB Keyboard: Close
(II) UnloadModule: "evdev"
(II) config/hal: removing device TypeMatrix.com USB Keyboard
(II) TypeMatrix.com USB Keyboard: Close
(II) UnloadModule: "evdev"
(II) config/hal: Adding input device TypeMatrix.com USB Keyboard
(**) TypeMatrix.com USB Keyboard: always reports core events
(**) TypeMatrix.com USB Keyboard: Device: "/dev/input/event7"
(EE) Unable to open evdev device "/dev/input/event7".
(II) UnloadModule: "evdev"
(EE) PreInit returned NULL for "TypeMatrix.com USB Keyboard"
(EE) config/hal: NewInputDeviceRequest failed (8)
(II) config/hal: Adding input device TypeMatrix.com USB Keyboard
(**) TypeMatrix.com USB Keyboard: always reports core events
(**) TypeMatrix.com USB Keyboard: Device: "/dev/input/event7"
(II) TypeMatrix.com USB Keyboard: Found 1 mouse buttons
(II) TypeMatrix.com USB Keyboard: Found scroll wheel(s)
(II) TypeMatrix.com USB Keyboard: Found keys
(II) TypeMatrix.com USB Keyboard: Configuring as keyboard
(II) TypeMatrix.com USB Keyboard: Adding scrollwheel support
(**) TypeMatrix.com USB Keyboard: YAxisMapping: buttons 4 and 5
(**) TypeMatrix.com USB Keyboard: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
(II) XINPUT: Adding extended input device "TypeMatrix.com USB Keyboard" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) Option "xkb_model" "evdev"
(**) Option "xkb_layout" "se"
(**) Option "xkb_variant" "chvorak"
(EE) TypeMatrix.com USB Keyboard: failed to initialize for relative axes.
(II) config/hal: Adding input device TypeMatrix.com USB Keyboard
(**) TypeMatrix.com USB Keyboard: always reports core events
(**) TypeMatrix.com USB Keyboard: Device: "/dev/input/event6"
(II) TypeMatrix.com USB Keyboard: Found keys
(II) TypeMatrix.com USB Keyboard: Configuring as keyboard
(II) XINPUT: Adding extended input device "TypeMatrix.com USB Keyboard" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) Option "xkb_model" "evdev"
(**) Option "xkb_layout" "se"
(**) Option "xkb_variant" "chvorak"
(II) config/hal: removing device TypeMatrix.com USB Keyboard
(II) TypeMatrix.com USB Keyboard: Close
(II) UnloadModule: "evdev"
(II) config/hal: removing device TypeMatrix.com USB Keyboard
(II) TypeMatrix.com USB Keyboard: Close
(II) UnloadModule: "evdev"
(II) config/hal: Adding input device TypeMatrix.com USB Keyboard
(**) TypeMatrix.com USB Keyboard: always reports core events
(**) TypeMatrix.com USB Keyboard: Device: "/dev/input/event7"
(II) TypeMatrix.com USB Keyboard: Found 1 mouse buttons
(II) TypeMatrix.com USB Keyboard: Found scroll wheel(s)
(II) TypeMatrix.com USB Keyboard: Found keys
(II) TypeMatrix.com USB Keyboard: Configuring as keyboard
(II) TypeMatrix.com USB Keyboard: Adding scrollwheel support
(**) TypeMatrix.com USB Keyboard: YAxisMapping: buttons 4 and 5
(**) TypeMatrix.com USB Keyboard: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
(II) XINPUT: Adding extended input device "TypeMatrix.com USB Keyboard" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) Option "xkb_model" "evdev"
(**) Option "xkb_layout" "se"
(**) Option "xkb_variant" "chvorak"
(EE) TypeMatrix.com USB Keyboard: failed to initialize for relative axes.
(II) config/hal: Adding input device TypeMatrix.com USB Keyboard
(**) TypeMatrix.com USB Keyboard: always reports core events
(**) TypeMatrix.com USB Keyboard: Device: "/dev/input/event6"
(II) TypeMatrix.com USB Keyboard: Found keys
(II) TypeMatrix.com USB Keyboard: Configuring as keyboard
(II) XINPUT: Adding extended input device "TypeMatrix.com USB Keyboard" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) Option "xkb_model" "evdev"
(**) Option "xkb_layout" "se"
(**) Option "xkb_variant" "chvorak"

The keyboard repeat rate, set by xset, is also reset.

Does anyone know why it does this, and if there are any workarounds? (Previously I used a USB to PS/2 converter, but it doesn't work with this keyboard). Note that I don't unplug the keyboard (this is on a desktop machine) - and as far as I know, USB power saving is disabled. And I still want to use hotplugging.

Offline

#2 2010-09-22 08:45:24

xelados
Member
Registered: 2007-06-02
Posts: 314
Website

Re: USB keyboard and hotplugging, xmodmap settings are reset

I am also interested in the solution. I've been using udev to attempt to gain control over it...

Offline

#3 2010-09-22 11:04:14

Mogger
Member
From: Sweden
Registered: 2008-12-07
Posts: 153
Website

Re: USB keyboard and hotplugging, xmodmap settings are reset

The strange thing is, it doesn't happen on my netbook (same USB keyboard). Unfortunately I haven't found a solution to this problem yet.

Offline

#4 2011-05-01 19:03:52

aragats
Member
From: Broomfield, CO
Registered: 2009-05-26
Posts: 30

Re: USB keyboard and hotplugging, xmodmap settings are reset

Any news on this topic? Looks like not many people are experiencing it... It happen to when I started using Dell USB keyboard with my ThinkPad R61 several days ago. Really annoying: I have to re-run setxkbmap and xmodmap every time I plug it in. However I see no errors in the Xorg.0.log.

Offline

#5 2011-05-02 00:40:33

Mogger
Member
From: Sweden
Registered: 2008-12-07
Posts: 153
Website

Re: USB keyboard and hotplugging, xmodmap settings are reset

I tried to make a udev rule to run a script every time this happens (as this post; funny enough the OP also has a TypeMatrix 2030 keyboard) but couldn't get it to work. I intended to look further into it but couldn't find the time to do that.

So no, no solution yet.

Offline

#6 2012-05-08 07:31:13

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

Re: USB keyboard and hotplugging, xmodmap settings are reset

Sorry about bringing up such an old topic, but has anyone figured out a solution for this?  I've been having the same problem.  After hotplugging my keyboard (courtesy of switching my monitor off overnight) the Xmodmap settings are reset.

Also, oddly, the X11 beep settings are reset too - the system starts beeping through the PC speaker upon certain events, so I have to run "xset b off" every morning to disable the beep again (blacklisting the pcspkr module had no effect.)

Offline

#7 2012-05-08 19:49:38

aragats
Member
From: Broomfield, CO
Registered: 2009-05-26
Posts: 30

Re: USB keyboard and hotplugging, xmodmap settings are reset

Since udev approach didn't work rightaway, I've just mapped a key combination (Ctrl-Alt-Ins) to launch the script which runs setxkbmap and xmodmap. So I was just too lasy to dig deeper...

Offline

#8 2021-10-26 16:35:44

duanev
Member
Registered: 2012-02-26
Posts: 14

Re: USB keyboard and hotplugging, xmodmap settings are reset

I'm using a large monitor with multiple video connections and a built-in KVM (keyboard/video/mouse switch).  Every time I switch to a different screen/machine (buttons on the monitor or hot keys), the USB keyboard and mouse go through the hot-remove / hot-add cycle.  This seems to cause xorg to loose my xmodmap config.  I also often loose HDMI audio as well (I'm using pulseaudio).

Arguably the monitor's built-in KVM shouldn't be removing devices (it should leave them present and just not send events to the machine that is not in view).  The video switch is clearly handled properly, but the kbd/mouse/audio is not.

Offline

Board footer

Powered by FluxBB