Tag Archives: amazon:asin=B0081LVOTQ

One Fedora 17 Box up to 16 USB Multiseat Terminals

Fedora 17, as shipped, supports only 7 or 8 plug-and-play USB terminals per machine. The cause is the kernel evdev driver’s limit of 32 input devices.

You can see how your 32 evdev slots are currently getting used on a system with the command

for i in {0..31..1}; do udevadm info -a -n /dev/input/event$i | grep name; done

On the Fedora 17 multiseat box I’m using now to write this post, I have 3 USB terminals sharing one box — while I’ve spent the afternoon figuring this stuff out on one of the USB terminals, at the same time the kids have been watching endless youtube videos with their headsets on the other two. On this box, the command above shows:

    ATTRS{name}=="Power Button"
    ATTRS{name}=="Power Button"
    ATTRS{name}=="Plantronics Plantronics .Audio 655 DSP"
    ATTRS{name}=="Dell Dell USB Keyboard"
    ATTRS{name}=="USB Optical Mouse"
    ATTRS{name}=="USB Optical Mouse"
    ATTRS{name}=="Dell Dell USB Keyboard"
    ATTRS{name}=="GASIA USB KB V11"
    ATTRS{name}=="GASIA USB KB V11"
    ATTRS{name}=="SIGMACHIP Usb Mouse"
    ATTRS{name}=="C-Media Electronics Inc. USB Multimedia Audio Device"
    ATTRS{name}=="CM109 USB driver"
    ATTRS{name}=="HDA Intel PCH HDMI/DP,pcm=3"
    ATTRS{name}=="HDA Intel PCH Line"
    ATTRS{name}=="HDA Intel PCH Rear Mic"
    ATTRS{name}=="HDA Intel PCH Front Mic"
    ATTRS{name}=="HDA Intel PCH Front Headphone"
    ATTRS{name}=="HDA Intel PCH Line Out"
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found

This shows I only have 14 evdev slots left (the “device node not found” ones are available slots). So I know I could only connect 7 terminals total to this machine (a USB terminal’s unused audio buttons + keyboard + mouse takes up 3, I could only get 14 / 3 = 4 more than the three I have).

We can lift the limit of USB terminals from 7 to 16 by disabling often unused input devices: hardware volume controls and system (power) buttons. The following udev rules script does that with 3 rules.

Note that this will mean you’ll have to power off / sleep from the UI, your mainboard audio will be disabled, and special keyboard multimedia keys will be disabled. Feel free to comment out the appropriate lines in the udev rules if you want to keep those.

To apply these optimizations, create a system file (as sudo) called /usr/lib/udev/rules.d/72-seat.rules
with the following contents and reboot.

#
# Bernie Thompson bernie@plugable.com
#
# These udev rules help alleviate the Linux kernel limit of 32 evdev devices.
# This file should be deleted once the kernel's 32 device limit is lifted.
#
# Background: Every input device on the system, including several for 
# power buttons, PCI audio, USB audio, keyboard multimedia keys, etc. 
# all count towards the 32 limit.  Many systems reserve at least 8 for
# these uses. So as shipped with Fedora 17, only 7 or so USB terminals 
# (like the Plugable DC-125 or Plugable UD-160-M) will work.
#
# Run this at a command line to see how your 32 event slots are being used:
#
# for i in {0..31..1}; do udevadm info -a -n /dev/input/event$i | grep name; done
#
# If you have any event slots free, you'll see a "device node not found" message for each
#
# USB terminals consume an extra event device with the USB HID device
# associated with the audio interface for volume control. The udev rule below
# frees it up. This will enable around 12 USB terminals per server.
#
SUBSYSTEMS=="usb", SUBSYSTEM=="input", ENV{ID_SEAT}!="seat0", ENV{ID_USB_INTERFACE_NUM}!="00", RUN="/bin/sh -c 'echo $id > /sys/$devpath/../../../driver/unbind'"

#
# Free up any input devices associated with audio on the PCI bus.
# *IMPORTANT* This will disable your PC's mainboard PCI audio
# (because we can only unbind the whole PCI device)
# This will enable 13 or so USB terminals per server
# Comment out the line with a "#" if you'd like PCI audio to work
#
SUBSYSTEM=="pci", ATTR{class}=="0x040300", RUN="/bin/sh -c 'echo $kernel > /sys/$devpath/driver/unbind'"

# 
# Free up any ACPI (system power) buttons. 
# *IMPORTANT* This will disable all built-in buttons on your PC (e.g. power)
# You will need to shut down, etc. from the Linux UI with administrative rights.
# This has the side-effect of making your PC slightly more secure against student tampering.
# Comment out the line with a "#" if you'd like these to work
# This will enable an extra USB terminal or so per server
# If you have no other event devices, other than the USB terminals, should get to 16 terminals.
#
SUBSYSTEM=="acpi", DRIVER=="button", RUN="/bin/sh -c 'echo $kernel > /sys/$devpath/driver/unbind'"

After creating that udev rule and rebooting, things look much more favorable in terms of evdev slots. Only the “real” USB keyboards and mice are left to consume slots:

    ATTRS{name}=="SIGMACHIP Usb Mouse"
device node not found
device node not found
    ATTRS{name}=="Dell Dell USB Keyboard"
    ATTRS{name}=="USB Optical Mouse"
    ATTRS{name}=="USB Optical Mouse"
    ATTRS{name}=="Dell Dell USB Keyboard"
    ATTRS{name}=="GASIA USB KB V11"
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found
device node not found

There are now enough free slots for 16 USB terminals (or, more specifically, their keyboards and mice).

Hopefully this is just a temporary workaround, until someone tackles the task of lifting the kernel’s limit of 32 evdev devices. That’s a very constraining limit for a whole host of reasons.

Note that one of the remaining bugs in Fedora 17 is that random USB terminals often come up to a green screen, requiring an unplug/replug to get a login. These scripts may increase the frequency of that if you have a lot of terminals, as the system bounces against the 32 device limit, then returns below it as the udev rules execute.

Hopefully in future versions of Fedora / systemd, those race conditions will be closed.

Hope you enjoy turning your one Fedora 17 PC into many. Please comment if you have any problems applying, we’ll try to help. See also our post on some huge Fedora 17 performance optimizations for USB multiseat which greatly improve the default experience.

And if you’re running more than 8 terminals with Fedora 17, please post a comment – we’d love to hear about it!
[ud-160-m-post]

Dconf configuration: GNOME 3 Fallback Mode

The Linux GNOME 3 UI assumes you have a beefy 3D GPU and capable driver, which can cause problems when that isn’t the case.

Individual GNOME 3 users can fix this by setting their desktop experience to GNOME 3 “fallback mode” which can avoid the 3D compute burden. Fallback mode is an essential setting for older PCs, VMs, USB graphics, remote desktop, etc. It also provides the (arguably) more familiar GNOME 2 like experience (Applications / Places menus, desktop icons, etc.)

It’s possible to configure fallback mode for all users, plus the login screens, centrally by changing some dconf settings. Here’s how:

First, if you don’t already have a “user” profile, then we create one — specifying a new settings database we’ll call “fallback”. Create a file /etc/dconf/profile/user (as su / sudo) which contains these two lines:

user
fallback

Then we’ll create the settings directories for that new database

sudo mkdir /etc/dconf/db/fallback.d
sudo mkdir /etc/dconf/db/fallback.d/locks

Create a settings file to also use fallback once users are logged in. Create a file called /etc/dconf/db/fallback.d/60-user-fallback with:

[org/gnome/desktop/session]
session-name='gnome-fallback'

[org/gnome/desktop/background]
show-desktop-icons = true

# This one is useful more for automatic USB multiseat
[org/gnome/desktop/lockdown]
disable-user-switching = true

And, finally, create a settings file to have login screens themselves use fallback mode. Create a file /etc/dconf/db/gdm.d/60-login-fallback with:

[org/gnome/desktop/session]
session-name='gdm-fallback'

dconf is a binary settings database (very un-unix like), so for any of these changes to take effect, you must run

sudo dconf update

Which will update the binary blobs which are then queried by GNOME to apply these settings. See the dconf admin guide for more.

And that should do it. You should see the fallback look and feel (more like GNOME 2). And if you’re running in a VM, with USB multiseat, or anywhere you don’t access to a beefy 3D processor — you should see a big drop in CPU usage.

Again, these directions have only been tested on Fedora 17. Please feel free to comment on changes (if any) to apply them for other distros.

Plugable USB 2.0 Multiseat Zero Client for Windows Multipoint Server and Fedora Linux (DisplayLink D... Product Details
$79.00

New Distros and Linux Automatic USB Multiseat Support

OpenSUSE and ArchLinux appear to be making good progress on integrating the latest version of systemd, which is a central element of Linux’s new Automatic USB multiseat support — letting you turn one machine into many with plug and play USB terminals.

Since this is all open source, we expect the porting process will happen in time.

For now, the best bet is the distro under which support was first developed — Fedora 17 and later. On Fedora, any supported USB terminal (like those on the right), will automatically pop up a fresh login when plugged in, no software install or licenses needed.

Plugable DC-125 USB 2.0 Multiseat Zero Client for Windows Multipoint Server and Fedora Linux (VGA up... Product Details
$64.95

DisplayLink USB Devices on Linux Kernel 3.4.0

Linux kernel 3.4.0 is the first to include a new driver for DisplayLink-based USB 2.0 devices, called “udl”. udl is a port of the udlfb driver to Linux’s DRM architecture. David Airlie is doing this work, and the potential is very exciting. Eventually, this architecture will lead to a host of advantages, including GPU-accelerated 3D rendering to USB graphics adapters.

Both the new “udl”, and older “udlfb” framebuffer driver that we maintain are present in 3.4.0. Unfortunately, the new udl DRM driver is still maturing, and can cause kernel panics. With USB graphics devices present, you can determine which driver (“udlfb” or “udl”) is getting loaded with lsmod:

lsmod | grep "udl"

This change has a particular impact with Fedora 17 — the first open source distro to have automatic USB multiseat support — which shipped with Linux kernel 3.3.

Post-ship, Fedora 17 now offers a software update to kernel 3.4.0, which unfortunately causes problems: udl may be loaded for DisplayLink-based devices, and kernel panics are common and terminals often won’t come up. To the user, it appears to break multiseat.

So to fix the issues you’ll see with 3.4.0, we recommend disabling udl for the time being. The stable udlfb driver is still present in the kernel, and will get matched against your hardware automatically once udl is no longer loaded. The easiest way to do this is to run the following commands and reboot:

echo "blacklist udl" | sudo tee --append /etc/modprobe.d/udlfb.conf
sudo depmod -a
sudo dracut -f /boot/initramfs-$(uname -r).img $(uname -r)

One the server reboots, udlfb should match all USB graphics devices and be fully stable. Please let us know if you have any trouble. And in coming Linux kernel versions, udl will continue to improve and at some point udlfb will be able to be retired in favor of it.

Plugable DC-125 USB 2.0 Multiseat Zero Client for Windows Multipoint Server and Fedora Linux (VGA up... Product Details
$64.95

Fedora 17′s Secret Turbo Boost Button

Fedora 17′s out-of-the-box plug and play USB multiseat is awesome for sharing one system with many users — but there’s a way to dramatically boost performance and scalability, by changing the Fedora defaults.

Background

Fedora 17 continues to default to GNOME 3, which assumes the presence of powerful 3D hardware.

If that’s not the case (e.g. in a VM, or with Fedora 17′s new automatic USB multiseat functionality), then Fedora 17 defaults to llvmpipe based software 3D, which is software to make full use of your CPU to do all the work there.

That’s great on a fast CPU with multiple cores (Core i3 class and up), but it brings lesser processors to their knees. Users can unnecessarily perceive Linux as slow and unusable. On a USB multiseat system, where you don’t have a 3D GPU and so are using llvmpipe, the load can be unacceptable even for a single user on a Core 2 class system. But by going to GNOME 3 “fall back mode” (which depends less on 3D composting for eye candy), having 5-6 users even on a dual core Atom system is no problem. It’s a dramatic performance difference.

You can tell if Fedora 17 is running llvmpipe by opening “System Settings”, and then “Details”

Then click on the “Graphics” tab. If it shows a driver of Gallium on llvmpipe, and “Standard” experience, then you’re in this mode where you’ll see high CPU usage at all times (even when no graphics appear to be changing!) because of GNOME 3′s 3D effects.

How to boost performance

But by hitting the “Forced Fallback Mode” switch to on, you can drop the GNOME 3 UI, enormously reduce your CPU load, and get a user experience that’s closer to what people are used to (more GNOME 2 like — has a task bar, potential for desktop icons, etc.). Maybe they should have renamed the setting …

On a Fedora 17 system with a bunch of USB thin clients attached, you can gain a ton of performance by making this change. But you’ll likely want to make this change in dconf configuration (so it also applies to the login screens). For that, read the follow-up post on configuring all users for GNOME 3 fallback.

Plugable DC-125 USB 2.0 Multiseat Zero Client for Windows Multipoint Server and Fedora Linux (VGA up... Product Details
$64.95
ud-160-a_128

Plugable UD-160-M USB Thin Client for Multiseat Linux and Windows Multipoint Server

The Plugable UD-160-M turns one computer into many, so a single computer can serve a whole class, family, or small office (one USB thin client required per simultaneous user). Each person gets their own display, keyboard, and mouse and completely independent login, desktop, and applications. The up-front and ongoing savings of time and money are significant — You’re only paying for one machine. Powering one. Maintaining one. Only having to upgrade one.

Students using USB Thin Clients and Microsoft Windows Multipoint Server 2011. Photo copyright Microsoft Inc

Features

  • Enables many users to share a single computer – up to 14 thin clients for Windows; 7 for Linux
  • Connects via USB 2.0 (not via network), so it’s fully plug and play, low power, and low latency
  • Works with Windows Multipoint Server 2012, 2011, certain Linux distros such as Fedora 17 or later, or USB multiseat Linux 2011 or later
  • Requires one VGI or DVI monitor and USB keyboard and mouse for each thin client (not included)
  • Built-in connectors for DVI/VGA monitor up to 1920×1080, 3.5 mm audio for headset, and 4 powered USB ports

Required Software

Works with Windows Multipoint Server 2011 and 2012 or a supported version of multiseat Linux. Current supported versions of Linux include Featora 17, 18, 19, and 20. These operating systems automatically detect that a Plugable UD-160-M has been connected via USB 2.0, and pop up an additional login screen on the new monitor.

Windows Multipoint Server 2012 enables a new plug-in model for USB zero clients. The driver for this Plugable device (install in console mode) is available here:
WSM2012 Plugable USB Terminal Driver.

Then reboot into normal mode, and your Plugable USB terminals will all pop up fresh login screens.

Fedora 17 and 18 works out of the box for the default, standard “GNOME Desktop” build. See http://fedoraproject.org/ for more.

Required Hardware

Requires one VGI or DVI monitor and USB keyboard and mouse for each thin client (not included). Recommended hardware for server is a Core i3/i5/i7 class CPU or better and 4GB RAM or better, for 4-5 thin clients per server. Must connect with server via USB 2.0 (ethernet is not supported).

In the box

Plugable UD-160-M docking station / thin client main unit, desktop stand, USB 2.0 cable, 2.5A AC power adapter for U.S.-style electrical outlets, and DVI to VGA passive adapter.

Using the included DVI to VGA adapter

plugable-vga-dvi

Get to know what’s inside

A useful aspect of an all-USB dock like this is the drivers for each function can be updated independently. So what are the actual chips inside your Plugable UD-160-M USB Thin Client?

  • Terminus Technology USB Hub Chip
  • DisplayLink DL-165 USB Graphics Chip
  • C-Media CM6300 USB Audio Chip (supporting the USB Audio Class 1.0 standard)
  • ASIX AX88772A USB Ethernet Chip

All of these chipsets have drivers supported by recent Linux kernel versions (kernel 3.2 and later).

Use as a Universal Laptop Docking Station

This same hardware works as a Universal Laptop Docking Station with any brand of Windows laptop / notebook. See the Plugable UD-160-A for the variation of this package designed for this scenario.

Frequently Asked Questions

Will the AC power adapter for the UD-160-M work in my country?

We currently offer the product with US version plugs (Plugable UD-160-M) and UK/EU version (Plugable UD-160-MEU). The AC power adapter on both versions is able to handle a range of input voltages for most regions of the world. The adapter is rated for AC inputs of 100-240V / 50-60Hz. It outputs USB power of 5V 2.5A. So with a passive adapter (for the pins/prongs) the UD-160-A  or UD-160-AEU can be used in most/all geographies.

Replacements for the US power adapter can be bought here.

What do the blue LED and the green LED on the Plugable UD-160-M indicate?

The blue LED indicates that the Plugable UD-160-M is being powered by its power adapter. The green LED lights up and stays steady when a  device is connected through any of the four USB ports on the dock.

 

Where to Buy

Plugable USB 2.0 Multiseat Zero Client for Windows Multipoint Server and Fedora Linux (DisplayLink D... Product Details
$79.00

Fedora 17 USB Multiseat Compatible Hardware

[Update 5/28/2012 Fedora 17 has been released and supports the Plugable DC-125 and UD-160-M/A out of the box! Download the iso image here. And the steps below have been updated to reflect all the fixes in F17 final.]

The Plugable $50 thin client KickStarter project is growing.

But we need early adopters so we have people using the solution, finding and fixing problems, and helping to spread the word. What we deliver now might not include some KickStarter extras and will be higher priced than through the KickStarter project, but it will include all the components and will work with Fedora 17 Beta.

Hardware

Interested in getting your hardware now? If you’re in the USA, here’s what will work with Fedora 17 Beta:

UD-160-M USB Thin Client
DC-125 USB 2.0 Docking Station / Zero Client

International Shipping Options

Both the DC-125 and UD-160-M may also be ordered from our Plugable International Shipping Store with $16.95 via USPS Flat Rate Priority shipping from the USA.

If you’ve never ordered and had an item shipped from the USA before via the US Postal Service, please research the rules in your country. We declare the actual value of all items, so in some countries customs and/or VAT taxes are collected, and all of those are paid by the recipient once the items arrive in country. And also note that while every shipment will have a tracking number, the tracking is generally poor once the item has left the USA.

Software

You can download Fedora 17 here. The default download (GNOME Desktop) and spins derived from it support automatic USB multiseat. KDE and other spins do not.

Install F17 to the hard drive of an available machine. For 3-4 thin clients, you can use a spare older machine – we’d recommend a minimum machine with 2GB RAM and 2 cores or 2 GHz or more. For best performance, use an Core i3/i5 class processor with at least 4GB of DDR3 RAM or more.

Any recent Plugable UD-160-A/M or DC-125 thin client you plug in should automatically pop up a new login.

Comment here or email support@plugable.com if you have any trouble at all – we’d be happy to help! And thanks in advance to the early users who help find issues and spread the word about how cool this technology can be!

[ud-160-m-post]

Setting up USB multiseat with DisplayLink on Linux (GDM up to 2.20)

Four $99 UD-160-A Terminals off a single $299 netbookSoon, we’ll be able to plug inexpensive zero-state USB docks/terminals into new Linux systems, and a new graphical login will pop up in a completely plug and play fashion. Many users can then simultaneously share any single Linux PC. This is great for education, libraries, internet cafes, etc — anywhere where you have clusters of client machines with light 3D/video app demands, and want the simplicity and savings of just one server machine with many terminals connected.

[Update August 8, 2010 - Further work on this has moved to the Google Summer of Code 2010 project for USB Multiseat]

Until this is in the distros, we have to assemble a few pieces ourselves to get everything installed for this scenario. Some major components (GDM/ConsoleKit) are changing the way this kind of thing will be done, so for now the instructions here are designed only for distributions with GDM 2.20 or earlier (Ubuntu < 9.10; Fedora < F12; Debian < 5.0; etc). The instructions have been tested most extensively on Ubuntu 9.04.

gdm –version

will show what version you have on your current system. Any tweaks to make things work with your specific distro are definitely welcome in the comments.

The first step is hardware. You need a USB hub with a DisplayLink USB device and free USB ports for keyboard and mouse. You can get this in one package in the form of devices like the Plugable DC-125, or buy independent USB devices like the UGA-125 combined with any USB hub. USB Audio and other devices can be made to work also, but these instructions just cover basic display, keyboard, and mouse.

With that, you're ready to start configuring your Linux setup ...

1. DisplayLink framebuffer driver

udlfb is in the staging tree of Linux kernels 2.6.32 and later. We'll install the latest version here. First, make sure you have git installed with "sudo apt-get install git-core", and create a directory which will host all the source code you download with git (e.g. ~/git/).

sudo apt-get install module-assistant
sudo module-assistant prepare
git clone http://git.plugable.com/webdav/udlfb/
cd udlfb
make
sudo make install
sudo depmod -a

Now, when you plug in a DisplayLink device, you should see a "green screen" as the driver successfully loads and sets the graphics mode to match your monitor.

2. DisplayLink X server

This will get the X server installed, ready for use by later scripts.

sudo apt-get install pkg-config xorg-dev
cd ~git
git clone http://git.plugable.com/webdav/xf-video-udlfb/
cd xf-video-udlfb
./configure
make
sudo make install

We now need to create or modify a few scripts and configuration files. You'll need to use sudo to edit files in these system directories. You can cut/paste the text below, or download the files with "git clone http://git.plugable.com/webdav/misc-udlfb/" and copy each to the right location, and fix up ownership and permissions on the files.

3. udev script

Create a file called /lib/udev/rules.d/50-usbseat.rules owned by user root, with the following contents.

# set all DisplayLink devices to configuration 1
# see http://libdlo.freedesktop.org/wiki/DeviceQuirks for more info
ATTR{idVendor}=="17e9", ATTR{bConfigurationValue}=="2", RUN="/bin/echo 1 > /sys%p/bConfigurationValue"

# aliases for display, kbd, mouse attached to specific hubs

KERNEL=="fb*",SUBSYSTEMS=="usb",PROGRAM="/bin/cat /sys/%p/../../../devnum",SYMLINK+="usbseat/%c/display",RUN+="usbseat.sh %c"
KERNEL=="mouse*", SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", PROGRAM="/bin/cat /sys/%p/../../../../../devnum",SYMLINK+="usbseat/%c/mouse",RUN+="usbseat.sh %c"
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01",PROGRAM="/bin/cat /sys/%p/../../../../../devnum",SYMLINK+="usbseat/%c/keyboard",RUN+="usbseat.sh %c"
KERNEL=="control*", SUBSYSTEM=="sound", SUBSYSTEMS=="usb", PROGRAM="/bin/cat /sys/%p/../../../../../devnum", SYMLINK+="usbseat/%c/sound"

# Handle when keyboard and mouse are one more hub downstream. Relying on pnp order to have already set up mouse, keyboard on upstream hub if we're daisy-chaining
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01",PROGRAM="/bin/cat /sys/%p/../../../../../../devnum",SYMLINK+="usbseat/%c/keyboard",RUN+="usbseat.sh %c"
KERNEL=="mouse*", SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", PROGRAM="/bin/cat /sys/%p/../../../../../../devnum",SYMLINK+="usbseat/%c/mouse",RUN+="usbseat.sh %c"

The udev subsystem will run this script automatically each time a USB device is attached.

4. usbseat.sh script

Create a file /lib/udev/usbseat.sh owned by user root with the following contents. Make sure to "sudo chmod a+x" to make the file executable.

#!/bin/bash
# takes the "seat number" as parameter $1
# the seat number is the kernel device id of the hub the seat's devices are sitting off of
# called once for every usb device that MIGHT be part of a seat, when they arrive or remove 

if [[ !(-n `/bin/pidof gdm`) ]]; then
    exit 0
fi

seat_running=`/usr/bin/gdmdynamic -l | /bin/sed -n -e "/:$1,/p"`

# $ACTION environment variable is set by udev subsystem
case "$ACTION" in
	'remove')
		if [[ -n "{$seat_running}" ]]; then
			/usr/bin/gdmdynamic -v -d $1
		fi
		;;
	*)
                # A device which might be part of a seat has been added

		# if we already have a running seat for this #, exit
		if [[ -n "${seat_running}" ]]; then
			exit 0
		fi

		if [[ -e /dev/usbseat/$1/keyboard && -e /dev/usbseat/$1/mouse && -e /dev/usbseat/$1/display ]]; then

			# We have a newly complete seat. Start it.
			TMPFILE=`/bin/mktemp` || exit 1
			/bin/sed "s/%ID_SEAT%/$1/g" < /lib/udev/usbseat-xf86.conf.sed > $TMPFILE
			/usr/bin/gdmdynamic -v -t 2 -s 1 -a "$1=/usr/X11R6/bin/X -br :$1 -audit 0 -nolisten tcp vt07 -config $TMPFILE"
			/usr/bin/gdmdynamic -v -r $1
		fi
		;;
esac

exit 0

5. X config file

Create file /lib/udev/usbseat-xf86.conf.sed with contents


Section "ServerFlags"
	Option	"AutoEnableDevices"	"false"
	Option	"AutoAddDevices"	"false"
	Option  "DefaultLayout"		"seat"
	Option	"DontZoom"		"true"
	Option	"DontZap"		"true"
	Option	"AllowMouseOpenFail"	"yes"
EndSection

Section "Module"
	Load "ddc"
EndSection

Section "Files"                                                                                                              
    ModulePath      "/usr/lib/xorg/modules"
    ModulePath      "/usr/local/lib/xorg/modules"
EndSection

Section "Device"
	Identifier "dl"
	driver	   "displaylink"
	Option "fbdev"	"/dev/usbseat/%ID_SEAT%/display"
EndSection

Section "InputDevice"
	Identifier "keyboard"
	Driver	"evdev"
	Option	"CoreKeyboard"
	Option	"Device"	"/dev/usbseat/%ID_SEAT%/keyboard"
	Option	"XkbModel"	"evdev"
	Option	"XkbLayout"	"us"
EndSection

Section "InputDevice"
	Identifier "mouse"
	Driver	"mouse"
	Option	"CorePointer"
	Option	"Protocol" "ImPS/2"
	Option	"Device"	"/dev/usbseat/%ID_SEAT%/mouse"
        Option  "Buttons" "5"
	Option	"ZAxisMapping" "4 5"
EndSection

Section "Monitor"
	Identifier "monitor"
EndSection

Section "Screen"
	Identifier "screen"
	Device "dl"
	Monitor "monitor"
EndSection

Section "ServerLayout"
	Identifier "seat"
	Screen	0 "screen" 0 0 
	InputDevice "keyboard" "CoreKeyboard"
	InputDevice "mouse" "CorePointer"
EndSection

6. fbcon workaround

[update: this step is no longer needed with the latest udlfb from git or in kernels 2.6.37+]

fbcon is a standard Linux kernel module, which aggressively assumes it can open any framebuffer device and take it over for use as a text terminal. Unfortunately, that's not what we want if we're going to be using that framebuffer to run its own X server. So we need to add a file /etc/modprobe.d/fbcon.conf to disable fbcon and leave our framebuffers free for other uses.

blacklist font
blacklist tileblit
blacklist bitblit
blacklist fbcon

This file will not take effect until you run

sudo update-initramfs -u

Now, when you reboot and run "lsmod" you should not see fbcon in the loaded modules. And in /sys/class/graphics you should see fb0, instead of fbcon.

7. xrandr workaround

[update: this workaround is not needed when running xf86-video-fbdev or with recent displaylink X servers with this patch]

The DisplayLink X server currently has limited RANDR support, but later versions of GDM assume better. So for the time being, a workaround is required to get GDM applications (including gdmlogin) to display properly within the actual screen area -- otherwise they tend to think the screen has a strange rotation, and display themselves completely off it.

Add these lines into /etc/gdm/Init/Default, right after the definition of gdmwhich()

XRANDR=`gdmwhich xrandr`
if [ "x$XRANDR" != "x" ]; then
  $XRANDR -o 0
fi

8. /etc/rc.local script

Add the following lines to your /etc/rc.local script to check for attached usb terminals that were attached (at boot), and udev found them before GDM was running.

oldIFS=$IFS
IFS=/
for seat in /dev/usbseat/*; do
	set $seat
	/lib/udev/usbseat.sh $4
done
IFS=$oldIFS

9. /etc/init.d/gdm patch

In recent versions of X, the system largely assumes that you'll only run one X server, and it will own all devices. So to support multiseat with multiple X servers easily, we need to have two configurations: normal (using only your primary graphics), and multiseat (where your primary graphics isn't used). We do this by detecting whether you have a USB terminal attached and configured, and if so coming up with a different gdm configuration.

Add these lines to your /etc/init.d/gdm script, just after the section to "Allow cdd to override the config" (around line 35).

# Allow usbseat to override the config
if [ -f /etc/gdm/gdm-usbseat.conf ]; then
	for usbseat in /dev/usbseat/*; do
		seatid=${usbseat##*/}
		if [ -e "/dev/usbseat/$seatid/keyboard" -a -e "/dev/usbseat/$seatid/mouse" -a -e "/dev/usbseat/$seatid/display" ]; then
			CONFIG_FILE="--config=/etc/gdm/gdm-usbseat.conf"
		fi
	done
fi

10. Create /etc/gdm/gdm-usbseat.conf

This is the alternative gdm.conf that will be used when a USB terminal is present at boot:

[daemon]
DynamicXServers=true
FlexibleXServers=0
Greeter=/usr/lib/gdm/gdmgreeter

[security]

[xdmcp]

[gui]

[greeter]

[chooser]

[debug]

[servers]
0=inactive

Now, when you boot with USB terminal(s) attached, graphical logins will come up on all of those, while your primary display will remain a text console.

usb multiseat with Edubuntu

See my video from Linux Plumbers 2009 for more thoughts and background on USB multiseat.

Unsolved Problems

Beyond reworking for the new GDM/ConsoleKit versions, and getting all this just "built in" to the distributions, there are at least several major problems yet:

input duplication

[Update Feb 19, 2010 - fixed by removing "-sharevts -novtswitch" from the X start line and substituting a specific vt "vt07". Listing above now has problem resolved]

Input to any of the terminals will be duplicated to your primary console. This has a bunch of very nasty effects, including often duplicating your login to both your session and the console, and possibly causing strange effects like ctrl-c within any terminal will often cause that whole X session to close. This seems to be http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=525736, which at the bottom reports a workaround involving faketty, which unfortunately didn't work for me. You can also see a short discussion of this bug at https://fedorahosted.org/pipermail/multiseat/2009-April/date.html There ought to be a simple solution here -- any comments on that welcome.

mouse scroll wheel doesn't work

[Update Feb 19, 2010 - fixed by changing Protocol from "auto" to "ImPS/2" in the xorg.conf]

This is a problem with some other ways of doing multiseat: https://fedorahosted.org/pipermail/multiseat/2009-February/000004.html Again, probably a small tweak might resolve this.

unplug terminal doesn't tear down (or reconnect)
Currently, when you physically disconnect a terminal, everything remains running. By default, each user can only be logged in once, which means that you must do gdmdynamic -l to find the zombie instance and sudo gdmdynamic -d $seat to kill it. But the behavior users would really like to see is disconnecting the terminal leaves all apps running, but logging in from that terminal (or any other) reconnects and just transparently starts where the user left off.

Comments on other distros (e.g. yum vs. apt-get), better solutions, and other problems are very much appreciated.