That was a nice little challenge but it works like a charm
Here is a proof of concept: (see attachment below)
Code:
#!/bin/sh
trap './fbink -cq' 0 1
IFS=$'\n;';export $(./fbink -c -qe);IFS=
./fbink -cqm -y1 "Testing '-E' flag by BloodRagg"
touched(){
IFS=$'\n;';local $1;IFS=
[ $ntxRotaQuirk -eq 1 ] && { x=$((screenHeight-x)) ; y=$((screenWidth-y));}
[ $x -ge $lastRect_Left -a $x -le $(( lastRect_Left + lastRect_Width )) ] || return 1
[ $y -ge $lastRect_Height -a $y -le $(( lastRect_Top + lastRect_Height )) ] || return 1
echo true;return 0
}
get_touch_event(){
dd if=/dev/input/event1 count=2 2>/dev/null|\
hexdump -ve '8/2 "%d " "\n"'|\
awk '{if ($6==0 && $7!=0) {print "x="$7}};{if ($6==1) {print "y="$7}}'
}
ON=$(./fbink -E -x1 -M -S6 "ON")
OFF=$(./fbink -E -x-4 -M -S6 "OFF")
EXIT=$(./fbink -E -x-5 -y-2 -S6 "EXIT")
while true ;do
eval $(get_touch_event)
case true in
$(touched $ON)) ./fbink -qg file=lamp_on.jpeg,halign=CENTER,valign=CENTER;;
$(touched $OFF)) ./fbink -qg file=lamp_off.jpeg,halign=CENTER,valign=CENTER;;
$(touched $EXIT)) exit;;
esac
done