From 8eddbab1aaab93254c1dca9a2ba91d1a97f49f8e Mon Sep 17 00:00:00 2001 From: James Fenn Date: Thu, 21 Jan 2021 10:38:17 -0500 Subject: [PATCH 1/3] fix broken condition with modified xorg.conf - #56 --- egpu-switcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/egpu-switcher b/egpu-switcher index 6fc41ca..ad57601 100755 --- a/egpu-switcher +++ b/egpu-switcher @@ -369,7 +369,7 @@ function switch() { fi fi - if [ ${mode} = "egpu" ] && [ $(cat $xfile_egpu | grep -Ei "Driver" | cut -f 2 -d \") != "nvidia" ]; then + if [ ${mode} = "egpu" ] && cat $xfile_egpu | grep -Ei "Driver" | cut -f 2 -d \" | grep -Fxq "nvidia"; then if [ -z ${hex_id+x} ]; then is_egpu_connected From 3b48e04332c113414c2de7b44f11a9a1e790e269 Mon Sep 17 00:00:00 2001 From: James Fenn Date: Thu, 21 Jan 2021 10:47:27 -0500 Subject: [PATCH 2/3] negate if condition! --- egpu-switcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/egpu-switcher b/egpu-switcher index ad57601..ceada09 100755 --- a/egpu-switcher +++ b/egpu-switcher @@ -369,7 +369,7 @@ function switch() { fi fi - if [ ${mode} = "egpu" ] && cat $xfile_egpu | grep -Ei "Driver" | cut -f 2 -d \" | grep -Fxq "nvidia"; then + if [ ${mode} = "egpu" ] && ! cat $xfile_egpu | grep -Ei "Driver" | cut -f 2 -d \" | grep -Fxq "nvidia"; then if [ -z ${hex_id+x} ]; then is_egpu_connected From 5b685bdf0637cf0571f4eba2ca49368587fbc168 Mon Sep 17 00:00:00 2001 From: James Fenn Date: Sat, 23 Jan 2021 11:10:46 -0500 Subject: [PATCH 3/3] improve nvidia condition with suggestions from #57 --- egpu-switcher | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/egpu-switcher b/egpu-switcher index ceada09..2e3566f 100755 --- a/egpu-switcher +++ b/egpu-switcher @@ -369,7 +369,8 @@ function switch() { fi fi - if [ ${mode} = "egpu" ] && ! cat $xfile_egpu | grep -Ei "Driver" | cut -f 2 -d \" | grep -Fxq "nvidia"; then + # when mode is 'egpu' and no 'nvidia' driver is used + if [ ${mode} = "egpu" ] && ! grep -Eiq 'Driver.*nvidia' $xfile_egpu; then if [ -z ${hex_id+x} ]; then is_egpu_connected