# HAL and keyboard



## varnie (Feb 2, 2011)

Good day.

I have done many searches through the forum and googled a lot but still haven't found the solution.
My goal is to switch from old xorg.conf keyboard settings to the new one, using HAL, as described in the handbook.

Okay, here's what I have:

0. I assured I have the hald and dbus enabled:
[CMD=""]cat /etc/rc.conf |grep 'hal'[/CMD]

```
hald_enable="YES"
```

[CMD=""]cat /etc/rc.conf |grep 'dbus'[/CMD]

```
dbus_enable="YES"
```

1. I edited /etc/X11/xorg.conf and "enable" HAL by adding one line:

```
Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option "AutoAddDevices" "true" #added	
EndSection
```

2. I created the "fdi" configuration for HAL.
[CMD="cat /usr/local/etc/hal/fdi/policy/x11-input.fdi"][/CMD]

```
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
      <merge key="input.x11_options.XkbLayout" type="string">us,ru(winkeys),pl</merge>
      <merge key="input.x11_options.XkbOptions" type="string">grp:caps_toggle,grp_led:caps,</merge>
    </match>
  </device>
</deviceinfo>
```
3. then, being in X session, I performed:
[CMD=""]/usr/local/etc/rc.d/hald restart[/CMD]
4. now I logged out from my XFCE4 session, come back to SLIM (graphical login manager for X11) and bump! I cannot type the correct keys (thus, cannot login into X )! :'-(

Please clarify what am I doing wrong.


----------



## nakal (Feb 2, 2011)

First...


```
Option "AutoAddDevices" "true" #added
```

should go to Section "ServerFlags".


----------



## varnie (Feb 2, 2011)

@*nakal*
let me quote the handbook about it:


> To restore the old behavior, add the following line to the ServerLayout or ServerFlags section of this file:
> Option "AutoAddDevices" "false"


From this quote one can conclude both sections should work well. huh?


----------



## kisscool-fr (Feb 2, 2011)

The old behaviour is what you had, i mean keyboard config in xorg.conf file. 

If you have installed xorg with hal support enabled, you just have to comment this option and it should be ok. 
You can verify it with 

```
grep -Ri with_hal /var/db/ports/
```
, if you installed xorg-server with ports.


----------



## varnie (Feb 2, 2011)

you meant if I want to switch to new way of detecting keyboard (using HAL), all I need to do is to build Xorg with HAL support (done yet) and just comment all that section related to keyboard in xorg.conf and that's all ? I doubt, because in this case I'll only have "us" language (suppose it enabled by HAL by default in case there's no appropriate fdi config found).

it is strange, because I have read everywhere there's a need of "/usr/local/etc/hal/fdi/policy/x11-input.fdi" config in this case.


----------



## kisscool-fr (Feb 2, 2011)

I mean if you have HAL support in xorg, you don't need the line 

```
Option "AutoAddDevices" "true" #added
```
. You can just comment it and it should be working with default settings (en keymap, /dev/sysmouse device, etc ...).

Next, you'll have to adjust the settings to your needs in the /usr/local/etc/hal/fdi/policy/x11-input.fdi file. Which file you can copy from /usr/local/share/examples/hal/fdi/policy/ directory if i'm not wrong.


----------



## varnie (Feb 2, 2011)

Okay, it works finally.

But accented characters of Polish language don't work.
Here's what I have:

```
(II) XINPUT: Adding extended input device "USB Receiver" (type: KEYBOARD)
(II) config/hal: Adding input device AT Keyboard
(**) AT Keyboard: always reports core events
(**) Option "Protocol" "standard"
(**) AT Keyboard: Protocol: standard
(**) Option "XkbRules" "base"
(**) AT Keyboard: XkbRules: "base"
(**) Option "XkbModel" "pc105"
(**) AT Keyboard: XkbModel: "pc105"
(**) Option "XkbLayout" "us,ru,pl"
(**) AT Keyboard: XkbLayout: "us,ru,pl"
(**) Option "XkbVariant" ",winkeys,qwertz"
(**) AT Keyboard: XkbVariant: ",winkeys,qwertz"
(**) Option "XkbOptions" "grp:ctrl_shift_toggle,grp_led:scroll"
(**) AT Keyboard: XkbOptions: "grp:ctrl_shift_toggle,grp_led:scroll"
(**) Option "CustomKeycodes" "off"
(**) AT Keyboard: CustomKeycodes disabled
```

is it possible to specify "qwertz" for Polish language layout using HAL? 

I don't want to additionally invoke 
[CMD=""]setxkbmap -model pc105 -layout us,ru,pl[/CMD] each time I logged into XFCE.


----------



## rusty (Feb 2, 2011)

Add it to .xinitrc otherwise I imagine XFCE handles Autostart scripts like most other DE's.


----------



## varnie (Feb 2, 2011)

Is it possible to have different languages specified using HAL for two different users?


----------



## nakal (Feb 2, 2011)

varnie said:
			
		

> From this quote one can conclude both sections should work well. huh?



I was reading the man-page and there was nothing written about putting it into the serverlayout section. But it's true, it's enabled by default, so it should not matter.


----------

