Thursday, February 21, 2008

Multiseat in Ubuntu 8.04 (II)

<< step (I) <<

Once we have modified the xorg.conf file and we have a big desktop in the two monitors, the next thing is to configure gdm to launch the two Xephyr sessions.

Previously, you will need to obtain the information related to the input events on your system. The way of referencing the events has been recently modified. Now, the operating system allows you to access the events via their paths, and on some systems, via their names. The script wrapper to launch Xephyr it is now simpler compared to the previous version. It is not necessary any more to match the events with the physical locations (as we did through /proc/bus/input/devices)

You must obtain the path-based symbolic links to the events corresponding to your keyboards and mouses. In our particular case, whe have two USB keyboards, one USB mouse and one PS/2 mouse.


# ls -la /dev/input/by-path/ | grep event | grep kbd
lrwxrwxrwx 1 root root 9 2008-02-20 09:49 pci-0000:00:1d.2-usb-0:1:1.0-event-kbd -> ../event5
lrwxrwxrwx 1 root root 9 2008-02-20 09:49 pci-0000:00:1d.2-usb-0:2:1.0-event-kbd -> ../event6

# ls -la /dev/input/by-path/ | grep event | grep mouse
lrwxrwxrwx 1 root root 9 2008-02-20 09:49 pci-0000:00:1d.3-usb-0:1:1.0-event-mouse -> ../event8
lrwxrwxrwx 1 root root 9 2008-02-20 09:49 platform-i8042-serio-1-event-mouse -> ../event2


The invocation of the Xephyr wrapper in the (/etc/gdm/gdm.conf) file will be something like this (remember to do a backup of your files before doing any modification!):


# ****************************************************************************

# Modificaciones multiseat (20080109)

0=Xephyr0
1=Xephyr1
2=Xephyr2

[server-Xephyr0]
name=Xephyr0
command=/usr/bin/X -br -dpms -s 0
handled=false
flexible=false

[server-Xephyr1]
name=Xephyr1
command=/usr/sbin/Xephyr-path.sh -display :0 -br -xauthority /var/lib/gdm/:0.Xauth -screen 1280x1024 -kbdpath pci-0000:00:1d.2-usb-0:2:1.0-event-kbd -mousepath platform-i8042-serio-1-event-mouse
handled=true
flexible=false

[server-Xephyr2]
name=Xephyr2
command=/usr/sbin/Xephyr-path.sh -display :0 -br -xauthority /var/lib/gdm/:0.Xauth -screen 1280x1024+1280+0 -kbdpath pci-0000:00:1d.2-usb-0:1:1.0-event-kbd -mousepath pci-0000:00:1d.3-usb-0:1:1.0-event-mouse
handled=true
flexible=false

# ****************************************************************************


Notice that the Xepyr wrapper is called Xephyr-path.sh (just to remark the modification). If you prefer to reference the devices by its name instead of the path, obtain the names in a similar way (have a look at /dev/input/by-name/) and do the necessary modifications on the wrapper.

Since the previous version, xserver-xephyr has been modified so the script is slightly different from the old one. Place the script somewhere in your computer (and remember to give it execution permissions) so it can be invoked when gdm starts. In our prototype, the wrapper is placed at /usr/sbin/Xephyr-path.sh


#!/bin/bash

# 20080109..20080221 - josean
# http://netpatia.blogspot.com/

trap "" usr1

XEPHYR=/usr/bin/Xephyr

args=()

while [ ! -z "$1" ]; do
if [[ "$1" == "-xauthority" ]]; then
shift
if [ ! -z "$1" ]; then
export XAUTHORITY="$1"
fi
elif [[ "$1" == "-display" ]]; then
shift
if [ ! -z "$1" ]; then
export DISPLAY="$1"
fi
elif [[ "$1" == "-kbdpath" ]]; then
shift
if [ ! -z "$1" ]; then
args=("${args[@]}" "-keybd")
args=("${args[@]}" "evdev,,device=/dev/input/by-path/$1,xkbrules=xorg,xkbmodel=evdev,xkblayout=es")
fi
elif [[ "$1" == "-mousepath" ]]; then
shift
if [ ! -z "$1" ]; then
args=("${args[@]}" "-mouse")
args=("${args[@]}" "evdev,,device=/dev/input/by-path/$1,WHEELRelativeAxisButtons 6 7")
fi
else
args=("${args[@]}" "$1")
echo "+++ args $1 +++" >> /tmp/logXephyr
fi
shift
done

