Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

  1. #1
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

    Lightbulb HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    The purpose of this tutorial is to aid starting a separate X session with a dedicated mouse and keyboard on demand (ie without needing a restart of X nor the computer).

    When finished, you will have launched a new GNOME user session in a nested X window in which one mouse and one keyboard operates independently from the underlying session. The underlying session's mouse and keyboard can control also this 2nd session if necessary.

    This comes in very handy when you have one or more friends over and you'd like to work on the computer on the same time but independently from each other.

    Big thanks to Jori Liesenborgs that wrote Xevdevserver which makes this possible without patching X as well as for writing the original tutorial on how to accomplish multiseat using Xgl !

    Ok, here we go:

    0. Preparations

    Definitions
    The 1st seat - Refers to your ordinary X session - the one you logged in with when starting your computer.
    Multiseat - The virtual seats running in nested windows with a dedicated pair of mouse and keyboard.

    Actual preparations
    We are going to launch the Multiseats in separate windows, so if you want them to appear on a different monitor than the one belonging to the 1st seat - you better first get an extended desktop configuration working. That is beyond the scope of this tutorial, so look into a tutorial on xrandr for this.

    Then, before we continue, be sure to plug in all mice and keyboards that we are going to use. You need at least one pair per multiseat. Usually, only the 1st seat can use the built-in keyboard and touchpad of laptops.

    Lastly preparation-wise - I recommend you to add a second user to your system. I have had bad experiences with gnome panel icons disappearing after logged in with the same user in more than one session.

    1. Get and install the necessary software

    Xgl
    I had problems trying to accomplish this using Xnest, mainly with the cursor not showing in the multiseats. Using Xgl's software cursor, this was no longer a problem. Also, Xgl could provide support for direct rendering for the multiseats (dependant of graphics card - works with ATI cards? - and configuration).

    Install the xserver-xgl package (along with Dbus in case it is not installed) using Synaptic or by running the following in a terminal:
    Code:
    sudo apt-get install xserver-xgl dbus-x11
    Now, you may not want Xgl to be enabled for your original session (at least I don't). To disable Xgl for the current user, execute the following:
    Code:
    mkdir -p ~/.config/xserver-xgl/
    touch ~/.config/xserver-xgl/disable
    Xevdevserver
    The backbone in the multiseat setup is the ability to assign a mouse and keyboard to each multiseat. Jori Liesenborgs has developed Xevdevserver, a program that launches in the background and accomplishes just that. Thanks Jori!

    First, download the tar.gz for XevdevServer from http://research.edm.uhasselt.be/~jor...c.XevdevServer

    Then, install build dependencies:
    Code:
    sudo apt-get install libx11-dev libxtst-dev gizmod libncurses5-dev
    Finally, extract the XevdevServer archive and execute to following in the extracted directory:
    Code:
    ./configure
    make
    sudo make install
    detect-and-assign-multiseat-mouse-and-keyboard.sh

    Previous versions of this guide had a fairly complicated step regarding how to detect and assign a mouse and keyboard to your 2nd seat. This script automates this process.

    Save the following shell-script as "detect-and-assign-multiseat-mouse-and-keyboard.sh"

    Code:
    #!/bin/bash
    # detect-and-assign-multiseat-mouse-and-keyboard.sh
    #
    # Description:
    # Detects a mouse and keyboard and assigns these devices
    # to a target DISPLAY (using xevdevserver)
    #
    # In addition to xevdevserver, you will need "gizmod" installed:
    # sudo apt-get install gizmod
    #
    # Acknowledements and version history:
    # v20080320 - Fredrik Wollsén
    #
    # License GPL v3
    #
    # Feel free to provide feedback on this script here:
    # http://ubuntuforums.org/showthread.php?p=4550796
    #
    # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
    # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
    # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
    # Make sure that gizmod is available
    if [ ! -x `which gizmod` ] ; then
      echo "You need to have gizmod installed for device detection to work";
      echo "Please install gizmod (sudo apt-get install gizmod) and re-run this script";
      exit 1
    fi
    
    TMP_FILE=`mktemp -t gizmod.XXXXXX`
    
    usage() {
      BN=`basename $0`
      echo
      echo "Usage: $BN TARGET_DISPLAY"
      echo "For instance: $BN :1 if the devices are to be assigned to display :1"
    }
    
    if [ "$1" == "" ] ; then
      echo No TARGET_DISPLAY argument was supplied
      usage
      echo
      echo Exiting...
      exit 1
    else 
      TARGET_DISPLAY=$1
    fi
    
    detect_input_device() {
    COUNTER=0
    INPUT_DEVICE=""
    while [  $COUNTER -lt 10 ]; do
      echo \n\n\n\n\n\n\n\n\n\n\n\n > $TMP_FILE
      #echo The counter is $COUNTER
      let COUNTER=COUNTER+1 
      sleep 1
      DEVICE_CANDIDATE=`cat $TMP_FILE | tail -n 10 | grep /dev/input | tail -n 1 | sed -r 's/[^\/]*(\/dev\/input[^ ]*).*/\1/g'`
      if [ -a "$DEVICE_CANDIDATE" ] ; then
      if [ ! -d "$DEVICE_CANDIDATE" ] ; then
        if [ "$DEVICE_CANDIDATE" == "$MOUSE" ] ; then
          echo "The keyboard device cannot be the same as the mouse device... Keep pressing that keyboard"
        else
          INPUT_DEVICE=$DEVICE_CANDIDATE
          COUNTER=1000
        fi
      fi
      fi
    done
    }
    
    no_device_detected() {
      echo "Error: Could not detect any device within 10 seconds. Make sure you connected the device and try to run this script again"
      exit 1
    }
    
    echo "Starting device detection application in background... "
    
    sudo bash -c "gizmod -g > $TMP_FILE &" || exit 1
    
    sleep 2
    
    echo Done.
    
    echo
    echo "Move and/or press a button or two on the mouse that you will use for the 2nd multiseat"
    detect_input_device
    MOUSE=$INPUT_DEVICE;
    
    if [ "$MOUSE" == "" ] ; then
      no_device_detected
    else
      echo "Device detected!"
    fi
    
    echo
    echo "Now for the next few seconds, stroke a couple of keys on the keyboard that you will use for the 2nd multiseat"
    detect_input_device
    KEYBOARD=$INPUT_DEVICE;
    
    if [ "$KEYBOARD" == "" ] ; then
      no_device_detected
    else
      echo "Device detected!"
    fi
    
    echo
    echo -n "Shutting down detection application... "
    sudo killall gizmod -s 9
    
    echo "Done with detection!"
    
    # export KEYBOARD
    # export MOUSE
    
    echo
    echo MOUSE and KEYBOARD variables populated as follows:
    echo MOUSE = $MOUSE
    echo KEYBOARD = $KEYBOARD
    
    echo 
    
    echo -n "Assign these devices to display $TARGET_DISPLAY? [Y/n]"
    read ANS
    if [ ! "$ANS" == "n" ] ; then
      DISPLAY=$TARGET_DISPLAY sudo `which xevdevserver` -fork -d $TARGET_DISPLAY -k $KEYBOARD -m $MOUSE
    fi
    
    echo "Script finished."
    
    exit 0
    Now, put it somewhere in your PATH (eg /usr/local/bin/) and make it executable:

    Code:
    sudo cp detect-and-assign-multiseat-mouse-and-keyboard.sh /usr/local/bin/
    sudo chmod +x /usr/local/bin/detect-and-assign-multiseat-mouse-and-keyboard.sh
    2. Launch that 2nd seat

    First, we start a terminal (gnome-terminal, konsole or similar) in our main seat and set the variables that we will use. Be sure to replace the variables with your own values.

    Code:
    # Any unused X display number...
    export SEAT2_DISPLAY=:1.0
    
    # The username that is to use the 2nd seat
    export SEAT2_USER=louise
    
    # The parameter to decide the geometry of the X window. Tip: Use an empty value here while testing as fullscreen can be hard to get out from!
    export SEAT2_GEOMETRY=-fullscreen
    
    # Launches a GNOME session. I don't know the command to correctly launch KDE atm
    export SEAT2_SESSION="dbus-launch --exit-with-session gnome-session"
    
    # Adjust to your keyboardmap. Use "us" for US keyboards
    export SEAT2_KEYBOARDMAP=se
    
    # Save the current display variable for later use
    export MAIN_DISPLAY=$DISPLAY
    Then, we launch the following ONE-AT-A-TIME:
    Code:
    # Launch the Xgl server in a window
    DISPLAY=$MAIN_DISPLAY sudo /usr/bin/Xgl -dpi 86 -ac -accel glx:pbuffer -accel xv:pbuffer -softcursor $SEAT2_GEOMETRY :1.0 &
    
    # A window with checkers and a cross-symbol for the mouse should display.
    
    # Detect and assign mouse and keyboard:
    detect-and-assign-multiseat-mouse-and-keyboard.sh $SEAT2_DISPLAY
    
    # Now, your designated mouse should only be able to move the mouse within the window
    
    # Switch to the desired user
    sudo su $SEAT2_USER
    
    # Launch the session
    DISPLAY=$SEAT2_DISPLAY exec $SEAT2_SESSION &
    
    # Wait until you are logged in...
    
    # I find the following commands solving some issues with how the keyboard is interpreted - they may or not be needed for your setup. 
    # NOTE: If you experience troubles when issuing these, use a new separate terminal to issue them
    
    # Set keyboard map (which often gets set erreneously) - ignore eventual errors from "The XKEYBOARD keymap compiler". If the keyboard seems stuck on some key, try pressing various keys from all connected keyboards until it stops... hopefully
    setxkbmap $SEAT2_KEYBOARDMAP
    
    # Re-enable Autorepeat (I found it was off after launching the 2nd seat...)
    DISPLAY=$MAIN_DISPLAY xset r on
    DISPLAY=$SEAT2_DISPLAY xset r on
    Now move that X window to an appropriate place on the desktop so that the second user can see it and use it

    After ending your multiseat, you may want to make sure xevdevserver is shut down (to be able to use your devices normally again):
    Code:
    sudo killall xevdevserver
    That should be it! Enjoy your multiseat setup!

    Some last notes
    Even if this tutorial only instruct how to set-up that 2nd multiseat, you can use similar instructions to set up a 3rd and 4th seat etc. The actual amount of useable multiseats you can configure depends on the amount of mouse/keyboard-pairs you have and how many monitors you can connect to your computer (and extend your desktop to) versus how many users are willing to share monitors.

    There are probably many other ways to accomplish this, and most likely ways to do more exotic setups etc. This is merely the result of one man's nightly fiddling that resulted in the above method and have not been tested currently by anyone else that I am aware of. That said - please don't be surprised if this doesn't work for you right away...

    I'd love to hear how this works for you!

    UPDATE 20-mar-2008 13:55: Added a shell script that automates the mouse and keyboard detection and assignment - no need for figuring out the correct device paths any longer: mouse and keyboard is detected by simply moving/pressing buttons/keys on each device.

    UPDATE 27-maj-2008 19:10: Updated guide according to mayeulk's feedback. Thanks!
    Last edited by motin; May 27th, 2008 at 12:00 PM. Reason: Bugfixes + Added fix for re-enabling of autorepeat + Added device detection/assignment shell script

  2. #2
    Join Date
    Nov 2005
    Location
    Uppsala, Sweden
    Beans
    218
    Distro
    Hardy Heron (Ubuntu Development)

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Great guide! IT gives me ideas on how to setup my next home PC so I dont need a specific server and client model.
    (\ /)
    (O.o)
    (> <)

  3. #3
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Quote Originally Posted by it.henrik View Post
    Great guide! IT gives me ideas on how to setup my next home PC so I dont need a specific server and client model.
    Glad you liked it! Don't forget to tell me in case I made some typos or the like.

    Cheers!

  4. #4
    Join Date
    Mar 2005
    Location
    Netherlands
    Beans
    734
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Multiseat is supposed to get easier in hardy due to xorg 7.3 with xephyr and xrandr. Do you know how to setup multiseat properly in hardy?

  5. #5
    Join Date
    Mar 2008
    Beans
    2

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Is it possible to use USB Sound & USB Webcameras for individual terminals??

  6. #6
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Quote Originally Posted by trolldown View Post
    Is it possible to use USB Sound & USB Webcameras for individual terminals??
    I haven't got a clue

    Currently sound is shared between the two users, but routing sound to different outputs may be possible using a sound server such as PulseAudio or JACK. You'd probably be better off starting a new thread for that matter though.

    If Skype is this only concern here, it may also be possible to configure Skype to use a separate pair of USB sound + webcamera for each user...

    Also, currently Xgl seem only to perform well using ATI drivers. On my Intel 915gm (laptop) this second user gets sluggish video and firefox scroll performance. Webcamera usage may be rather CPU-consuming as well.

    Remember that there are other ways to achieve multiterminal set-ups which may be more suited for web café installations. if that's what you are looking for to achieve. This above here is mainly for being able to spontaneously share your computer with a co-worker which has no laptop at hand currently.

  7. #7
    Join Date
    Feb 2008
    Location
    Townsville, Qld Australia
    Beans
    1,065

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    There is an application in the repositories called something userfull that doesn't require XGL and has a nice easy setup eg. Click a button on the mouse infront of this monitor.

    If i remember correctly it did nag you till you registered but registration if free for two seats. I set if up with a nvidia agp card and s3 pci card and it worked great, the only problem being that the users couldn't shutdown easily, but modification to one of the bash scripts fixed that.
    Registered Linux User #464572
    journal.ryanhaigh.net
    www.ryanhaigh.net

  8. #8
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Quote Originally Posted by ryanhaigh View Post
    There is an application in the repositories called something userfull that doesn't require XGL and has a nice easy setup eg. Click a button on the mouse infront of this monitor.

    If i remember correctly it did nag you till you registered but registration if free for two seats. I set if up with a nvidia agp card and s3 pci card and it worked great, the only problem being that the users couldn't shutdown easily, but modification to one of the bash scripts fixed that.
    Gotta keep on par with the competition :
    UPDATE 20-mar-2008 13:55: Added a shell script that automates the mouse and keyboard detection and assignment - no need for figuring out the correct device paths any longer: mouse and keyboard is detected by simply moving/pressing buttons/keys on each device.
    Available in the OP. Enjoy!
    Last edited by motin; March 20th, 2008 at 02:02 PM.

  9. #9
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Quote Originally Posted by UbuWu View Post
    Multiseat is supposed to get easier in hardy due to xorg 7.3 with xephyr and xrandr. Do you know how to setup multiseat properly in hardy?
    Nope. I'll try this out eventually when Hardy is released. In the meantime, feel free to try this method in Hardy and report back how it works out for ya.

    Cheers,

    Fredrik

  10. #10
    Join Date
    Feb 2008
    Location
    Townsville, Qld Australia
    Beans
    1,065

    Re: HOWTO: On-the-fly Multiseat (one computer acting as several physical ones)

    Wow nice work with the quick update! Maybe you could have a look at userful and see if there are any other features you think would be valuable.

    You may also be interested in the HWCursor/SWCursor options for xorg.conf which may mean your setup could operate without XGL. Here is a (slightly old but likely still accurate) site that has a little info on the cursor issue: http://www.x.org/archive/X11R6.8.0/doc/ati5.html

    I noticed that in some of the code you have you say to do one step at a time, could you not automate these steps and make it a script just by using && on the end of each 'one at a time' line?

    Finally you may want to look at/mention checkinstall which replaces the make install line and rather than just installing the software all over the place creates a nice deb and then installs that so that it may be easily uninstalled. I don't think it handles dependency checking or anything but it is still nice to be able to manage the software you have installed from source using the package manager. http://ubuntuforums.org/showthread.php?t=2356
    Registered Linux User #464572
    journal.ryanhaigh.net
    www.ryanhaigh.net

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •