Thread: pickel dude
View Single Post
Old 10-08-2015, 01:29 PM   #11
spelufo
Member
spelufo began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Oct 2013
Device: Kobo H2O
Sort of related... I've made this script to listen for a certain sequence of taps and execute stuff when they happen. The dimentions are for the H2O. It needs to be run in the background.

Code:
#!/bin/sh

# +------+------+------+------+
# |      |      |      | (x,y)|
# | (3,0)| (2,0)| (1,0)| (0,0)|
# |      |      |      |      |
# +------+------+------+------+
# |      |      |      |      |
# | (3,1)| (2,1)| (1,1)| (0,1)|
# |      |      |      |      |
# +------+------+------+------+
# |      |      |      |      |
# | (3,2)| (2,2)| (1,2)| (0,2)|
# |      |      |      |      |
# +------+------+------+------+
# |      |      |      |      |
# | (3,3)| (2,3)| (1,3)| (0,3)|
# |      |      |      |      |
# +------+------+------+------+
# |      |      |      |      |
# | (3,4)| (2,4)| (1,4)| (0,4)|
# |      |      |      |      |
# +------+------+------+------+


quadhit()
{
	/usr/local/Kobo/pickel wait-for-hit $(( $1 * 1080 / 4)) $(( $2 * 1440 / 5 )) 270 288 0 0 0 0 &>/dev/null
}


listen=true
while $listen; do
	
	quadhit 0 4
	[ $? -eq 1 ] || continue

	start="$(date +'%s')"

	quadhit 1 4
	[ $? -eq 1 ] || continue
	[ $(( $(date +'%s') - $start )) -lt 3 ] || continue

	quadhit 2 4
	[ $? -eq 1 ] || continue
	[ $(( $(date +'%s') - $start )) -lt 3 ] || continue

	quadhit 3 4
	[ $? -eq 1 ] || continue
	[ $(( $(date +'%s') - $start )) -lt 3 ] || continue

	listen=false	

done

exec /mnt/onboard/.kobo/koreader/koreader.sh
Does it consume a lot of resources to have pickel wait-for-hit running a lot?
spelufo is offline   Reply With Quote