Blog karp0tt

GNU/Linux configurations

Xorg, udev && Touchpad/Mouse Toggle (>=xorg-server-1.8.0)

One year after outsourcing those input devices from my xorg.conf to hal, I think those xorg developers are toying with me. First hal and now udev, what backend will be used next? ~

Only Funtoo-users need to do the following, Gentooers, that are already using an unstable system (ACCEPT_KEYWORDS=”~$arch” in /etc/make.conf), can read on at disabling the hal-useflag
[~]# echo "=sys-fs/udev-151\n=x11-base/xorg-server-1.8.0" >> /etc/portage/package.unmask/local

I’m using a directory not only for package.unmask but also for package.mask and package.keywords for those being easier to maintain.

Since udev has been keyworded without any keywords (<3), it needs an entry in /etc/portage/package.keywords/local
[~]# echo "=sys-fs/udev-151 **" >> /etc/portage/package.keywords/local

Now emerge the new udev (and my recommendation thereafter is reemerging the system set, just to see if there are some udev-related errors):
[~]# time emerge -a1 udev
[~]# time emerge -a @system

I’ve had zero errors on this set, so I was continuing on my journey to a new xorg-server :x

If you’re using a stable system (emerge –info showing only ACCEPT_KEYWORDS="${arch}") then you also need the following in /etc/portage/package.keywords/local:
[~]# echo "=x11-base/xorg-server-1.8.0\n=x11-base/xorg-drivers-1.8" >> /etc/portage/package.keywords/local

If you still want hal-support for some other packages (But who would want that? We’re all educated people that don’t use deprecated packages :x), you can disable hal only for the xorg-server and evdev:
[~]# echo "x11-base/xorg-server -hal\nx11-drivers/xf86-input-evdev -hal" >> /etc/portage/package.use

If you’re one of those people that completely want to disable hal (having it installed only for input devices) you just need the following in /etc/make.conf (the rest needs to read this thread to be sure about what you’re doing when you’re completely disabling hal):
[~]# echo 'USE="${USE} -hal"' >> /etc/make.conf

At first it’s recommended to upgrade your xorg-server to version 1.8.0 and after that recompiling/upgrading your drivers (input devices and graphics) using qlist (qlist belongs to portage-utils):
[~]# time emerge -a1N xorg-server
(”man emerge” if you don’t know what -N is)

If you’ve got a touchpad that needs synaptics, INPUT_DEVICES in /etc/make.conf needs to look like the following:
INPUT_DEVICES="evdev synaptics"

[~]# time emerge -a1 `qlist -I -C x11-drivers/`

Now, here’s my new xorg.conf.
As you can see there are just a few FontPaths, a Section DRI and a Section Extensions (somehow compositing doesn’t work without it, I wonder why ~)
Upon emerging xorg-server-1.8.0 it also installed a directory /etc/X11/xorg.conf.d/ that up to this point includes a single entry:
[~]# ls /etc/X11/xorg.conf.d
10-evdev.conf

Since I’m using a touchpad based on synaptics and a keyboard with german layout, I moved that 10-evdev.conf to 90-evdev.conf and created two files:
[~]# mv /etc/X11/xorg.conf.d/10-evdev.conf /etc/X11/xorg.conf.d/90-evdev.conf
[~]# vim /etc/X11/xorg.conf.d/10-keyboard.conf
[~]# vim /etc/X11/xorg.conf.d/20-synaptics.conf

10-keyboard.conf:
Section "InputClass"
Identifier "Keyboard"
Driver "evdev"
MatchIsKeyboard "on"
Option "xkbmodel" "evdev"
Option "xkblayout" "de"
Option "xkbvariant" "nodeadkeys"
Option "xkbrules" "base"
Option "xkboptions" "compose:menu"
EndSection

20-synaptics.conf:
Section "InputClass"
Identifier "Touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "SHMConfig" "true"
Option "MinSpeed" "0.20"
Option "MaxSpeed" "0.60"
Option "AccelFactor" "0.020"
Option "HorizEdgeScroll" "true"
Option "HorizScrollDelta" "100"
Option "VertEdgeScroll" "true"
Option "VertScrollDelta" "100"
Option "TapButton1" "1"
EndSection

For more detailed information about configuring you’re devices read this blog entry.

