Keyboard Layout configuration using HAL
By Javier Acosta on Sep 21, 2009
A couple of months ago; Solaris Nevada and OpenSolaris started using HAL (Hardware Abstraction Layer). Now, all Input Device Configuration is done through HAL rather than xorg.conf.
HAL, uses XML files for its configuration and store them in /etc/hal/fdi/policy/ directory. The syntax of these files is very intuitive and if you have ever modified xorg.conf file, you will find it very simple to work with these files.
Before HAL was integrated, some people used to configure their Keyboard Layout and Keyboard Settings using xorg.conf but since HAL integration this configuration is not working any more.
Basically, to configure any input device you will have to add a new configuration fdi file into /etc/hal/fdi/policy/ directory, then "theoretically" you just need to replug the device or log out and log in again for the changes to take effect, but my experience says that a restart is needed :(
If you want to configure your keyboard; you can find a very useful 10-x11-input.fdi file sample in /etc/hal/fdi/preprobe/10osvendor/ directory. Bellow is an example on how I configured my keyboard Layout:
Configuring Keyboard Layout Using HAL
Become root and create 10-x11-input.fdi file using your preferred test editor (In the example I used vim):
$ pfexec su - # vim /etc/hal/fdi/policy/10-x11-input.fdi
add the following to 10-x11-input.fdi file
<?xml version="1.0" encoding="UTF-8"?> <deviceinfo version="0.2"> <device> <match key="info.capabilities" contains="input.keys"> <merge key="input.x11_options.XkbRules" type="string">base</merge> <merge key="input.x11_options.XkbModel" type="string">sun_type6_usb</merge> <merge key="input.x11_options.XkbLayout" type="string">us,cz</merge> <merge key="input.x11_options.XkbVariant" type="string">,qwerty</merge> <merge key="input.x11_options.XkbOptions" type="string">grp:shifts_toggle,terminate:ctrl_alt_bksp</merge> </match> </device> </deviceinfo>
Essentially with this file I've configured 5 settings of my keyboard:
Rules: "base" --> newest rules file
Model: "sun_type6_usb" --> I'm using a Sun Type 6 Keyboard
Layout: "us,cz" --> US English and Czech keyboard layouts
Variant: ",qwerty" --> none for US English and "qwerty" variant for Czech layout"
Options: "grp:shifts_toggle,terminate:ctrl_alt_bksp" I've chosen two additional options; the first one is to be able to switch between both keyboard layouts by pressing both Shift keys in my keyboard and the second option is to be able to terminate X server by key combination "Control" + "Alt" + "BackSpace"
You can get a full list of possible keyboard layout settings in /usr/X11/lib/X11/xkb/rules/base.lst file
Then just save the file and "restart" your machine.
To see if you got the keyboard correctly configured just run the following command:
$ lshal |grep input.x11
You should see something like this: