diff options
author | Simon Rettberg | 2017-02-28 14:26:43 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-02-28 14:26:43 +0100 |
commit | 2a004dfc0fdb15ad462b5b52f55b76a63cba9590 (patch) | |
tree | 65a404dadce7e34e5fee0c58dc9c546cbf4ead53 /core/modules/beamergui/data | |
parent | [speedcheck] New module (diff) | |
download | mltk-2a004dfc0fdb15ad462b5b52f55b76a63cba9590.tar.gz mltk-2a004dfc0fdb15ad462b5b52f55b76a63cba9590.tar.xz mltk-2a004dfc0fdb15ad462b5b52f55b76a63cba9590.zip |
[beamergui] Use parse-edid to check if output matches specific device name
Diffstat (limited to 'core/modules/beamergui/data')
-rwxr-xr-x | core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter | 30 |
1 files changed, 30 insertions, 0 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 b747d257..461152fa 100755 --- a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter +++ b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter @@ -25,6 +25,11 @@ MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 CONFIGFILE="/opt/openslx/beamergui/beamer.conf" +# Hard-code a few models known to be problematic +declare -a FORCE_BEAMER +FORCE_BEAMER=("AT-HDVS-RX") + + ################################################################################ #DRIVER=$(lspci -nnk | grep -i vga -A3 | grep 'in use'| awk '{ print $NF }') @@ -58,6 +63,31 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then MAYBEAMER= SMALL= for i in 0 1; do + # See if we hard-coded the device as a beamer + EDID=$(<<<$XRANDRV grep -Pzo "\n${OUTPUTNAMES[$i]}\N*connected\N*\n(\s+\N*\n)+" | grep -Eao '[0-9a-f]{32}' tmp | sed -r ':a;N;$!ba;s/[^0-9a-f]//gI;s/([0-9a-f]{2})/\\\\x\1/gI' | xargs printf | 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 + if [ -n "$MODEL_NAME" ]; then + FOUND= + # Try hard coded values from above + for model in "${FORCE_BEAMER[@]}"; do + if [ "x$model" = "x$MODEL_NAME" ]; then + FOUND=ya + break + fi + done + # Now try user supplied config + if [ -z "$FOUND" ] && grep -Fxq "${MODEL_NAME}=beamer" "$CONFIGFILE"; then + FOUND=ya + fi + # Set beamer if any match + if [ -n "$FOUND" ]; then + BEAMER=$i + continue + fi + fi + # Classic test by what X(randr) figured out WIDTH=$(grep -E "^${OUTPUTNAMES[$i]}.*[0-9]+mm x [0-9]+mm" <<<"$XRANDR" | head -n 1 | grep -o -E ' [0-9]+mm x' | grep -o -E '[0-9]+') if [ -z "$WIDTH" ] || [ "$WIDTH" -eq 0 ] || [ "$WIDTH" -gt 900 ]; then echo "Screen $i is beamer, width is '$WIDTH'" |