Now you can start your new X with udev backend support \o/

If you’re one of those persons that removed the hal support completely in /etc/make.conf, reemerge your installed packages and, if there were no errors, stop your hal-daemon and use those programs that reemerged without hal to see, whether they’re working or not (and still need hal :[)
[~]# time emerge -aN @installed
[~]# /etc/init.d/hald stop

When there are no problems, unmerge hal (and its dependencies) and make this world a better place <3
[~]# emerge -pv --depclean hal
[~]# emerge -C <output from the above>

And now for the new udev rule:
For this to work you need three files and an entry in your .xinitrc before starting your window manager/desktop environment:
/home/scripts/touchpadtoggle
/home/scripts/touchpadtest (or wherever you want them located [echo $PATH]; make sure they’re executable [chmod +x])
/etc/udev/rules.d/20-touchpad.rules (number is arbitrary but I’ve got a 10-vboxdrv.rules in that directory)

/home/scripts/touchpadtest (for the grep string see below [VendorID:ProductID]):
#!/bin/bash
blerg=`/usr/bin/sudo /usr/sbin/lsusb | grep 05e3:1205`
if [[ "$blerg" == "" ]] ; then
/home/scripts/touchpadtoggle 0
else
/home/scripts/touchpadtoggle 1
fi

/home/scripts/touchpadtoggle:
#!/bin/bash
export DISPLAY=":1.0"
/usr/bin/synclient TouchpadOff=$1 2>/dev/null

I’ve got DISPLAY=”:1.0″ as I’m using qingy and tty1 is my main working area. If you’re not using qingy DISPLAY=”:0″ should be best.

/etc/udev/rules.d/20-touchpad.rules
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="|vendor id|", ATTRS{idProduct}=="|product id|", ENV{REMOVE_CMD}="/home/scripts/touchpadtoggle 0", RUN+="/home/scripts/touchpadtoggle 1"

To get those two ids, just plug in your external mouse and run
[~]# sudo lsusb

The following is mine where 05e3 is the Vendor ID and 1205 is the Product ID (you can handle it with udevadm monitor –property, plugging in or out your external mouse and looking for the specific entry, but why walking around the village when you can go straight through it?):
Bus 004 Device 028: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical Mouse H3003

And the corresponding udev rule:
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="1205", ENV{REMOVE_CMD}="/home/scripts/touchpadtoggle 0", RUN+="/home/scripts/touchpadtoggle 1"
Courtesy of the Arch Linux Forums.

To complete this thing:
.xinitrc
Working touchpad/mouse toggle, an updated xorg-server and an updated udev; that’s the way it should be.
\(^o^)/

Advertisements

Written by body0r

April 16, 2010 at 5:00 pm

3 Responses

Subscribe to comments with RSS.

  1. […] here: Xorg, udev && Touchpad/Mouse Toggle – (>=xorg-server-1.8.0) « Blog … By admin | category: zero system | tags: client-desktop, info-showing, journey, logic, […]

  2. On Arch Linux the update to 1.8 broke my configuration completely. Adding the files you posted fixed the issues. Thank you.

    Jörg Zweier

    May 1, 2010 at 3:21 pm

  3. Hi,

    evdev doesn’t have the “hal” use flag anymore.

    But I have added the “-hal” flag to “x11-drivers/xf86-input-synaptics” since it not needed anymore. (I have a laptop).

    I’m using a canadian-french keyboard and I used the following as /etc/X11/xorg.conf.d/12-keymap.conf

    Section “InputClass”
    Identifier “Logitech Media Keyboard”
    Driver “evdev”
    Option “xkbLayout” “ca”
    Option “xkbVariant” “multi”
    MatchIsKeyboard “on”
    Option “XkbOptions” “terminate:ctrl_alt_bksp”
    EndSection

    And I have added the following rule as /etc/evdev/rules.d/64-keyboard.rules

    ENV{ID_INPUT_KEYBOARD}==”?*”, ENV{xkblayout}=”ca”, ENV{xkbvariant}=”multi”

    Excellent post! Xorg 1.8 is a step toward a simpler Xorg configuration.

    Regards,

    Bernard

    PerfMonk

    May 6, 2010 at 1:59 am


Comments are closed.

%d bloggers like this: