http://body0r.wordpress.com/2009/04/07/xorg-hal-toggle/

GNU/Linux configs || Anime

xorg, hal, udev && Touchpad/Mouse Toggle (>=xorg-server-1.5)

with 4 comments

I read, there were some changes between <xorg-server-1.5 and >=xorg-server-1.5. While I’ve updated my version to the latest possible (x11-base/xorg-server-1.6.0), I thought of using hal for my keyboard/touchpad/mouse-configuration.
The following configuration works for me:

First and foremost we need evdev configured in the kernel:

Device Drivers --->
  Input Device Support --->
     <*> Event Interface

which results as the following in the related .config:
CONFIG_INPUT_EVDEV=y
After this the new kernel will be needed, so we issue:
(sudo) init 6

Now, edit /etc/make.conf to the following:
INPUT_DEVICES=”evdev synaptics”
Yes, there is no keyboard or mouse present, because evdev now handles all the keyboard/mouse-input.

Now we need to emerge the newest xorg-server with the hal-useflag enabled. Since there are other packages, that depend on hal with this change, we enable it globally:
echo ‘USE=”$USE hal”‘ >> /etc/make.conf

After this, a full world-update is required to let the system know, that there’ve been changes to the global useflags.
emerge -avuDN (@)world
(I’m bracketing the at, because at this moment >=sys-apps/portage-2.2_pre is masked due to known bugs.)

While the world-update is running, we can start writing our own hal-policy-files. :]
(If you’ve got no UTF-8-Support on your system change the encoding to the one you’re using)

If hal was already installed, the following can be used, else just edit a correspondent file in your home/root-directory and copy it afterwards.
I just copied /usr/share/hal/fdi/policy/10osvendor/10-x11-input.fdi to /etc/hal/fdi/policy/10-x11-input.fdi and changed it, so that the right layout and variant are being used:
[~]# cat /etc/hal/fdi/policy/10-x11-input.fdi
10-x11-input.fdi (alternative Link)

The following is my policy-file for the Touchpad, formerly known as InputDevice “Touchpad”:

[~]# cat /etc/hal/fdi/policy/11-x11-synaptics.fdi
11-x11-synaptics.fdi (alternative Link)

And this one is the new xorg.conf (alternative Link)
[~]# cat /etc/X11/xorg.conf
Section “ServerLayout”
Identifier “X.org Configured”
Screen 0 “Screen0″ 0 0
EndSection

[snip]

Section “ServerFlags”
Option “AllowEmptyInput” “true”
Option “AutoAddDevices” “true”
Option “AutoEnableDevices” “true”
EndSection

and delete all Sections named “InputDevice”.

After the world-update is finished, we need to add hald to start while the machine boots. Therefore we execute the following command as root:
rc-update add hald default

There are only two commands left and we’re ready to use our new xorg-server with it’s now drastically reduced xorg.conf (106 (alternative Link) lines to at first 97 (alternative Link) [switched from ati-drivers (proprietary) to xf86-video-ati (open-source)] and finally 61 lines (alternative Link) [I actually configured everything I would ever use for my touchpad in my xorg.conf, ignoring synclient]) and those new hal-rules.
Again, as root:
/etc/init.d/hald start
(or restart hal, if it’s already been started, so that it uses the new rules. At the moment hal doesn’t recognize changed rules while it’s running, I hope, the devs are going to change this one in the future)
And:
/etc/init.d/xdm restart

If you’ve done everything right so far, there should be your login-screen, so you can logon without any further problems.

Right now, you should use the following command, to find out, if the Touchpad-policy-file has been recognized from the X-Server:
/usr/bin/synclient -l
If you’re getting
Can’t access shared memory area. SHMConfig disabled?
then change the following in /etc/hal/fdi/policy/11-x11-synaptics.fdi:
>From <merge key=”input.x11_options.SHMConfig” type=”string”>true</merge>
to <merge key=”input.x11_options.SHMConfig” type=”string”>On</merge>

At first I’ve tried the second line, but then I got the SHMConfig disabled? error and tried the first one. After that, it worked wonderfully.

Now we’re using udev to turn off the touchpad, when there’s an external mouse attached:

[~]# cat /etc/udev/rules.d/10-local.rules
ACTION="" SUBSYSTEM==”input”, ENV{ID_CLASS}=”mouse”, RUN+=”/usr/bin/synclient TouchpadOff=1″
ACTION="" SUBSYSTEM==”input”, ENV{ID_CLASS}=”mouse”, RUN+=”/usr/bin/synclient TouchpadOff=0″

Since udev is recognizing new or changed rules, while it’s running, you don’t need to restart the udev-daemon.

I myself doubted at the beginning, that this route, the xorg-devs took, would be a good one, but after taking a little time in reading some wiki-entries and postings on the web, I now think, it was a good decision, leaving everything input related to hal (for hotplugging issues) and using the xorg.conf only for tuning the X-server.

Written by body0r

April 7, 2009 at 7:00 pm

4 Responses

Subscribe to comments with RSS.

  1. Thanx man!

    Mafkees1233

    April 12, 2009 at 10:41 pm

  2. [...] The next task was getting X11 up and running. The latest versions of X leans heavily on hal, and gentoo has really dropped the ball here. I installed gnome-desktop with the assumption that it would pull in X11. Not only did I have to install X11 separately, but X11 left out hal, which is now required to connect X11 to input devices. I ended up wasting a couple of hours this morning rewriting xorg.conf line by line and searching the internet for clues as to why the mouse and keyboard would work in the console but not in X. I finally came across this post, and then in more depth here. [...]

  3. I have the same problem, it’s an old machine so I don’t emerge -uDNv world often. Was quite surprised when there would just be no input after the upgrade. Several other recipes didn’t work, so I hope it’ll be ok with this one.

    Good thing I’ve got backups and a spare Kubuntu on my other hdd. I love my gentoo, once everything is set up it works well. But every update, be it kernel or just the userland, can be the source for major fuckups…

    TKlobster

    May 26, 2009 at 6:26 pm

  4. I has a big problem with this issue. With xorg-server 1.5.3 all the xorg configuration with fdi files runs correctly, but when I upgrade xorg-server to the 1.6.X version, the keyboard and mouse don’t rule :S. I Finally downgrade the xorg-server version :(

    piponazo

    August 6, 2009 at 1:51 pm


Reply via email to