Multiseat on Debian

Posted in Hardware-related, Linux / unix, Software-related on April 4th, 2010 by Jan

Since I have a rather well-scaled desktop PC (nothing really fancy by today’s specs, but it’s underused as it is), and my gf sometimes wants to use it, and sometimes we both want to use it at the same time, I decided to turn it into a multiseat configuration.

What’s a multiseat? Basically you connect a second set of input peripherals (keyboard, mouse) and a second screen (and if necessary a second video card) and reconfigure it to act as a separate pc.
And with Linux, you just can, without a lot of trouble.

There are some different multiseat setups: those that run separate X servers (one per display), and those that run one X server for all displays and then run a nested server on top of that to split out the actual displays. The ‘problem’ wit the latter is that you usually don’t have any 3D acceleration left, though if you use Xephyr these days that seems to work aswell.

I opted for the first option.

My hardware (that matters for this setup):

  • Mice: 2 simple Logitech usb mice
  • Keyboards: 2 usb keyboards (one Cherry Cymotion Linux Master & one labtec Ultraflat)
  • Graphics: an onboard ATI Radeon HD 3200 (this is part of the AMD 780 chipset) video chip on my Asrock motherboard (was originally disabled and enabled for this multiseat setup) and an addon ATI Radeon HD 4850 card (with an RV700 chip).
  • Screens: two screens – in this case, one 20.1″ Viewsonic VX2025wm and one 22″ (newly purchased) LG w2253TW

Notes:

  1. It is advised to use chips that can be driven with the same driver for a multiseat setup!
  2. If you use an onboard chipset (like I do), you’ll need to change the boot order so that this chip is actually used as the primary device, otherwise it won’t be initialised correctly.

Originally I had the ATI binary driver fglrx installed, but this does _not_ play well with a multiseat setup. The initialisation of the second card causes the system to hardlock.
Since this driver doesn’t work, I went for the xf86-video-ati driver, which is completely opensource, and in combination with a recent kernel allows for kernel mode setting. You do need the firmware for the card, usually found in the firmware-linux packages of your favourite distribution.

So, the works:

Requirements

  1. Get a spankingly fresh kernel. 2.6.33 at least, preferably newer. Compile it with KMS support enabled. Note that when you enable KMS support, you’ll lose your console unless you compile in fbcon, but I advise against this, as this doesn’t seem to play well with a multiseat setup.
  2. Install the linux-firmware package or get the necessary firmwares for your cards (to get 3D acceleration)
  3. Get a decently fresh Mesa (7.7 branch)
  4. Lastly, get a mjummy fresh xf86-video-ati driver.

Originally, I compiled all these and installed them over the existing binaries in /usr, but fortunately my favourite distribution Debian has the necessary components in Sid and Experimental. these days.

Xorg.conf changes

After everything is installed, you need to modify your xorg.conf file.

ServerFlags

Section "ServerFlags"
        Option      "DefaultServerLayout" "seat0"
        Option      "AllowMouseOpenFail"  "true"
        Option      "AutoAddDevices" "false"
EndSection

The AutoAddDevices line is important, otherwise we can’t map the devices to the right seat.

The actual graphic chips/cards:

Section "Device"
        Identifier  "ATI RadeonHD 4850"
        Driver      "ati"
        BusID       "PCI:2:0:0"
        Option      "Int10" "off"
EndSection

Section "Device"
        Identifier   "ATI RadeonHD 3200"
        driver       "ati"
        BusID        "PCI:1:5:0"
        Option       "Int10" "off"
EndSection

Int10 off is important here, otherwise the second card will fail to initialise.
Do not forget to change the PCI identifiers! They probably won’t match my setup. You can find them by using lspci, for instance on my setup:

lspci | grep  "Radeon HD"
01:05.0 VGA compatible controller: ATI Technologies Inc Radeon HD 3200 Graphics
02:00.0 VGA compatible controller: ATI Technologies Inc RV770 [Radeon HD 4850]

So you can see that the HD3200 is on address 1:5 and the HD4580 is on address 2:0.

The monitors (nothing fancy)

Section "Monitor"
        Identifier   "Viewsonic Vx2025wm"
        Option      "DPMS"
EndSection

Section "Monitor"
        Identifier    "LG W2253TW"
        Option       "DPMS"
EndSection

Screen section (mapping monitors and cards)

Section "Screen"
        Identifier        "Screen0"
        Device           "ATI RadeonHD 4850"
        DefaultDepth   24
EndSection

Section "Screen"
        Identifier        "Screen1"
        Device           "ATI RadeonHD 3200"
        DefaultDepth   24
EndSection

Next, the ServerLayout sections, one per seat:

Section "ServerLayout"
        Identifier     "seat0"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerLayout"
        Identifier     "seat1"
        Screen      1  "Screen1" 0 0
        InputDevice    "Mouse1" "CorePointer"
        InputDevice    "Keyboard1" "CoreKeyboard"
EndSection

Next, the input devices:

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:12.1-usb-0:3:1.0-event-kbd"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "us"
    Option         "XkbRules"   "xorg"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "evdev"
    Option         "Protocol" "ExplorerPS/2"
    Option         "Device" "/dev/input/by-path/pci-0000:00:13.0-usb-0:3:1.0-event-mouse"
EndSection

Section "InputDevice"
    Identifier     "Keyboard1"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:12.2-usb-0:3.1:1.0-event-kbd"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "us"
    Option         "XkbRules"   "xorg"
EndSection

Section "InputDevice"
    Identifier     "Mouse1"
    Driver         "evdev"
    Option         "Protocol" "ExplorerPS/2"
    Option         "Device" "/dev/input/by-path/pci-0000:00:12.2-usb-0:3.2:1.0-event-mouse"
EndSection

You need to change the device paths to match the devices you want, either by checking /dev/input/by-path/ or by /dev/input/by-id/. The benefit of using by-id is that if you replug your devices, they’ll still be mapped correctly. Since I have devices with the same ID, this didn’t work for me.

All these changes sofar should allow you to manually start up the X servers with the respective keyboard/mouse/screen settings. You should be able to test it with these commands:

/usr/bin/X -br -nolisten tcp -layout seat0 -sharevts \
      -novtswitch -isolateDevice PCI:2:0:0

or

/usr/bin/X -br -nolisten tcp -layout seat1 -sharevts \
      -novtswitch -isolateDevice PCI:1:5:0

KDM changes

Now, since I want both the X servers to be available at boot time, and I’m using KDE anyway, I went with KDM.

In the [General] section, look for a line reading:

StaticServers=:0

change it to:

StaticServers=:0,:1

Also, change:

ReserveServers=:1,:2,:3

to:

ReserveServers=:2,:3

Next, look for the [X-:0-Core] section, and copy the entire block, creating a second block with the section name [X-:1-Core].

In the [X-:0-Core] section, look for the line

ServerArgsLocal=-br -nolisten tcp

and change it to

ServerArgsLocal=-br -nolisten tcp -layout seat0 -sharevts -novtswitch -isolateDevice PCI:2:0:0

In the [X-:1-Core] section, look for the line

ServerArgsLocal=-br -nolisten tcp

and change it to

ServerArgsLocal=-br -nolisten tcp -layout seat1 -sharevts -novtswitch -isolateDevice PCI:1:5:0

One KDM restart later (/etc/init.d/kdm restart) you should have two X servers running, both on their respective screens!

Last but not least, kudos to WKPG wiki for the helpful article ;)

Using an Alcatel X200 under Linux

Posted in Internet, Linux / unix, Software-related on October 12th, 2009 by Jan

I recently purchased an Alcatel Onetouch X200 3G USB modem, to be able to use internet on various locations where there is no wired or wifi available. Works fine under Windows/Mac OS X, bit more of a hassle under Linux.

Here are some hints on how to get it to work:

  • You need to install usb-modeswitch to switch the card from it’s builtin usb-storage mode to the USBModem mode. Configuration is done in /etc/usb_modeswitch.conf
  • Use /dev/ttyUSB2. The other two ports that your modem will give don’t really work well.
  • Also, use atleast kernel 2.6.31. Earlier ones might not work.
  • Disable PIN authentication on your SIMcard! This one thing was what kept it from working decently – I tried tons of things, and when I disabled the PIN, it worked nearly instantaneously.
    The command to do PIN auth is AT+CPIN=1111 (changing 1111 by your actual PIN), but when issuing this command the modem accepts it, but very often freaks out afterwards. Weird.
    You can find a nice list of GSM modem AT codes on gsm-modem.de.

Thats about it!

World of Goo!

Posted in Games, Software-related on March 7th, 2009 by Jan

A good friend of mine introduced me to a new game: World Of Goo!

I’ve finished the demo, and it’s damned addictive ;)

There are user levels available too, so the gameplay isn’t limited to the game itself ;)

And, as a nice bonus: It’s available for Windows, Mac, and Linux!

Linux on the Apple Macbook

Posted in Uncategorized on January 3rd, 2009 by Jan

I was bored recently, and decided to install Linux on my Macbook. I opted for the distribution I like best – Debian (unstable/Sid).

After some twiddling it all works rather well, I’m amazed how well ;) Even suspend to ram works flawlessly! (that was a different case a year ago, when I last had linux on a laptop). The only things I still have to get working is the framebuffer console (so I get something better than 80×25), and the infrared. Nothing very high on the agenda, though :)

I’ve detailed the installation instructions here, on my kcore.org website.

Reading DRM’ed Adobe Ebooks on Linux

Posted in Linux / unix, Software-related on September 3rd, 2008 by Jan

Sade linked me to this nice ebook by Neil Gaiman, Neverwhere. Unfortunately, you need Adobe Digital Editions for it, which only exists for Windows and Mac. Since she’s a Linux user, that one didn’t really fly with her.

So, to get that thing to work, here’s a very low-tech way of doing it:

  1. Install Digital Editions on a supported OS (I used Mac OS)
  2. Download/open the ebook’s ebx.etd file
  3. Let Digital Editions open, download and authenticate the file
  4. Print to PDF 40 pages (the damn thing won’t let you print more)
  5. Close the digital Editions app
  6. Delete (in my case) the ~/Documents/Digital Editions directory
  7. Reload the webpage
  8. Goto step 2

Repeating this until you have the entire ebook in PDF’s for easy reading at home, under your favourite OS / device! ;)

Iodine (dns tunnel) on your Mac (to escape those evil firewalls)

Posted in Internet, Linux / unix, Mac OS, Software-related on July 7th, 2008 by Jan

Here’s a short how-to to get the iodine dns tunnel working on your Mac.

In this short howto, I’ll assume you’ll be using a linux server to act as your gateway to the world. I’ll also assume you’ve read the iodine documentation and setup your DNS accordingly. For my example, I’ll be using a (nonexistant) DynDNS.org static DNS entry, iodine.rulestheworld.tld. I’ll also assume that you’ll be using a public internet address of 1.2.3.4, and a private subnet of 10.0.0.1.

  1. Install the tun/tap driver for Mac OS X. Easy as doing *click* *click* done! :p
  2. Next, install iodine on your Mac. Easy as download, extract, and typing make; make install
  3. Now, install iodine on your linux box. It’s included in the package repositories of the usual suspects, for instance debian: apt-get install iodine.

    Start it (or configure it to use) with:
    iodined -P <password> <unused private IP> <dns name>
    or in our example:
    iodined -P mypass 10.0.0.1 iodine.rulestheworld.tld

    This should return the following:

    Opened dns0
    Setting IP of dns0 to 10.0.0.1
    Setting MTU of dns0 to 1024
    Opened UDP socket
    Listening to dns for domain iodine.rulestheworld.tld

  4. Configure your linux box for IP forwarding: sysctl -e net.ipv4.ip_forward=1
    (and add this to your /etc/sysctl.conf file), and configuring your firewall (iptables) for masquerading:
    iptables -t nat -A POSTROUTING -s 10.0.0.0/255.255.255.0 -o eth0 -j MASQUERADE
  5. Next, download NStun.sh, a very handy script that does all the hard work of changing the routes and so on :p

    You’ll want to change the script: change the first lines as the script reads, and lower, change the

    NS=`grep nameserver /etc/resolv.conf|head -1|awk ‘{print $2}’`

    line to read

    NS=”62.213.207.197″

Now, start NStun.sh on your Mac, and surf away! (well, slowly, but freely, atleast!)