diff options
author | Simon Rettberg | 2017-03-23 15:47:45 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-03-23 15:47:45 +0100 |
commit | 1198487b96b7f008cdbec2c74a7229cf63fa86f2 (patch) | |
tree | fb2654f65ef2567f74424971a60fb5ecf10d1ff7 /core | |
parent | [beamergui] Add more debug output to beamergui setup script (diff) | |
download | mltk-1198487b96b7f008cdbec2c74a7229cf63fa86f2.tar.gz mltk-1198487b96b7f008cdbec2c74a7229cf63fa86f2.tar.xz mltk-1198487b96b7f008cdbec2c74a7229cf63fa86f2.zip |
[beamergui] Use temp-file when passing data to parse-edid:
Pipe can lead to partial reads, which parse-edid doesn't handle
Diffstat (limited to 'core')
-rwxr-xr-x | core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter index b7d6f04f..6a8c5e97 100755 --- a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter +++ b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter @@ -70,11 +70,14 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then BEAMER= MAYBEAMER= SMALL= + TF=$(mktemp) + [ -z "$TF" ] && TF="/tmp/${RANDOM}-$$" for i in 0 1; do # See if we hard-coded the device as a beamer # Use echo -e -n "" instead of piping the sed output into xargs printf, as xargs # handles backslashes differently depending on the version. - EDID=$( echo -e -n "$( <<<"$XRANDRV" grep -Pzo "\n${OUTPUTNAMES[$i]}\N*connected\N*\n(\s+\N*\n)+" | grep -Eao '[0-9a-f]{32}' | sed -r ':a;N;$!ba;s/[^0-9a-f]//gI;s/([0-9a-f]{2})/\\x\1/gI' )" | parse-edid ) + echo -e -n "$( <<<"$XRANDRV" grep -Pzo "\n${OUTPUTNAMES[$i]}\N*connected\N*\n(\s+\N*\n)+" | grep -Eao '[0-9a-f]{32}' | sed -r ':a;N;$!ba;s/[^0-9a-f]//gI;s/([0-9a-f]{2})/\\x\1/gI' )" > "$TF" + EDID=$( < "$TF" parse-edid ) MODEL_NAME=$( <<<"$EDID" awk '{if ($1 == "ModelName") { A=$2$3$4$5; print substr(A, 2, length(A) - 2)}}' ) echo "'${OUTPUTNAMES[$i]}' is connected to device '$MODEL_NAME'" # Have a name, do the checks @@ -110,6 +113,7 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then SMALL=yes fi done + rm -f -- "$TF" if [ -z "$BEAMER" ] && [ -n "$MAYBEAMER" ] && [ -n "$SMALL" ]; then # This is a hack on top of the other hack; we already treat outputs reporting a sufficiently large width # as beamers, as we have encountered such devices in the wild. However, we might have just a large TV connected |