echo $XEPHYR -ac "${args[@]}" >> /tmp/logXephyr
exec $XEPHYR -ac "${args[@]}"


Notice the changes, mainly in the options passed to the evdev driver for mouse and keyboard.

Another significant change on the wrapper script is the removal of the line...

elif ! expr match $1 'vt[0-9][0-9]*' >/dev/null; then

...from the 6.06 version. Now, the parameters related to virtual terminals are not filtered, so they are passed in the final invocation. In our prototype, the two seats share the same vt (vt9) and this seems to be no problem at all. If you have more seats or you experience some problem, maybe you will need to filter the vt parameters in the final Xephyr call.

Currently, the mouse wheel (vertical scroll) is not working. The option WHEELRelativeAxisButtons is just to try to get it working, but without success at the moment. Unfortunately there is not much documentation about evdev and its options. If somebody achieves to manage the mouse wheel, feedback is welcome.

The good news is that the keyboard mapping seems to work properly. After dozens of trials with parameters (keyboard layouts, mapping, geometry), an updated package of xserver-xephyr was published some days ago. The new package corrected a bug in the path locations where evdev was looking for keyboard definition files. Now everything works perfect, you just have to choose the language layout for your keyboard (Spanish in our example).

If you test the system at this stage, you will probably see just only one login window. There is still a couple of things to do before your system is ready to use.

>> step (III) >>

10 comments:

Jonathan said...

Thank you very much for your HOWTO, as I wasn't aware of any way to set up multiseat using a single video device with multiple outputs before I found it. I've been using your old HOWTO over the last couple of days to set up multiseat on my Hardy system. Of course, I discovered that several things had changed since Feisty, such as an evdev-capable Hardy Xephyr package and the udev created symlinks in /dev/input/by-id and /dev/input/by-path. I discovered your brand new post today, after I had already made several changes very similar to yours.

However, just like you, I'm still trying to get mouse wheels working. How did you find anything about the WHEELRelativeAxisButtons option in the Xephyr command line? I've searched for a couple of hours for anything about the "-mouse" option to Xephyr in vain. I even downloaded the xserver source (including kdrive and xephyr), but I haven't yet found the option parsing. I'm sure it's in there, but if you know of any kind of documentation, it would be very helpful.

josean said...

I am having just the same problem: There is almost no documentation on evdev parameters and options.

The only useful information link that I have found so far is on the post, but I have been unable to success so far.

Jonathan said...

Unfortunately, it seems that the evdev manpage is about the xorg xserver. Xephyr is part of kdrive and has a different system of configuration and probably a completely different input system. In particular, it doesn't use a configuration file at all, but only command line parameters.

Anonymous said...

All i remember is in the previous version, the scrollwheel was enabled by the ",5" after the mouse-event. Not sure if that will still work.

Anonymous said...

Hi,

thank you for this Howto. It helped me to get this running on Gentoo. I got the mouse wheel working with the xorg-server version 1.4.0.90 but only by modifying the source code. I changed the file hw/kdrive/src/kinput.c and replaced

pi->nButtons = 3;

by

pi->nButtons = 5;

Then it worked fine. But I don't think this is an option with Gentoo. But maybe you can open a bug request with Ubuntu.

Bye,

Jogi

BaBL said...

Yes, it works! We change nButtons to 7 too and mouse WHEEL works now without ,5 and other parameters (Debian SID, xserver-xorg 1.4.1)

apt-build source xserver-xephyr
fix nButtons in xorg-xsever-1.4.1....
apt-build install xserver-xephyr

tiwoc said...

Thanks for this tutorial and the great comments on the mouse wheel just above this post!

I wrote in my blog about the additional finetuning I did to my installation. It includes a more detailed description on fixing the mouse wheel issue and source code for a program that helps switching between single user and multiseat mode.

Anonymous said...

It seems that everybody manages to make this configuration work, so i must be doing something wrong.
My trouble starts with the "The invocation of the Xephyr wrapper in the (/etc/gdm/gdm.conf) file..." paragraph. Do I have to paste the following configuration ('Configuraciones multiseat') at the end of gdm.conf file? This is what i'm just doing but with no success.
I will be very thankful if some advice can be given on that point.

Anonymous said...

Thank you very much for this howto.

For those using a Nvidia graphics card, Step I is as simple as running nvidia-settings and selecting "Twinview". Then follow to ...

"Once we have modified the xorg.conf file and we have a big desktop in the two monitors"

pci compliance said...

Thanks for this excellent blog post. It helped me learn some of the key issues about Ubuntu. I plan to read your blog a lot more.