View Single Post
Old 20-12-2011, 17:10   #5
MemoryS60
Member
 
Iscritto dal: May 2011
Messaggi: 107
Intanto ne posto io uno carino che avevo fatto per delle prove ecc...

Praticamente č un "driver" dell'illuminazione che funziona totalmente da script

-- backgliht.sh --
FOR R0 only, for R1 you should have a look for the possible high level interface to modify the backlight. For example, R0 has /sys/devices/platform/afe.0/bli, echoing "0" disables BL, echoing "10" makes the high BL. But it's better modifying the registers on AS3543 directly
NOTE: set Always on in R0 settings
NOTE2: after some time I guess the script crashes (no more backlight, but device still working and responding to keys :S)

Codice:
#!/bin/sh
timeout=40 #! Note: not seconds...still to complete sync with time..about 9 seconds @ 200 mhz
timer=0
bg_state="on" #! On by default...
bl_dis () {
  cd /usr/local/bin
  ./afewr 0x1b 0x2 0x00
  ./afewr 0x1b 0x3 0x00
}
bl_en () {
  cd /usr/local/bin
  ./afewr 0x1b 0x3 0x8 #minimum light possible, change 0x8 if you want but don't go too higher!!!
}
get_state () {
  cd /usr/local/bin
  if ./aferd 0x1b 0x3 | grep -q 0x00
    then
        bg_state="off"
    else
        bg_state="on"
  fi
}
daemon () {
  while [ 1 ]; do
    get_state
    #echo "$bg_state"
    if [ $timer -gt $timeout ]
    then
      #echo "Timeout reached: turning off backlight"
      if [ "$bg_state" == "on" ]
        then
            bl_dis
      fi
    else
      #echo "our timer has gone bad again :D"
      if [ "$bg_state" == "off" ]
        then
            bl_en
      fi
    fi
# >& /dev/null
    var=$(dd if=/dev/r0Btn bs=4 count=1)
    if [ -z "$var" ]
    then
      #echo "String is null. Incrementing timer.."
      #echo "$var"
      timer=$(($timer+1))
    else
      #echo "String is not null. Resetting timer..."
      #echo "$var"
      timer=0
    fi
    #sleep 0.1
    #echo "$timer"
    #sync
  done
}
# Start our "driver"
daemon &
#sleep 10
#reboot
Avrei anche diversi altri "snippet" usati in fase di avanscoperta quest'estate hehe. Appena li scovo, posterņ qualcosa

EDIT: faccio notare che gran parte dei lettori Samsung, da una certa data probabilmente (circa 2006?), usano kernel linux per funzionare

Ultima modifica di MemoryS60 : 20-12-2011 alle 17:14.
MemoryS60 č offline   Rispondi citando il messaggio o parte di esso