summaryrefslogtreecommitdiffstats
path: root/remote/modules/beamergui
diff options
context:
space:
mode:
authorManuel Schneider2014-04-14 16:23:09 +0200
committerManuel Schneider2014-04-14 16:23:09 +0200
commit82a0d867db3efc4bf0a140ec4fd05d4476e41006 (patch)
tree51ca6b143e6c8af114001c61d7b1cc5540ef5bc4 /remote/modules/beamergui
parent[ubuntu 14.04] WIP: update kdm and systemd conf's (diff)
downloadtm-scripts-82a0d867db3efc4bf0a140ec4fd05d4476e41006.tar.gz
tm-scripts-82a0d867db3efc4bf0a140ec4fd05d4476e41006.tar.xz
tm-scripts-82a0d867db3efc4bf0a140ec4fd05d4476e41006.zip
More debug stuff
Diffstat (limited to 'remote/modules/beamergui')
-rwxr-xr-xremote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter99
1 files changed, 64 insertions, 35 deletions
diff --git a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter
index d29aa2c1..3d45550c 100755
--- a/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter
+++ b/remote/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter
@@ -34,7 +34,7 @@ XRANDRV=$( xrandr --verbose )
################################################################################
echo "$XRANDR"
-echo "$XRANDRV"
+#echo "$XRANDRV"
# Get the names of the connected outputs
# This is a rigid approach to determine the connected outputs
@@ -50,24 +50,14 @@ echo -e "Connected outputs: \e[32m${OUTPUTNAMES[@]}\e[0m"
#Two outputs?
if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
+
+ echo "Two outputs detected."
+
# Either of them a projector?
if ( echo "$XRANDR" | grep -E "^${OUTPUTNAMES[0]}.*0mm x 0mm" > /dev/null \
|| echo "$XRANDR" | grep -E "^${OUTPUTNAMES[1]}.*0mm x 0mm" > /dev/null )
then
- # Create all modes, so that X knows them by name "<width>x<height>"
- for i in "${MODES[@]}"; do
- xrandr --current --newmode $i > /dev/null 2>&1
- done
-
- # Add the modes to the outputs, this means that, if this action is
- # successful they can be applied to the screens.
- for i in "${OUTPUTNAMES[@]}"; do
- for j in "${MODES[@]}"; do
- xrandr --current --addmode $i $(echo $j| awk '{print $1;}')
- done
- done
-
# Check which of the outputs is the beamer.
if [ -n "$(echo "$XRANDR" | grep -E "^${OUTPUTNAMES[0]}.*0mm x 0mm")" ]
then BEAMER=0;
@@ -75,13 +65,33 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
fi
echo "${OUTPUTNAMES[$BEAMER]} is a beamer. "
+ # Create all modes, so that X knows them by name "<width>x<height>"
+ # Add the modes to the outputs, this means that, if this action is
+ # successful they can be applied to the screens.
+ for i in "${MODES[@]}"; do
+ if xrandr --current --newmode $i; then # > /dev/null 2>&1
+ echo -e "Created mode ${i%% *}."
+ else
+ echo -e "\e[31mFailed to create mode ${i%% *}!\e[0m"
+ fi
+
+ for j in "${OUTPUTNAMES[@]}"; do
+ if xrandr --current --addmode $j $(echo $i| awk '{print $1;}'); then
+ echo -e "Added mode ${i%% *} to $j."
+ else
+ echo -e "\e[31mFailed to add mode ${i%% *} to $j!\e[0m"
+ break
+ fi
+ done
+ done
+
# Finally, if the EDID is present, apply a proper resolution.
# Find out whether the beamer transmits reliable EDID data.
# The data in xrandr should be reliable if the EDID is present.
if echo "$XRANDRV" | grep -Pzo \
"^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \
| grep EDID > /dev/null ; then
- echo "EDID present"
+ echo "${OUTPUTNAMES[$BEAMER]} [Beamer] provides EDID."
# If the breamer transmits the EDID there shall be a preferred resolution.
OPTIMALRES=$(echo "$XRANDRV" \
@@ -90,43 +100,62 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then
# Apply the optimal resolution tho either of the outputs. The beamer has
# to be the secondary output.
- xrandr \
+ if xrandr \
--output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode $OPTIMALRES \
--primary \
--output ${OUTPUTNAMES[$BEAMER]} --mode $OPTIMALRES \
- --same-as ${OUTPUTNAMES[$((1-$BEAMER))]}A
- else
- if [[ -f "$CONFIGFILE" ]]; then
- # Try to get a probed mode
- PROBEDMODE=$(cat $CONFIGFILE | awk -F "=" '/132.230.4.156/ {print $2}')
+ --same-as ${OUTPUTNAMES[$((1-$BEAMER))]}
+ then
+ echo "Applied optimal resolution successfully."
+ fi
+
+ elif [[ -f "$CONFIGFILE" ]]; then
+
+ echo "Config file found."
+
+ # Try to get a probed mode
+ PROBEDMODE=$(cat $CONFIGFILE | awk -F "=" '/132.230.4.156/ {print $2}')
- # If a probed mode was found, ..
- if [[ -n "$PROBEDMODE" ]]; then
- # Apply the probed mode from the config file
- xrandr \
- --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode $PROBEDMODE \
- --primary \
- --output ${OUTPUTNAMES[$BEAMER]} --mode $PROBEDMODE \
- --same-as ${OUTPUTNAMES[$((1-$BEAMER))]}
- else
- echo -e "\e[31mNo probed mode found in $CONFIGFILE.\[e0m"
+ # If a probed mode was found, ..
+ if [[ -n "$PROBEDMODE" ]]; then
+ echo "Probed mode found in config file."
+ # Apply the probed mode from the config file
+ if xrandr \
+ --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode $PROBEDMODE \
+ --primary \
+ --output ${OUTPUTNAMES[$BEAMER]} --mode $PROBEDMODE \
+ --same-as ${OUTPUTNAMES[$((1-$BEAMER))]}
+ then
+ echo "Applied probed mode successfully."
fi
else
- echo "\e[31mNo config file found at $CONFIGFILE.\e[0m"
+ echo -e "\e[31mERROR: Beamer provides no EDID and no probed mode given in $CONFIGFILE.\e[0m"
fi
+ else
+ # Apply a fallback mode
+ echo -e "\e[31mERROR: Beamer provides no EDID and no config file found in $CONFIGFILE. Falling back to 1024x768.\e[0m"
+ xrandr \
+ --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode 1024x768 \
+ --primary \
+ --output ${OUTPUTNAMES[$BEAMER]} --mode 1024x768 \
+ --same-as ${OUTPUTNAMES[$((1-$BEAMER))]}
fi
else
- # In case of two monitors just sort the outputa lexicographically and apply
+ # In case of two monitors just sort the outputs lexicographically and apply
# the preffered resolution
+ echo "Dualhead setup deteced. Sorting outputs lexicographically."
readarray -t OUTPUTNAMES \
< <(for a in "${OUTPUTNAMES[@]}"; do echo "$a"; done | sort)
echo ${OUTPUTNAMES[@]}
- xrandr \
+ if xrandr \
--output ${OUTPUTNAMES[0]} --preferred \
--primary \
--output ${OUTPUTNAMES[1]} --preferred \
--right-of ${OUTPUTNAMES[0]}
+ then
+ echo "Successfully applied preferred modes on outputs in sorted order."
+ fi
fi
else
- echo "\e[32mMore than 2 outs.\e[0m"
+ echo "\e[32mOther than two outputs.\e[0m"
fi