Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.32 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. fullPage=6 # How many pages before a full refresh?
  4.  
  5. ### Do not edit below this line unless you know what you are doing ###
  6.  
  7. pCount=0
  8. fullPage="$(($fullPage-1))"
  9. update() {
  10.     let pCount+=1
  11.    
  12.     for i in 1 2 3 4 5 ; do
  13.         echo 19 0 > /proc/eink_fb/update_display
  14.         echo 0 > /sys/devices/platform/eink_fb.0/override_upd_mode
  15.         echo 18 0 > /proc/eink_fb/update_display
  16.         echo 1 > /sys/devices/platform/eink_fb.0/override_upd_mode
  17.         echo 19 4 > /proc/eink_fb/update_display
  18.         usleep 75000
  19.     done
  20.    
  21.     # Sets the next page turn to be a full refresh
  22.     if [[ "$pCount" -ge "$fullPage" ]]; then
  23.         echo 0 > /sys/devices/platform/eink_fb.0/override_upd_mode
  24.         echo 19 0 > /proc/eink_fb/update_display
  25.         pCount=0
  26.     fi 
  27. }
  28.  
  29. trap "rm /var/run/flashdis.pid ; exit" SIGINT SIGTERM
  30.  
  31. if [[ ! -e "/var/run/flashdis.pid" ]]; then
  32.     echo $$ > "/var/run/flashdis.pid"
  33. else
  34.     echo "Flash disabler is already running"
  35.     exit 1
  36. fi
  37.  
  38. # Monitor for eink update
  39. while :; do
  40.     # Check if the modification time has changed (It only really changes for eink updates and occasionally wifi)
  41.     mTime="$(stat -c %Y /var/log/messages 2> /dev/null)"
  42.     if [[ "$mTime" -gt "$oldmTime" -a "$mTime" != "" ]]; then
  43.         update
  44.     fi
  45.     # Don't update if the last update was within a second (May be a bad idea)
  46.     oldmTime="$(($mTime+1))"
  47.     usleep 250000
  48. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement