Keyboard Layout configuration using HAL

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:


Comments:

thanks for the tip and the explanations about HAL - seems that XML owns us all the way round :-)

Posted by Arnaud ZIEBA on November 14, 2010 at 03:33 PM CET #

Thanks very much for the tip. I'm using it to set my keyboard to french. Do you know why HAL is not detecting the french keayboard ? why do we need to force the setup like this ?

Posted by Stephane Lapierre on May 16, 2011 at 03:57 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Solaris l10n & i18n, locales, keyboards, fonts and related topics.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today