[FIX-WIP]: Fix for keyboard and nav buttons backlight problem on Sense ROMs

Search This thread

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Results

Loccy, here are the results:

#stat -c% /system/bin/a2sd
stat: invalid option -- c

I'm running Firerats Cache Patch, King Legend 10 version. G1 with DangerSPL and RA Dream v1.6.2

Best Regards
 

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Loccy, here's this is what is repeated:

/ $ export PATH=/data/local/bin:$PATH
/ $ su
/ # sh /system/bin/lightbodge.sh &
/ # Changing privs.
Monitoring logcat
stat: invalid option -- c
BusyBox v1.15.2 (2009-12-02 21:29:32 EST) multi-call binary

Usage: stat [OPTIONS] FILE...

Display file (default) or filesystem status

Options:
-f Display filesystem status
-L Dereference links
-t Display info in terse form
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
ref stat

your just comparing file size?

try using

Code:
if [ "`du ${target1}|cut -f1`" = "`du ${target2}|cut -f1` ];
then
     do sumat
else
     sumat else
fi

you might need to set the field for cut, default is tab
busybox du is usually tab delimited, but you could test output and set the du command accordingly
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
that didnt work, no such file or directory, then some logcat stuff

Not true, this does work. You can just punch in the commands on page 1 in Terminal after flashing, thanks FR, you made this easy. This "cheat" for the lights in general seems to glitch a bit but it works!

AND works after reboot, to confirm. I'm running Kings Droid2eris 1.2 with FR apps2sd and speedy 3d kernel.

yeah, second boot would probably fix it

the script doesn't make its log directory, so it fails
but before doing so it creates the directory, so next time round it works

not checked what you currently have,

but personally if the files are small, I would just create a directory on the tmpfs ( /dev/ )
it will be very fast, as its a ramdrive
obviously don't dump too much on it, as it will eat memory, but a no one will notice a few k ;)
 

Yaboiaj

Senior Member
Jul 18, 2009
82
2
Youngstown
This is what I got....

Code:
$ export PATH=/data/local/bin:$PATH
$su
# sh /system/bin/lightbodge.sh &
sh: Can't open /system/bin/lightbodge.sh
[1]   Done(2)                 sh /system/bin/lightbodge.sh
#
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
Thanks Loccy and Firerat. That backlight script works like a charm. I have keyboad backlights now!! The only bad thing is it got fixed after I found Swype and only use the physical kb rarely now. Oh well. I still like having the option.

thanks for the thanks, but nothing to do with me :)
 

crodgers79

Senior Member
Oct 1, 2008
265
9
Port Deposit, Maryland
Still not clear if this works on Vega's 0.91

yeap, because the ramdisk dosn't mount the /cache correctly

give us a few min, I upload a CH compatible one

I run Vega's 0.91 Legend with his YouTube patch applied and Firerat's King's #8 Kernel and Wi-Fi fix patch and am quite happy with that setup (although I lost 3D with the King's #8 Kernel).

Can I apply Firerat's King's 3D Kernel patch which first appeared in this thread (the original version, not this latest Cache Hacked version) successfully to Vega's v0.91?

Please let me know if anyone has tried this..

Thank you all!

UPDATE: ASKED AND ANSWERED - Tried to apply it and it hung at the G1 screen. Reverted back to Vega 0.91 applied Vega's YouTube Patch and FR King's #8 Kernel and Wi-Fi patch.
 
Last edited:

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Results

Hello Firerat. Here's an update on your FR-FR9-Legend-CHRD_S.zip. Definitely, runs faster on FR-King-Legend10-CachePatch, but keyboard light is still not op. Lost wifi, too. WiFi is unable to start.

Thanks for your prescience in all of this. What tremendous resourse to the forum you are.

Regards
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
Hi all

I added Loccy's script to my latest Vega's Legend CacheHack

my ramdisks init.rc is launching /system/patch on boot

I made a few changes,
replaced the stat cmd with du
changed the log location to the tmpfs ( /dev/ )

its working great, out of the box ;)


here is a diff patch

Code:
--- lightbodge.txt	2010-04-14 12:50:42.000000000 +0100
+++ FR-lightbodge.txt	2010-04-14 12:51:36.000000000 +0100
@@ -5,7 +5,11 @@
 KEYBOARD_OPEN="keys=2/1/1"
 KEYBOARD_CLOSE="keys=2/1/2"
 
-BASE_DIR="/sdcard/logcatmon"
+BASE_DIR="/dev/logcatmon"
+if [ ! -d $BASE_DIR ];
+then
+	mkdir $BASE_DIR
+fi
 
 FILE_SCREENON="$BASE_DIR/logcat-screenon.txt"
 FILE_SCREENONX="$BASE_DIR/logcat-screenonX.txt"
@@ -22,13 +26,13 @@
 DEVICE_BUTTONLIGHT="/sys/class/leds/button-backlight/brightness"
 DEVICE_KEYBOARDLIGHT="/sys/class/leds/keyboard-backlight/brightness"
 
-echo "Changing privs."
-chmod 777 $DEVICE_BUTTONLIGHT
-chmod 777 $DEVICE_KEYBOARDLIGHT
-
-echo "Monitoring logcat"
-rm -r $BASE_DIR
-mkdir $BASE_DIR
+#echo "Changing privs."
+#chmod 777 $DEVICE_BUTTONLIGHT
+#chmod 777 $DEVICE_KEYBOARDLIGHT
+
+#echo "Monitoring logcat"
+#rm -r $BASE_DIR
+#mkdir $BASE_DIR
 
 # monitor for screen going off
 logcat -d | grep "$SCREEN_OFF" > $FILE_SCREENOFF
@@ -50,39 +54,39 @@
 do
 
 # if screen on
-FILESIZE=`stat -c%s $FILE_SCREENON`
-FILESIZE2=`stat -c%s $FILE_SCREENONX`
+FILESIZE=`busybox du $FILE_SCREENON|cut -f1`
+FILESIZE2=`busybox du $FILE_SCREENONX|cut -f1`
 if [ ! $FILESIZE -eq $FILESIZE2 ]; then
 echo "Screen turned on"
 echo 1 > /sys/class/leds/button-backlight/brightness
-logcat -d | grep "$SCREEN_ON" > /sdcard/logcatmon/logcat-screenonX.txt
+logcat -d | grep "$SCREEN_ON" > ${BASE_DIR}/logcat-screenonX.txt
 fi;
 
 # if screen off
-FILESIZE=`stat -c%s $FILE_SCREENOFF`
-FILESIZE2=`stat -c%s $FILE_SCREENOFFX`
+FILESIZE=`busybox du $FILE_SCREENOFF|cut -f1`
+FILESIZE2=`busybox du $FILE_SCREENOFFX|cut -f1`
 if [ ! $FILESIZE -eq $FILESIZE2 ]; then
 echo "Screen turned off"
 echo 0 > /sys/class/leds/button-backlight/brightness
-logcat -d | grep "$SCREEN_OFF" > /sdcard/logcatmon/logcat-screenoffX.txt
+logcat -d | grep "$SCREEN_OFF" > ${BASE_DIR}/logcat-screenoffX.txt
 fi;
 
 # if keyboard opened
-FILESIZE=`stat -c%s $FILE_KEYBOARDOPEN`
-FILESIZE2=`stat -c%s $FILE_KEYBOARDOPENX`
+FILESIZE=`busybox du $FILE_KEYBOARDOPEN|cut -f1`
+FILESIZE2=`busybox du $FILE_KEYBOARDOPENX|cut -f1`
 if [ ! $FILESIZE -eq $FILESIZE2 ]; then
 echo "Keyboard opened/rotated to landscape"
 echo 1 > /sys/class/leds/keyboard-backlight/brightness
-logcat -d | grep "$KEYBOARD_OPEN" > /sdcard/logcatmon/logcat-keyboardopenX.txt
+logcat -d | grep "$KEYBOARD_OPEN" > ${BASE_DIR}/logcat-keyboardopenX.txt
 fi;
 
 # if keyboard closed
-FILESIZE=`stat -c%s $FILE_KEYBOARDCLOSE`
-FILESIZE2=`stat -c%s $FILE_KEYBOARDCLOSEX`
+FILESIZE=`busybox du $FILE_KEYBOARDCLOSE|cut -f1`
+FILESIZE2=`busybox du $FILE_KEYBOARDCLOSEX|cut -f1`
 if [ ! $FILESIZE -eq $FILESIZE2 ]; then
 echo "Keyboard opened/rotated to portrait"
 echo 0 > /sys/class/leds/keyboard-backlight/brightness
-logcat -d | grep "$KEYBOARD_CLOSE" > /sdcard/logcatmon/logcat-keyboardcloseX.txt
+logcat -d | grep "$KEYBOARD_CLOSE" > ${BASE_DIR}/logcat-keyboardcloseX.txt
 fi;
 
 sleep 1
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
Hello Firerat. Here's an update on your FR-FR9-Legend-CHRD_S.zip. Definitely, runs faster on FR-King-Legend10-CachePatch, but keyboard light is still not op. Lost wifi, too. WiFi is unable to start.

Thanks for your prescience in all of this. What tremendous resourse to the forum you are.

Regards

I have a new patch, just flash it over a standard Legend install ;)
its over at Vega's Legend Thread
post #1329
 

TheDeadWalk

Senior Member
Sep 8, 2009
108
2
I got mine working by following intructions on first post.
then, i went into terminal emulator and entered this

su
sh /system/bin/lightbodge.sh &

that got it working

a bit sluggish but still working!

EDIT: they seem to turn on randomly when not even touching the phone.
any idea how to fix this?
 
Last edited:

kevinshitaru

Member
Feb 20, 2010
10
0
ooops i got trouble now, it only works when i connected usb and test mod: chmod 777.... and cant save it, help pls, im using sense 2.1 hero 1.5 thnx
 

cesarbric

Senior Member
Jun 30, 2010
147
4
WPB FL
ooops i got trouble now, it only works when i connected usb and test mod: chmod 777.... and cant save it, help pls, im using sense 2.1 hero 1.5 thnx
Got the same problem, works really well but only when I chmod it and it is conected it to the computer, any way that can it be made to work when it is disconected? Thx in advance
 

angius1

New member
Oct 25, 2010
1
0
keyboard backlight issue alternative solution

I have found an alternative simple solution for the keyboard backlight issue on android:

prerequisites:
root access
busybox (possibly)

The trick is to read from the input device related to the keyboard and turn the light on when any key is pressed.
you have to create a shell script called for sample backlight.sh with these instructions:


Code:
while [ 1 ]
do 
  cat /dev/input/event3|read -n 4
  echo "1"> /sys/class/leds/keyboard-backlight/brightness
  sleep 1
done

copy it on sdcard and try to launch it as root from a terminal emulator:

If you don't want the script has bound to the controlling terminal launch it with:

Code:
nohup bash /sdcard/backlight.sh > /dev/null &


now when you press any key on the keyboard it would light up!

write a feedback please!
 
Last edited:

sUsH667

Senior Member
Jul 1, 2011
500
439
i've read from the first page til here and have one question:

this keeps my keyboard's backlight switched on as long as the keyboard is opened and switches it off if i close keyboard, is that correct? or will the keyboard's backlight dim off after few seconds?

greetz,

sUsH667