Tuesday, October 9, 2012

MultiSeat Linux Setup

MultiSeat Linux Configuration

For the childrens

We built a gaming PC for the kids, thanks to Craigslist.  It's some quad core deal with 2 separate nVidia GPUs... way overkill for Minecraft, but it'd be neat if the two kids could share it.

Here's the setup I use to allow both kids to play Minecraft together on one Linux box with two sets of keyboards, mice, and monitors.  This might also work with a single GPU connected to two monitors, at the cost of video performance.

This is running Linux Mint 13, which is based on Ubuntu 12.04

Most of this is based on other sources on the internet.  But this version has a working mousewheel (which inexplicably gets mapped to separate events than the rest of the 3-button mouse)



MultiSeat X Setup


When building your xorg.conf, use:

less /proc/bus/input/devices

... to identify which devices to use for each separate keyboard and mouse.  Note that these will often shuffle around every time you plug in a new USB device.  If you're less lazy than I, you might set up some udev rules to make them appear as the same device in /dev/input/usb/ each time


And use:

lspci

... to identify your two video card BusIDs .   When you installed the nVidia drivers, this has probably already been handled by nvidia-xconfig or nvidia-settings , though.


/etc/X11/xorg.conf


Section "ServerFlags"
    Option      "DontZap"       "no"
    Option      "AutoAddDevices"        "false"
    Option      "AutoEnableDevices"     "false"
EndSection

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "MouseW0" "SendCoreEvents"
EndSection
Section "ServerLayout"
    Identifier     "Layout1"
    Screen      0  "Screen1" 0 0
    InputDevice    "Keyboard1" "CoreKeyboard"
    InputDevice    "Mouse1" "CorePointer"
    InputDevice    "MouseW1" "SendCoreEvents"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "evdev"
    Option         "Device"     "/dev/input/event2"
EndSection
Section "InputDevice"
    Identifier     "Keyboard1"
    Driver         "evdev"
    Option         "Device"     "/dev/input/event5"
EndSection



Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "evdev"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/mouse0"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
    Identifier     "MouseW0"
    Driver         "evdev"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/event4"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
    Identifier     "Mouse1"
    Driver         "evdev"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/mouse1"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
    Identifier     "MouseW1"
    Driver         "evdev"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/event7"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection


Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Sony CPD-G410R"
    HorizSync       30.0 - 110.0
    VertRefresh     48.0 - 170.0
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "CRT-0"
    HorizSync       28.0 - 55.0
    VertRefresh     43.0 - 72.0
EndSection


Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 560 Ti"
    BusID          "PCI:1:0:0"
EndSection
Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 560 Ti"
    BusID          "PCI:2:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection




/etc/mdm/mdm.conf



[servers]

1=Standard0
2=Standard1


[server-Standard0]
name=Standard0
command=/usr/bin/X -audit 0 -novtswitch -sharevts -layout Layout0
flexible=true

[server-Standard1]
name=Standard1
command=/usr/bin/X -audit 0 -novtswitch -sharevts -layout Layout1
flexible=true



Once everything is set, run
/etc/init.d/mdm restart
... and hope for the best.

This config still doesn't work perfectly for me... I'd often have to log into seat 1 before seat 2 would show up... and then it would complain about X not starting right and would I like to see some logfiles?  But after skipping through those screens, the second head appears and everything works well.


MultiSeat Audio Setup


Finally there's the matter of getting separate audio devices for each user through PulseAudio.  First we need to enable pulseaudio's "system mode" to allow the daemon to run as root and allow multiple users to access it:

/etc/default/pulseaudio

PULSEAUDIO_SYSTEM_START=1


Then make sure each user is part of the "pulse-access" group:

/etc/group

pulse-access:x:120:user1,user2


After rebooting, each user should be able to log in and run

mate-volume-control

In the Output tab, each user can select which audio device to route their audio to.

Running Minecraft

One final note for Minecraft... the server seems to get confused if two clients try to connect from the same IP address and end the stream to one or both of them.  (If the minecraft server is running on localhost, that doesn't seem to be an issue.... or maybe it's because I'm running craftbukkit instead of the stock minecraft 1.3.2 server)  But to connect to another server on the LAN, I had to create an aliased network interface on both the server and the multiseat client so the second minecraft user would connect from a separate IP address.  That seemed to be an adequate workaround.

No comments:

Post a Comment