summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorARAMIS STACH HAIDUSKI FERNANDES <aramis@guinness.c3sl.ufpr.br>2008-08-25 17:15:46 -0300
committerARAMIS STACH HAIDUSKI FERNANDES <aramis@guinness.c3sl.ufpr.br>2008-08-25 17:15:46 -0300
commitbecd05916369726ed4fc1e23e83504e9d9f0c6b0 (patch)
treeecec565ae1a2ef4a2ef4b742b4668d3a0f73e507
parentf9638c8174d51583210ead48371e435d2cb65023 (diff)
Loop alteration, using information given by xrandr to set new functionality,
that is, openning two different heads in an only video card.
-rwxr-xr-xmdm/src/mdm-bin42
1 files changed, 25 insertions, 17 deletions
diff --git a/mdm/src/mdm-bin b/mdm/src/mdm-bin
index 449cb65..8bf2c44 100755
--- a/mdm/src/mdm-bin
+++ b/mdm/src/mdm-bin
@@ -25,10 +25,10 @@
MDM_PREFIX=/
MDM_SCRIPTS=${MDM_PREFIX}/usr/sbin
MDM_INCLUDE=${MDM_SCRIPTS}/mdm-common
+
source $MDM_INCLUDE
MY_LOG=${MDM_LOGS}/mdm.log
-MDM_LOCK_FILE=/var/lock/mdm.lock
CREATE_XORG_CONF=${MDM_SCRIPTS}/create-xorg-conf
START_SEAT=${MDM_SCRIPTS}/mdm-start-seat
@@ -38,17 +38,11 @@ function exec_start() {
log --log-file-only "Multiseat Display Manager version $MDM_VERSION"
log --log-file-only "Today is `date`."
- if [ -f "$MDM_LOCK_FILE" ]; then
- log --log-file-only "Error: mdm is already running"
- exit 1
- else
- touch $MDM_LOCK_FILE
- fi
-
# /var/run is re-created at every reboot
- mkdir -p ${MDM_RUN}
+ mkdir -p $MDM_RUN
if ([ "$RECREATE_XORG_CONF" = 'yes' ] || [ ! -f "$MDM_XORG_CONF" ]); then
+ rm -f $XRANDR_INFO 2>/dev/null
$CREATE_XORG_CONF
fi
@@ -88,14 +82,30 @@ function exec_start() {
for ((i = 0; i < $SEATS; i++)); do
export DISPLAY=:0.$i
-
+ xrandr_layout
+ xrandr_resolutions
+ done
+
+ # Finding how many screens on each card
+ SEATS_ON_CARD=(`grep "SCREEN_AMOUNT" $XRANDR_INFO | cut -d'=' -f2`)
+
+ for ((i = 0; i < $SEATS; i++)); do
+ export DISPLAY=:0.$i
# display :0.$i must press key $(i+1)
log --log-file-only "Starting seat $((i+1))"
- START_SEAT_LOG="${MDM_LOGS}/mdm-start-seat.$((i+1)).log"
- rotate_log ${START_SEAT_LOG}
- ${START_SEAT} $((i+1)) &> ${START_SEAT_LOG} &
- PID=$!
- echo $PID > ${MDM_PIDS}/start-seat.$((i+1)).pid
+ START_SEAT_LOG="${MDM_LOGS}/mdm-start-seat.$((i+1))"
+ rotate_log $START_SEAT_LOG
+
+ # The $START_SEAT has 2 parameters: the first is the card
+ # on which the second is being waken.
+ # The second is the seat number to be openned.
+ # Remember: we can have N seats on a card with N outputs
+ for (( seat=0; seat < "${SEATS_ON_CARD[i]}"; seat++)); do
+ $START_SEAT $((i+1)) $((i+1+seat)) &>\
+ ${START_SEAT_LOG}-$((i+1+seat)).log &
+ PID=$!
+ echo $PID > ${MDM_PIDS}/start-seat.$((i+1+seat)).pid
+ done
done
fi
}
@@ -108,8 +118,6 @@ function exec_stop() {
kill `cat $i` 2> /dev/null
rm -f $i
done
-
- rm -f $MDM_LOCK_FILE
}
function exec_reconfigure() {