Friday, January 9, 2009

Multiseat for Dual headed(Multiple headed) grapic (VGA) cards version-0.1

I have tested this method only with Debian lenny and still using without any problem

1) Copy following script to /usr/bin/duautomseat and make it executable with chmod +x /usr/bin/duautomseat

#!/bin/bash
# Copyright (C) 2008 Nayanajit Mahendra Laxaman mail: nmlaxaman@gmail.com

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#input format
#:1 -auth /var/lib/gdm/:1.Xauth -nolisten tcp vt8

LOG=/tmp/duauto.log
export DISPLAY=:0
export XAUTHORITY="/var/lib/gdm/:0.Xauth"
echo $DISPLAY >> $LOG
echo $XAUTHORITY >> $LOG

PARAMS=$@
echo $PARAMS >> $LOG

keyboards=( echo $(ls -l /dev/input/by-path/ | grep -event- | grep kbd | awk -F '../' {'print $2'}) )
mouses=( echo $(ls -l /dev/input/by-path/ | grep -event- | grep mouse | awk -F '../' {'print $2'}) )

pkeyboards=($(ls /dev/input/by-path/ | grep -event- | grep kbd ))
pmouses=($(ls /dev/input/by-path/ | grep -event- | grep mouse ))

keyboards=$pkeyboards
mouses=$pmouses


kbd1=${keyboards[1]}
kbd2=${keyboards[2]}

mouse1=${mouses[1]}
mouse2=${mouses[2]}

screen1="1024x768@0+0+0"
screen2="1024x768@0+1024+0"

ac1=1
ac2=2

#PARAMS="dpms -switchCmd echo -2button -nozap -br $PARAMS"
PARAMS="dpms -nozap -br $PARAMS"

command=

if [[ $1 == :1 ]]; then
command="/usr/bin/Xephyr -ac :$ac1 -screen $screen1 -keybd evdev,,device=/dev/input/$kbd1,xkbrules=xorg,xkbmodel=evdev,xkblayout=us,CoreKeyboard -mouse evdev,,device=/dev/input/$mouse1,Emulate3Buttons=true,CorePointer $PARAMS"
fi

if [[ $1 == :2 ]]; then
command="/usr/bin/Xephyr -ac :$ac2 -screen $screen2 -keybd evdev,,device=/dev/input/$kbd2,xkbrules=xorg,xkbmodel=evdev,xkblayout=us,CoreKeyboard -mouse evdev,,device=/dev/input/$mouse2,Emulate3Buttons=true,CorePointer $PARAMS"
fi

echo $command >> $LOG
echo '<<>>' >> $LOG
exec $command


2) Backup your /etc/gdm/gdm.conf with mv /etc/gdm/gdm.conf /etc/gdm/gdm.conf.bak and create a new will as /etc/gdm/gdm.conf with following content in it

[servers]
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
#default params :1 -auth /var/lib/gdm/:1.Xauth -nolisten tcp vt8
command=/usr/bin/duautomseat
handled=true
flexible=false

[server-Xephyr2]
name=Xephyr2
#default params :2 -auth /var/lib/gdm/:2.Xauth -nolisten tcp vt8
command=/usr/bin/duautomseat
handled=true
flexible=false

[greeter]
#Greeter=/usr/bin/loginduautomseat
GraphicalThemes=circles/:debian-moreblue/:happygnome/:happygnome-list
GraphicalThemeRand=true
GraphicalTheme=circles

3) Install wmctrl and xephyr with apt-get install xserver-xephyr wmctrl and modify /etc/gdm/Init/Default script with appending following code snippets before exit 0 line at the bottom

export DISPLAY=:0
export XAUTHORITY="/var/lib/gdm/:0.Xauth"
XEID=$( xwininfo -root -children -display :0 | grep 'Xephyr on :1' --max-count=1 | awk '{print $1}' )
[[ $XEID != '' ]] && wmctrl -i -r $XEID -e 0,1024,0,-1,-1

4) Configuring /etc/X11/xorg.conf; bellow is my configuration for my nVidia GeForce 6200 graphic card:


Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
EndSection

Section "Device"
Identifier "Configured Video Device"
Driver "nvidia"
Option "Twinview" "true"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1024x768"
Virtual 2048 768
EndSubSection
EndSection

Section "ServerFlags"
Option "DontZap" "true"
# Option "DontVTSwitch" "true"
# Option "HandleSpecialKeys" "Always"
# Option "BlankTime" "0"
# Option "StandbyTime" "0"
# Option "SuspendTime" "0"
# Option "OffTime" "0"
# Option "AllowMouseOpenFail" "true"
EndSection



* Since Screen resolution is hard-corded in duautomseat and /etc/gdm/Init/Deafault code snippets, you have to change them according to your screen resolution.

* Now logout and see...

Cheers !!!

Ref:http://netpatia.blogspot.com/2008/02/multiseat-computer-with-ubuntu-804.html

34 comments:

  1. Is that all, or must i adapt configs from http://netpatia.blogspot.com/2008/02/multiseat-computer-with-ubuntu-804.html

    ReplyDelete
  2. Better see xorg.conf configuration for ati cards in netpatia. Ill put my configuration for nvidia. What you have to do is use one of the options available for your graphic cards such as MergedFB, TwinWiev or Xinerama and expand the display for both monitors. You can also use Virtual options (eg: Virtual 2560 1024)of 'Screen' section in xorg.conf for expanding the display.

    ReplyDelete
  3. Hi laxaman,
    thank's for your answer, but it doesn't run.
    I have two screens, but ist only a mirror.
    Must i have a greeterscript in /etc/gdm/gdm.conf, and must i install xephyr?

    ReplyDelete
  4. Does it work with more than one graphic card.? As in, can it work with say 5 dual headed VGA cards.

    ReplyDelete
  5. 1) You are correct you must install xephyr

    2)Script was written to use with one dual-head graphic card but it is easily possible to modify to work with many cards

    ReplyDelete
  6. Which part of your script should I edit to allow multiple dual-headed graphic cards, kindly modify it so that it works with multiple cards, I will test and let you know how it goes, I will be testing it with debian etch, is that OK.? Or will I be required to use debian lenny.?

    ReplyDelete
  7. First you have to configure xorg.conf to expand your primary X session. then edit /etc/gdm/Init/Default to move each xephyr session to the positions where they should be placed.

    ReplyDelete
  8. I have tested using one dual-headed graphich card but X crashed, error being "Unknown option keybd". Am using debian etch.

    ReplyDelete
  9. correct you should install lenny... sorry I so you have ask that question early

    and for multiple grapic card configuration you should add more xephyr sessions to /etc/gdm/gdm.conf

    ReplyDelete
  10. Thanks, I will get debian lenny and setup using multiple dual headed cards. I will let you know how it goes.I will use ATI cards, will they work with your scripts?

    ReplyDelete
  11. ATI cards should work... but I have not tested yet

    ReplyDelete
  12. OK.If you don't mind kindly create scripts to work with multiple dual headed cards, am willing to test and let you know the outcome.

    ReplyDelete
  13. I have install debian lenny and after following your
    instructions to the letter, X crashed with the following errors:

    GDM: Xserver not found /usr/bin/duautomseat :1 -auth

    Error: Command not be executed!

    Please install the X server or correct GDM configuration and restart

    GDM.gdm[2775]: WARNING: gdm_server_spawn: Xserver not found: /usr/bin/duautomseat :1 -auth /var/lib/gdm/:1.Xauth -nolisten tcp vt8

    Any ideas what i should do next to fix X?

    Rgds.

    ReplyDelete
  14. check whether /usr/bin/duautomseat is executable

    ReplyDelete
  15. It is very executable. chmod +x /usr/bin/duautomseat

    ReplyDelete
  16. I have re-installed debian lenny, but am still getting the same errors, with X crash.

    ReplyDelete
  17. Sorry for late replies... since I'm stuck here with some work.

    please send me your log /tmp/duauto.log and any other information you have

    ReplyDelete
  18. It worked but I had to install nvidia-glx package. My intention is to create a 10 seats system, kindly which parts of your scripts do I edit to enable 10 seats.

    Rgds.

    ReplyDelete
  19. As you can see in /usr/bin/duautomseat; you should add seperate

    kbd%=${keyboards[%]}
    mouse%=${mouses[%]}
    ac1=1

    if [[ $1 == :% ]]; then
    command="/usr/bin/Xephyr -ac :$ac% -screen $screen% -keybd evdev,,device=/dev/input/$kbd%,xkbrules=xorg,xkbmodel=evdev,xkblayout=us,CoreKeyboard -mouse evdev,,device=/dev/input/$mouse%,Emulate3Buttons=true,CorePointer $PARAMS"
    fi

    for each seat here in each place % you should append your seat number

    then in /etc/gdm/Init/Deafault you should grep each Xephyr session and move each session to suitable locatoin with wmctrl

    ReplyDelete
  20. Thanks so much, let me try and let you know how it goes.

    PS: In /etc/gdm/Init/Deafault how do I grep.?

    something like:?

    export DISPLAY=:0
    export XAUTHORITY="/var/lib/gdm/:0.Xauth"
    XEID=$( xwininfo -root -children -display :0 | grep 'Xephyr on :%' --max-count=1 | awk '{print $1}' )
    [[ $XEID != '' ]] && wmctrl -i -r $XEID -e 0,1024,0,-1,-1

    export DISPLAY=:0
    export XAUTHORITY="/var/lib/gdm/:0.Xauth"
    XEID=$( xwininfo -root -children -display :0 | grep 'Xephyr on :%' --max-count=1 | awk '{print $1}' )
    [[ $XEID != '' ]] && wmctrl -i -r $XEID -e 0,1024,0,-1,-1

    etc..

    % being seat number.

    ReplyDelete
  21. In /etc/gdm/Init/Deafault you can do something like searching for last Xephyr session id (which have the maximum number) and for that session find EXID and use that in wmctrl to move to the required location. You may have to design logic and control flow...



    Yes for each seat in gdm.conf you hage to provide
    %=Xephyr%

    and

    [server-Xephyr%]
    name=Xephyr%
    command=/usr/bin/duautomseat
    handled=true
    flexible=false

    section
    ------------

    additionally you have to configure xorg.conf to expand your primary X session to cover all the screens

    ReplyDelete
  22. Since am not a programmer it seems it's going to be harder than I thought. Kindly you don't have some dummy scripts that I can tweak to work in my environment? Am using five(5) dual headed VGAs.?

    ReplyDelete
  23. Don't bother I'll send a script very soon... I'm little busy these days

    ReplyDelete
  24. Thank you so much, I will appreciate so much!

    ReplyDelete
  25. HI Laxaman, I hope the automating script(s) for multiple dual headed VGAs is almost ready for release. What is the time-line for release? Am eagerly waiting.

    ReplyDelete
  26. Sorry for making you wait. I'll make it fast for you. try to release it around next Monday.

    ReplyDelete
  27. Thanks, am very ready to test it and give you the feedback.FYI I will be testing it with five(5) dual headed cards, preferably ATIs.

    ReplyDelete
  28. Hi Laxman,today being monday I hope you will release automating script(s) for multiple dual headed VGAs,as I told you am eagerly waiting.

    ReplyDelete
  29. This comment has been removed by the author.

    ReplyDelete
  30. I have posted it in http://nmlaxaman.blogspot.com/2009/02/multiseat-for-dual-headedmultiple.html

    I would very much like to have your contact information. I don't even know your country

    ReplyDelete
  31. Thanks so much, let me test and get back to you with the feedback, I could send you my contact info to your email, which address do you use?

    ReplyDelete
  32. Hi Laxman, kindly am still waiting for your instructions on what to do next, since your modified script is not working with multiple dual headed VGAs. As I told you it works with only one card!

    ReplyDelete