Advertisement
Guest User

Flash Disabler

a guest
Jul 17th, 2011
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. fullPage=6 # How many pages before a full refresh?
  4. pCount=0
  5.  
  6. disableUpdates() {
  7.     let pCount+=1
  8.     i=0
  9.    
  10.     # I run it a bunch of times with a 0.05 delay as it is very hard to time when the page will turn and you don't want it to be trigger too early as it won't update the page and you don't want it too late as it will look bad.
  11.     while [[ "$i" -lt "5" ]] ; do
  12.         echo 18 2 > /proc/eink_fb/update_display
  13.         echo 19 7 > /proc/eink_fb/update_display
  14.         let i+=1
  15.         usleep 75000
  16.     done
  17.    
  18.     # Sets the next page turn to be a full refresh
  19.     if [[ "$pCount" -ge "$(($fullPage-1))" ]]; then
  20.         echo 19 0 > /proc/eink_fb/update_display
  21.         pCount=0
  22.     fi 
  23. }
  24.  
  25. trap "rm /var/run/flashdis.pid ; exit" SIGINT SIGTERM
  26.  
  27. if [[ ! -e "/var/run/flashdis.pid" ]]; then
  28.     echo $$ > "/var/run/flashdis.pid"
  29. else
  30.     echo "Flash disabler is already running"
  31.     exit 1
  32. fi
  33.  
  34. while :; do
  35.     waitforkey > /dev/null # I use all button presses as 19 7 messes up the menus.
  36.     disableUpdates
  37. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement