Monday, February 23, 2009

Multiseat for Dual headed(Multiple headed) grapic (VGA) version-0.3

Here I have modified Multiseat setup for Dual-Headed graphic cards which will be now supports more seats!(tested for four seats). Please refer earlier post for more information on how to setup

/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.

LOG=/var/log/duauto.log
SESSION=$(echo $1 | sed s/':'/''/)
SESSION_1=$(expr $SESSION - 2)
SCREEN=""
if [ $SESSION -gt 3 ]
then
export DISPLAY=:1
export XAUTHORITY="/var/lib/gdm/:1.Xauth"
SCREEN="1024x768@0+$(expr 1024 \* $( expr $SESSION_1 - 2))+0"
else
export DISPLAY=:0
export XAUTHORITY="/var/lib/gdm/:0.Xauth"
SCREEN="1024x768@0+$(expr 1024 \* $SESSION_1)+0"
fi
echo $SCREEN >> $LOG
echo $DISPLAY >> $LOG
echo $XAUTHORITY >> $LOG

PARAMS=$@
echo $PARAMS >> $LOG

keyboards=($(ls -l /dev/input/by-path/ | grep -event- | grep kbd | awk -F '../' {'print $2'}))
mouses=($(ls -l /dev/input/by-path/ | grep -event- | grep mouse | awk -F '../' {'print $2'}))
echo $keyboards >> $LOG
echo $mouses >> $LOG
#PARAMS="dpms -switchCmd echo -2button -nozap -br $PARAMS"
PARAMS="dpms -nozap -br $PARAMS"
command="/usr/bin/Xephyr -ac -screen $SCREEN -keybd evdev,,device=/dev/input/${keyboards[$SESSION_1]},xkbrules=xorg,xkbmodel=evdev,xkblayout=us,CoreKeyboard -mouse evdev,,device=/dev/input/${mouses[$SESSION_1]},Emulate3Buttons=true,CorePointer $PARAMS"
echo $command >> $LOG
echo '<<>>' >> $LOG
exec $command



Append following to /etc/gdm/Init/Default before exit 0


WIDTH=1024

export DISPLAY=:0
export XAUTHORITY="/var/lib/gdm/:0.Xauth"
COUNT0=$(xwininfo -root -children -display :0 | grep 'Xephyr' | wc -l)
export DISPLAY=:1
export XAUTHORITY="/var/lib/gdm/:1.Xauth"
COUNT1=$(xwininfo -root -children -display :1 | grep 'Xephyr' | wc -l)
LOG=/var/log/init.log
echo "COUNT0:"$COUNT0 >> $LOG
echo "COUNT1:"$COUNT1 >> $LOG

if [[ $COUNT1 != 0 ]]
then
export DISPLAY=:1
export XAUTHORITY="/var/lib/gdm/:1.Xauth"
echo "DISPLAY:"$DISPLAY >> $LOG
echo "XAUTHORITY:"$XAUTHORITY >> $LOG

XEID=$(xwininfo -root -children -display :1 | grep "Xephyr on :$( expr $COUNT1 + 3)" --max-count=1 | awk '{print $1}')
echo "XEID:"$XEID >> $LOG
SHIFT=$(expr $WIDTH \* $(expr $COUNT1 - 1))
echo "int 1" >> $LOG
echo "SHIFT:"$SHIFT >> $LOG
[[ $XEID != '' ]] && wmctrl -i -r $XEID -e 0,$SHIFT,0,-1,-1

elif [[ $COUNT0 != 0 ]]
then
export DISPLAY=:0
export XAUTHORITY="/var/lib/gdm/:0.Xauth"
echo "DISPLAY:"$DISPLAY >> $LOG
echo "XAUTHORITY:"$XAUTHORITY >> $LOG

XEID=$(xwininfo -root -children -display :0 | grep "Xephyr on :$(expr $COUNT0 + 1)" --max-count=1 | awk '{print $1}')
echo "XEID:"$XEID >> $LOG
SHIFT=$(expr $WIDTH \* $(expr $COUNT0 - 1))
echo "int 2" >> $LOG
echo "SHIFT:"$SHIFT >> $LOG
[[ $XEID != '' ]] && wmctrl -i -r $XEID -e 0,$SHIFT,0,-1,-1
fi

/etc/gdm/gdm.conf:


#
[servers]
0=Xephyr0
1=Xephyr1

2=Xephyr2
3=Xephyr3
4=Xephyr4
5=Xephyr5

[server-Xephyr0]
name=Xephyr0
command=/usr/bin/X -br -dpms -layout layout0 -novtswitch -sharevts
handled=false
flexible=false

[server-Xephyr1]
name=Xephyr1
command=/usr/bin/X -br -dpms -layout layout1 -novtswitch -sharevts
handled=false
flexible=false


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

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

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

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

[greeter]
GraphicalThemes=circles/:debian-moreblue/:happygnome/:happygnome-list
GraphicalThemeRand=true
GraphicalTheme=circles

/etc/X11/xorg.conf:

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 Device0"
Driver "nvidia"
Busid "PCI:17:12:0"
Option "NoInt10" "No"
Option "Twinview" "true"
EndSection

Section "Device"
Identifier "Configured Video Device1"
Driver "nvidia"
Busid "PCI:17:10:0"
Option "NoInt10" "No"
Option "Twinview" "true"
EndSection


Section "Monitor"
Identifier "Configured Monitor0"
EndSection

Section "Monitor"
Identifier "Configured Monitor1"
EndSection


Section "Screen"
Identifier "Default Screen0"
Monitor "Configured Monitor0"
Device "Configured Video Device0"
DefaultDepth 24
Subsection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
Virtual 2048 768
EndSubSection
EndSection

Section "Screen"
Identifier "Default Screen1"
Monitor "Configured Monitor1"
Device "Configured Video Device1"
DefaultDepth 24
Subsection "Display"
Viewport 0 0
Depth 24
Modes "1024x768"
Virtual 2048 768
EndSubSection
EndSection

Section "ServerLayout"
Identifier "layout0"
screen "Default Screen0" 0 0
Inputdevice "Generic Keyboard"
Inputdevice "Configured Mouse"
EndSection

Section "ServerLayout"
Identifier "layout1"
screen "Default Screen1" 0 0
Inputdevice "Generic Keyboard"
Inputdevice "Configured Mouse"
EndSection




Section "ServerFlags"
#Option "DontZap" "true"
#Option "DontVTSwitch" "true"
EndSection


To find Busid for each Graphic card use;
lspci | grep -i vga | awk '{print $1}'

then convert the hex values in to decimal for example:

hexdecimal
11:0c:017:12:0

11 -> 17
0c -> 12
0 -> 0
.~

10 comments:

  1. Laxaman, I have tested with 1 AGP and 1 PCI but the system didnt work,failed with X error "Xephyr cannot open host display. Is it set?" I installed nvidia-glx and the error disappeared but now the system freezes just after GDM loads.Any more solution(s)

    ReplyDelete
  2. Change your LOG variable in both(I have modified):

    /usr/bin/duautomseat
    /etc/gdm/Init/Default

    and send me both logs

    ReplyDelete
  3. I have changed them both to /var/log/ dir but strangely no logs by the name of init.log or duauto.log!

    ReplyDelete
  4. Is it working after restarting?... there is a problem with initialising Graphic cards. Ill send a solution for that one

    ReplyDelete
  5. Create a file named /etc/X11/xorgp.connf with including following content:

    #--------------------8<----------------------
    Section "Device"
    Identifier "Configured Video Device0"
    Driver "nvidia"
    Busid "PCI:17:12:0"
    Option "NoInt10" "No"
    Option "Twinview" "true"
    EndSection

    Section "Device"
    Identifier "Configured Video Device1"
    Driver "nvidia"
    Busid "PCI:17:10:0"
    Option "NoInt10" "No"
    Option "Twinview" "true"
    EndSection


    Section "Monitor"
    Identifier "Configured Monitor0"
    EndSection

    Section "Monitor"
    Identifier "Configured Monitor1"
    EndSection


    Section "Screen"
    Identifier "Default Screen0"
    Monitor "Configured Monitor0"
    Device "Configured Video Device0"
    DefaultDepth 24
    Subsection "Display"
    Viewport 0 0
    Depth 24
    Modes "1024x768"
    Virtual 2048 768
    EndSubSection
    EndSection

    Section "Screen"
    Identifier "Default Screen1"
    Monitor "Configured Monitor1"
    Device "Configured Video Device1"
    DefaultDepth 24
    Subsection "Display"
    Viewport 0 0
    Depth 24
    Modes "1024x768"
    Virtual 2048 768
    EndSubSection
    EndSection

    Section "ServerLayout"
    Identifier "layout"
    screen "Default Screen0" 0 0
    screen "Default Screen1"
    EndSection

    #--------------------8<----------------------


    Create a file with name /etc/init.d/init_vga with including following line:
    #--------------------8<----------------------
    Xorg -config /etc/X11/xorgp.conf -probeonly 2>/dev/null
    #--------------------8<----------------------

    Now use following command(without quotes) to run init_vga at boot time
    #--------------------8<----------------------
    'update-rc.d init_vga start 70 S .'
    #--------------------8<----------------------

    ReplyDelete
  6. You have to replace Busid with yours

    ReplyDelete
  7. Done. But still no success, but atleast this time gdm loads but no X, the system drops to prompt just after gdm loads and none of the keyboards connected respond to any keystrokes.Frankly something is wrong somewhere, if only i know what!

    PS: after creating /etc/init.d/init_vga it has to be made executable: chmod +x /etc/init.d/init_vga otherwise it fails to execute at boot-time!

    ReplyDelete
  8. Hi Laxaman, I think the only solution is to have a script like the one you created for single headed VGAs, since it seems creating xorg.conf manually is a big problem.

    ReplyDelete
  9. Hi Laxaman, am hopeful that the script for multiple dual headed VGAs(generic) is ready, the other solution(s) you gave me have never worked for me.

    Thanks.

    ReplyDelete
  10. Hi Laxaman, it has been long since we communicated.Kindly am still waiting for your automating script(s) for multiple dual-headed VGAs, the ones you published didn't work with more than one VGA card for me.

    Rgds.

    ReplyDelete