# X11 not respecting keyboard options



## nickednamed (Feb 22, 2015)

I'm running FreeBSD 10.1-RELEASE with an Intel 4500HD using the x11-drivers/xf86-video-intel driver. My video is fine, and my keyboard works well (except for a few hotkeys which was always to be expected).

However, Xorg is not respecting the following options in my /etc/X11/xorg.conf:

```
Section "InputDevice"
      Identifier "Keyboard0"
      Driver "kbd"
      Option "XkbLayout" "pl,us"
      Option "XkbVariant" ",qwerty"
      Option "XKbOptions" "grp:alt_shift_toggle,ctrl:swapcaps,grp:"
EndSection
```

I have x11/xorg-minimal installed, which does not come with x11/setxkbmap by default. Does Xorg require this port for these options to work?

Just to be sure, I installed x11/setxkbmap to check if this is the problem, however, it has made no difference.

For now, I have the following in my ~/.xinitrc:

```
# set kb map to "pl"
setxkbmap pl

# swap L-CTRL and CAPS for greater pinky comfort.
#xmodmap $HOME/.xmodmap
setxkbmap -option ctrl:swapcaps
```

And this works just fine, although I would like to know why Xorg is not respecting my /etc/X11/xorg.conf keyboard options. What have I done wrong here?

As a side issue, is there any reason for preferring x11/xmodmap over x11/setxkbmap, or vice versa, when swapping Ctrl and CAPS, for example?


----------



## tobik@ (Feb 23, 2015)

Have a look at /var/log/Xorg.0.log and check if it even loads your xorg.conf.

This might be relevant too: https://wiki.archlinux.org/index.php/Keyboard_configuration_in_Xorg#Using_X_configuration_files



nickednamed said:


> As a side issue, is there any reason for preferring x11/xmodmap over x11/setxkbmap, or vice versa, when swapping Ctrl and CAPS, for example?


I prefer using x11/setxkbmap for this, if only for not having to create an ~/.Xmodmap.


----------



## nickednamed (Feb 23, 2015)

I'm sure it does use my config file; all my fonts are loaded properly.

My /var/log/Xorg.0.log contains the following line:

```
[  280.539] (==) Using config file: "/etc/X11/xorg.conf"
```

OK - I think I see the problem:

```
[  280.570] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[  280.570] (WW) Disabling Mouse0
[  280.570] (WW) Disabling Keyboard0
```

That will also explain why I wasn't able to get my middle Trackpoint button working properly through Xorg.

I believe I have found the solution HERE. IE. add the following to my /etc/X11/xorg.conf:

```
Section "ServerFlags"
Option "AutoAddDevices" "False"
EndSection
```

After adding the above, and restarting Xorg, my /var/log/Xorg.0.log now contains the lines:

```
[  5868.750] (**) Option "AutoAddDevices" "False"
[  5868.750] (**) Not automatically adding devices
[  5868.750] (==) Automatically enabling devices
[  5868.750] (==) Not automatically adding GPU devices
```

It no longer contains information about hotplugging, or disabling my keyboard. Instead it contains the following:

```
[  5869.502] (II) Using input driver 'kbd' for 'Keyboard0'
[  5869.502] (**) Option "CoreKeyboard"
[  5869.502] (**) Keyboard0: always reports core events
[  5869.502] (**) Keyboard0: always reports core events
[  5869.502] (**) Option "Protocol" "standard"
[  5869.502] (**) Option "XkbLayout" "pl,us"
[  5869.502] (**) Option "XkbVariant" ",qwerty"
[  5869.502] (**) Option "XkbOptions" "grp:alt_shift_toggle,ctrl:swapcaps"
[  5869.502] (II) XINPUT: Adding extended input device "Keyboard0" (type: KEYBOARD, id 7)
[  5869.538] (EE) Error loading keymap /tmp/server-0.xkm
[  5869.538] (EE) XKB: Failed to load keymap. Loading default keymap instead.
```

It still doesn't work, however. I will update as soon as I find the cause of the error.


----------



## nickednamed (Feb 23, 2015)

My problem is now solved.

I have changed my /etc/X11/xorg.conf back from:

```
Section "InputDevice"
      Identifier "Keyboard0"
      Driver "kbd"
      Option "XkbLayout" "pl,us"
      Option "XkbVariant" ",qwerty"
      Option "XKbOptions" "grp:alt_shift_toggle,ctrl:swapcaps"
EndSection
```
to:

```
Section "InputDevice"
      Identifier "Keyboard0"
      Driver "kbd"
      Option "XkbLayout" "pl"
      Option "XkbOptions" "ctrl:swapcaps"
EndSection
```
Not sure why the first one didn't work, but the second is good enough.


----------

