aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2019-06-16 10:34:43 +0200
committerlns <matzeton@googlemail.com>2019-06-16 10:34:43 +0200
commit4730ee9fac66a286675a8c539fa119d2da2d7c27 (patch)
tree69a0f1a96ced3748e6d87989a277bde2aeff8d66
parent08e54f9ca17c0528de7ff136b45d9876b6416a00 (diff)
added xrandr-monitor.sh get-by-edid-checksum script
-rwxr-xr-xxrandr-monitor.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/xrandr-monitor.sh b/xrandr-monitor.sh
new file mode 100755
index 0000000..c11d79a
--- /dev/null
+++ b/xrandr-monitor.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+MONITORS=$(xrandr --query | grep -oE '^[a-zA-Z0-9]{3,8} connected' | cut -d ' ' -f 1)
+GET_BY_CHKSM=${1:-}
+GOT_MONITOR=0
+
+for mon in ${MONITORS}; do
+ EDID=$(xrandr --props | grep "^${mon}" -A 10 | grep -oE '[a-fA-F0-9]{32}')
+ EDID_CHKSM=$(printf "%s" "${EDID}" | sha512sum | cut -d ' ' -f 1)
+
+ if [ "x${GET_BY_CHKSM}" = "x${EDID_CHKSM}" ]; then
+ printf "%s" "${mon}"
+ GOT_MONITOR=$((${GOT_MONITOR} + 1))
+ elif [ "x${GET_BY_CHKSM}" = "x" ]; then
+ printf "Monitor: '%s'\n" "${mon}"
+ if [ "x${EDID}" != x ]; then
+ printf "[EDID]\n%s\n" "${EDID}"
+ printf "Chksm: %s\n" $(printf "%s" "${EDID}" | sha512sum | cut -d ' ' -f 1)
+ fi
+ fi
+done
+
+if [ "x${GET_BY_CHKSM}" != "x" -a ${GOT_MONITOR} -eq 0 ]; then
+ printf "%s" "unknown"
+ exit 1
+fi