From 08f69438bfeb062f2491f9b08f95b48df6aa4e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Sun, 22 Feb 2015 15:36:39 +0100 Subject: Change names for new kernel and intel x-org driver --- autodetect.sh | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/autodetect.sh b/autodetect.sh index fe7256b..2a39980 100755 --- a/autodetect.sh +++ b/autodetect.sh @@ -1,23 +1,23 @@ #!/bin/bash - +set -x #Set this values on new system! ########################################## -eDP1_PATH="/sys/class/drm/card0-eDP-1" -DP1_PATH="/sys/class/drm/card0-DP-1" -HDMI_PATH="/sys/class/drm/card0-HDMI-A-1" -eDP1_NAME="eDP1" -DP1_NAME="DP1" -HDMI_NAME="HDMI1" +NOTE_PATH="/sys/class/drm/card0-eDP-1" +EXT1_PATH="/sys/class/drm/card0-DP-1" +EXT2_PATH="/sys/class/drm/card0-DP-3" +NOTE_NAME="eDP1" +EXT1_NAME="DP1-1" +EXT2_NAME="DP1-3" ########################################## -eDP1_STATUS=$(cat "$eDP1_PATH/status") -DP1_STATUS=$(cat "$DP1_PATH/status") -HDMI_STATUS=$(cat "$HDMI_PATH/status") +NOTE_STATUS=$(cat "$NOTE_PATH/status") +EXT1_STATUS=$(cat "$EXT1_PATH/status") +EXT2_STATUS=$(cat "$EXT2_PATH/status") XRANDR_OUT=$(xrandr -q) -eDP1_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $eDP1_NAME | tail -n1 | awk '{ print $1 }') -HDMI_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $HDMI_NAME | tail -n1 | awk '{ print $1 }') -DP1_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $DP1_NAME | tail -n1 | awk '{ print $1 }') +NOTE_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $NOTE_NAME | tail -n1 | awk '{ print $1 }') +EXT2_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $EXT2_NAME | tail -n1 | awk '{ print $1 }') +EXT1_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $EXT1_NAME | tail -n1 | awk '{ print $1 }') COMMAND="$1" @@ -25,22 +25,22 @@ function handle_non_exist_mode { xrandr --dpi 96 --output $2 --mode $4 --output $1 --mode $3 --left-of $2 } -if [[ ($COMMAND == "external") && ($HDMI_STATUS == "connected") ]]; then - xrandr --dpi 96 --output $HDMI_NAME --mode $HDMI_MAX --output $eDP1_NAME --off +if [[ ("$COMMAND" == "external") && ("$EXT2_STATUS" == "connected") ]]; then + xrandr --dpi 96 --output "$EXT2_NAME" --mode "$EXT2_MAX" --output "$NOTE_NAME" --off -elif [[ ($COMMAND == "external") && ($DP1_STATUS == "connected") ]]; then - xrandr --dpi 96 --output $DP1_NAME --mode $DP1_MAX --output $eDP1_NAME --off +elif [[ ("$COMMAND" == "external") && ("$EXT1_STATUS" == "connected") ]]; then + xrandr --dpi 96 --output "$EXT1_NAME" --mode "$EXT1_MAX" --output "$NOTE_NAME" --off -elif [[ ($HDMI_STATUS == "connected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "disconnected") ]]; then - handle_non_exist_mode $HDMI_NAME $eDP1_NAME $HDMI_MAX $eDP1_MAX +elif [[ ("$EXT2_STATUS" == "connected") && ("$NOTE_STATUS" == "connected") && ("$EXT1_STATUS" == "disconnected") ]]; then + handle_non_exist_mode "$EXT2_NAME" "$NOTE_NAME" "$EXT2_MAX" "$NOTE_MAX" -elif [[ ($HDMI_STATUS == "disconnected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "connected") ]]; then - handle_non_exist_mode $DP1_NAME $eDP1_NAME $DP1_MAX $eDP1_MAX +elif [[ ("$EXT2_STATUS" == "disconnected") && ("$NOTE_STATUS" == "connected") && ("$EXT1_STATUS" == "connected") ]]; then + handle_non_exist_mode "$EXT1_NAME" "$NOTE_NAME" "$EXT1_MAX" "$NOTE_MAX" -elif [[ ($HDMI_STATUS == "connected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "connected") ]]; then - xrandr --dpi 96 --output $eDP1_NAME --mode $eDP1_MAX --output $HDMI_NAME --mode $HDMI_MAX --left-of $eDP1_NAME --output $DP1_NAME --mode $DP1_MAX --left-of $HDMI_NAME +elif [[ ("$EXT2_STATUS" == "connected") && ("$NOTE_STATUS" == "connected") && ("$EXT1_STATUS" == "connected") ]]; then + xrandr --dpi 96 --output "$NOTE_NAME" --mode "$NOTE_MAX" --output "$EXT2_NAME" --mode "$EXT2_MAX" --left-of "$NOTE_NAME" --output "$EXT1_NAME" --mode "$EXT1_MAX" --left-of "$EXT2_NAME" -elif [[ ($HDMI_STATUS == "disconnected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "disconnected") ]]; then +elif [[ ("$EXT2_STATUS" == "disconnected") && ("$NOTE_STATUS" == "connected") && ("$EXT1_STATUS" == "disconnected") ]]; then ~/bin/dnote.sh fi -- cgit v1.2.3