Check if /dev/fb1 exists and select /dev/fb0 when not (NEW) (#2064)

This commit is contained in:
/rootzoll 2021-03-16 21:03:00 +01:00 committed by GitHub
parent f12f8fef53
commit a9c64754f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 3 deletions

View File

@ -177,8 +177,16 @@ fi
# display 3 secs logo - try to kickstart LCD
# see https://github.com/rootzoll/raspiblitz/issues/195#issuecomment-469918692
# see https://github.com/rootzoll/raspiblitz/issues/647
# see https://github.com/rootzoll/raspiblitz/pull/1580
randnum=$(shuf -i 0-7 -n 1)
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/raspiblitz/pictures/startlogo${randnum}.png
lcdExists=$(sudo ls /dev/fb1 2>/dev/null | grep -c "/dev/fb1")
if [ ${lcdExists} -eq 1 ] ; then
# LCD
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/raspiblitz/pictures/startlogo${randnum}.png
else
# HDMI
sudo fbi -a -T 1 -d /dev/fb0 --noverbose /home/admin/raspiblitz/pictures/startlogo${randnum}.png
fi
sleep 5
sudo killall -3 fbi

View File

@ -32,6 +32,10 @@ command=$1
oldKernel=$(uname -srm | cut -d ' ' -f2 | cut -d '-' -f1 | grep -c '4.19.118')
oldDrivers=$(sudo cat /home/admin/LCD-show/.git/config 2>/dev/null | grep -c 'github.com/goodtft/LCD')
# check if LCD (/dev/fb1) or HDMI (/dev/fb0)
# see https://github.com/rootzoll/raspiblitz/pull/1580
lcdExists=$(sudo ls /dev/fb1 2>/dev/null | grep -c "/dev/fb1")
###################
# CHECK-REPAIR
# make sure that LCD drivers match linux kernel
@ -172,7 +176,14 @@ if [ "${command}" == "image" ]; then
fi
fi
sudo fbi -a -T 1 -d /dev/fb1 --noverbose ${imagePath} 2> /dev/null
# see https://github.com/rootzoll/raspiblitz/pull/1580
if [ ${lcdExists} -eq 1 ] ; then
# LCD
sudo fbi -a -T 1 -d /dev/fb1 --noverbose ${imagePath} 2> /dev/null
else
# HDMI
sudo fbi -a -T 1 -d /dev/fb0 --noverbose ${imagePath} 2> /dev/null
fi
exit 0
fi
@ -190,7 +201,14 @@ if [ "${command}" == "qr" ]; then
fi
qrencode -l L -o /home/admin/qr.png "${datastring}" > /dev/null
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null
# see https://github.com/rootzoll/raspiblitz/pull/1580
if [ ${lcdExists} -eq 1 ] ; then
# LCD
sudo fbi -a -T 1 -d /dev/fb1 --noverbose /home/admin/qr.png 2> /dev/null
else
# HDMI
sudo fbi -a -T 1 -d /dev/fb0 --noverbose /home/admin/qr.png 2> /dev/null
fi
exit 0
fi