yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] Fictionles:
Here's the next release. Let me know what you think of purple over orange. I can control the blue led better than the green one.

Fixed:

Different LED lights based on charge of battery

Optimized value checks to make app less "chatty"

Adding debug logging to logcat

Other code enhancements.

Same procedure as before. Uninstall the old, unzip and install the new. Reboot.
[G1 Android Development] twistedumbrella:
Been combing the app with my existing work inside the ROM. Rm far its not a bad outcome.
[G1 Android Development] javacody:
The purple is a nice touch. Very cool! I'll let you know how it's going tomorrow.
[G1 Android Development] javacody:
Weird, Hero crashed on me for the first time since I installed 2.1 after I restarted from installing this apk. Coincidence?
[G1 Android Development] Fictionles:
Hopefully...its been running fine for me all day.

I didn't put that many changes in from the last update that should've broke it.

Let me know if keeps crashing it into the weekend.
[G1 Android Development] javacody:
No more crashes since then, I think it was just a coincidence.
[G1 Android Development] Fictionles:
Charging LEDs App

Latest update. I've been running this all weekend and it hasn't fallen off the process table once.

Should properly light up green when the battery life is over 90%. Red when its less than 20% while charging and purple in between.

Should work on any Hero ROM. Enjoy!

Let me know if I should put this in the App forum as well.
[G1 Android Development] javacody:
Cool, is this a new version?

I think you should submit it to the Marketplace.

EDIT:

I can see a size difference, so it must be a new version!
[G1 Android Development] javacody:
Plugged into USB, purple LED started up. Unplugged, purple light still on. Think we have a bug...
[G1 Android Development] taurean376:
am runnning myhero rom. I installed this but it dont work keep crashin wen i plug in usb or power cable.

Any ideas
[G1 Android Development] B-man007:
The Always Flash app on the market allows full power LED's (colored as well, I got all the colors from the hello im app) to work on hero. the charging leds dont work obviously because of the nature of the app, but im sure if we looked at what it does, we could manage to reverse engineer what the app is doing to find out the proper values to allow for 100% led power.

note: it only works when charging, but that is, once again, the nature of the app.

EDIT: link to it

http://www.cyrket.com/package/uk.co.neilandtheresa.AlwaysFlash
[G1 Android Development] javacody:
Fic's code keeps the leds at 50%, he could change the code to make them 100%.
[G1 Android Development] Fictionles:
Does that app do flashing LEDs for Hero? Its the last thing I'm trying to figure out how to do reliably.
[G1 Android Development] twistedumbrella:
When I made that video on hero of full led that app was present...
[G1 Android Development] B-man007:
Ya everything works just like it would on regular android.

EDIT: wait are you talking to me? haha make it easier on everyone by quoting :P
[G1 Android Development] dpgc213:
when using the heroled.apk alwaysflash.apk and missedcall.apk the leds work pretty well, all colours work and appear to be at 100%. Though it only when works when the charger is pluged in. When you take the charger out you only get the dim green led for notifications.
[G1 Android Development] B-man007:
I'm pretty sure its all just alwaysflash.apk because all my notifications work fine when plugged in and I only have alwaysflash
[G1 Android Development] kingklick:
Is always flash not free..?
[G1 Android Development] B-man007:
no its a paid software :(

but support the devs ftw :P

maybe we could email them for a custom app?
[G1 Android Development] twistedumbrella:
We need a copy that doesnt require the charger to be plugged in and we would be set
[G1 Android Development] twistedumbrella:
Do you have a link to the code? I would rather start there then start fresh, but i think I have an idea of how to get all leds running.
[G1 Android Development] Fictionles:
Here's the code.

Using a similar method, I got blink to work....*but* it only worked when the phone wasn't in standby. I'm suspecting BFS is doing something with the thread waits since running anything faster than 1 or 2 seconds black screened my phone. If I space it every 3 or 4 seconds its not an issue. It would also knock the battery charge LED app off the process table after several hours (until I coded it to stay)
[G1 Android Development] kingklick:
so can it be getting charging led's for awhile and blink if not on standby? this particular zip
[G1 Android Development] Fictionles:
I haven't tried it since most of the time my phone isn't charging and I don't want it to work that way. :) My idea was to have a service poll the green LED brightness and if it had a value of 1, start a blink loop until it gets set to 0 (i.e. when you click on the notification bar since that resets it). I could get it to alternate between say a brightness of 100 and 1, that way when you accepted the notification it would clear and kick you out of the loop. It would only work if the phone wasn't in standby; and if I set it to blink to fast the phone would black screen.

Either my logic is wrong, or something is preventing it to work that way (most likely the former). And I'm out of ideas...
[G1 Android Development] Fictionles:
I actually just had a thought...

Probably should read up on the AlarmService, and see if I can schedule it running instead of being 'always on'.
[G1 Android Development] twistedumbrella:
Looking into using NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); to trigger the green led when a notification comes on, trick would be turning it off.
[G1 Android Development] Fictionles:
I think it does it automatically when you access the Notification bar. Not 100% positive though.
[G1 Android Development] shafty023:
You could always force it off via

echo "0" >/sys/class/leds/green/brightness

Or listen on the event when the notification bar is given focus which is how Android does it now
[G1 Android Development] jinx10000:
I have been playing with your program tonight Fictionles. Hope you don't mind.

I haven't read this whole thread so I may have missed the point. However, I edited your program to have the bright purple LED when the phone rings or when you get a text message, as well as the charging LEDs.

Currently, you can click a notification that I created or the HeroLED app shortcut to kill the LED. Don't know a better way yet. Either one will kill the LED. I have attached the code and app. Hope it is helpful.

It is mostly based off your code and some of the code from TTSNotifier on this site.

Small Change: Added red low battery LED. However, I won't know if it works until my battery is low.

Note: It appears a reboot is required after install before the charging LED works.
[G1 Android Development] jinx10000:
Update: Added red low battery warning LED in post above.

Let me know if it works. My battery is at 100% and I seldom let it get that low.
[G1 Android Development] jinx10000:
moved to new thread.
[G1 Android Development] javacody:
Installing in the morning. THanks!
[G1 Android Development] javacody:
Just installed it. Notification seems to work fine. It seems a little slow to kill the led, though.
[G1 Android Development] shafty023:
You would do the following

echo "50" > /sys/devices/platform/i2c-adapter/i2c-0/0-0062/leds/blue/brightness

echo "50" > /sys/devices/platform/i2c-adapter/i2c-0/0-0062/leds/red/brightness

to make a purplish color.
[G1 Android Development] anddep:
re-write the 3 line from

to

i tested on the SMS pop-up and i see no LED light at all..
[G1 Android Development] shafty023:
Don't forget the echo "1" > /sys/devices/platform/i2c-adapter/i2c-0/0-0062/blink

and don't forget you have to reboot after changing the modules in /system/lib/hw
[G1 Android Development] shafty023:
Oops! Nice catch, I've updated my post

Edit:

I noticed that changing of colors through applications is not working. Just the LED support is working. I'm still looking into getting it all working
[G1 Android Development] ArmandHammer:
I just want to get this clear before i try it,

If using JACMan hero you should skip the first two lines?

Thanks for the fix.
[G1 Android Development] justanothercrowd:
A big thanks too shafty! I will have this in 1.65 sometime tonight hopefully.
[G1 Android Development] anddep:
cool i'll keep a close eye on this thread.. or just flash JAChero 1.65, he's gonna fix it.. keep up the good work though:)
[G1 Android Development] Buster3616:
Mind throwing launcher back in 1.65? I use 1.62 but without rosie.

Awesome find glad somebody finally figured this out!
[G1 Android Development] shafty023:
Do this to see if you need to do the first 2 lines

[B]From Terminal[/B]
ls -l /system/lib/hw/lights.trout.so
ls -l /system/lib/hw/copybit.trout.so

If either of those come back as file not found you'll need to do the cp command to do the copy.
[G1 Android Development] shafty023:
Everyone please continue to check the main thread for updates/fixes as I find them. I won't be posting new fixes for LED support besides in the main post so that everyone can find it. Thanks
[G1 Android Development] jenarobfreaky:
I am getting "cannot create /system/lib/hw/lights.trout.so Red-only file system" when entering these commands into terminal? Does anyone know how to resolve this? I am using SuperHero V1 B2 App2sd and dalvik-cache as well.
[G1 Android Development] ArmandHammer:
Im getting the same error, i think i will wait for JAC to add this to 1.65.

Thanks for all the work you did on this fix.
[G1 Android Development] coolmarkoo:
i m getting the same problem it said read only.
[G1 Android Development] Dladu:
try doing it through adb and doing adb remount maybe? not sure if that would work...

or

mount -o rw,remount /dev/block/mtdblock3 /system

through terminal
[G1 Android Development] shafty023:
Doh! Forgot to mention you need to have /system remounted as read/write.

If you have ADB do

adb remount

Or from terminal

mount -o rw,remount /system
[G1 Android Development] justanothercrowd:
I've got it packaged up and testing with the final 2.6.27 kernel
[G1 Android Development] chrisrj28:
Did it and tested and it does work if dimly. But someone had posted that the g-sensor stopped working and I am getting the same thing. It doesn't detect how the phone is facing anymore. Anyone else get that?
[G1 Android Development] coolmarkoo:
Tried remounting but still had the same problem is there anything else i shud do
[G1 Android Development] shafty023:
I just tested and the accelerometer is working just fine. Remember, tilt sensor does not work for Rosie/MMS and probably a few other apps. Open Mail.apk and flip your phone the side. Make sure that you COPY and not RENAME the sensors.trout.so. You should have sensors.hero.so and sensors.trout.so . If you don't have both then your SENSORS will not work. This is easily fixed, get the sensors.hero.so file from anyone and copy it to your device as sensors.trout.so
[G1 Android Development] shafty023:
What is the exact command you used to remount?
[G1 Android Development] coolmarkoo:
I did

Su

#mount -o rw,remount/system

Then tried the commands that were posted it said read only file.
[G1 Android Development] shafty023:
Check the first post again. I updated it with the correct mount command. If you don't see it hit refresh. I'd post it here but I want to make sure you see the latest changes I've made to the code that needs to be entered so I'd rather you check the first post. Let me know if you have any questions
[G1 Android Development] Zarboz:
ok so its on...now...how do i get it turn off?
[G1 Android Development] shafty023:
You should be able to unplug your charger, then plug it back in and it'll toggle the light. If you want to manually turn it off then set all the values in leds/green/brightness leds/blue/brightness leds/red/brightness to 0.

For example of changing the brightness values check the first post
[G1 Android Development] Zarboz:
definatley not toggling upon removal or cord.. i adb'd the commands cuz im lazy and i didnt wanna type them in the terminal emulator haha
[G1 Android Development] coolmarkoo:
Thanks alot for the help it works now.
[G1 Android Development] shafty023:
I have noticed if you left the "blink" file with a value of 1 and then reboot the led won't switch on/off when you remove the cord. Still trying to track that one down. I suggest give the blink file a value of 0 and then reboot. It should work for you if you did it correctly
[G1 Android Development] Zarboz:
thought that command didnt persist accross reboots... :(
[G1 Android Development] Zarboz:
still not toggle upon change of echo value to 0 :( :( :( damn you LED
[G1 Android Development] shafty023:
After changing its value to 0, did you reboot?
[G1 Android Development] Zarboz:
yessir left value at 0 for blink echo and 100 for red brightness just stays on as a constant wether plugged in or not

::edit:: getting NO LED without adjusting the brightness... am i supposed to set the brightness or will the system have it set?

::edit edit:: still not getting any LED whatsoever.. no changing colors or notifications unless i actually change the brightness through the echo "100"
[G1 Android Development] shafty023:
Ya I'm noticing similar issues, I'm trying to track down a definite way to keep the trigger working when plugging/unplugging ac adapter. This is going to require some mods to the kernel so we can edit sysfs.
[G1 Android Development] Zarboz:
i figured as much... i dont do linux haha

so ill see what jac and manup n you cookup
[G1 Android Development] jooshy180:
i tried changing the colors.. it stayed on.. what do i do? :/
[G1 Android Development] vaguerants:
cp /system/lib/hw/copybit.msm7k.so /system/lib/hw/copybit.trout.so

Hm when i type this in Terminal my phone freezes and reboots.

Anybody else having this problem? :confused:
[G1 Android Development] RaiderX303:
when i do the echo commands i get

echo "1" > /sys/devices/platform/i2c-adaptor/i2c-0/0-0062/blink

cannot create /sys/devices/platform/i2c-adaptor/i2c-0/0-0062/blink: directory nonexistent

also an easier way to edit init.rc if in /boot is to remount the boot as read/write using

mount -o rw,remount /boot /

Edit: i am using JACMan 1.64
[G1 Android Development] blackgin:
You need to use all the command in the first post of this thread.. Not only the one you have used
[G1 Android Development] RaiderX303:
i have used all of them but when i get to the echo command, it gives that error
[G1 Android Development] shafty023:
It's "adapter" with an e
[G1 Android Development] shafty023:
right now it's really for show. The tough part was getting Hero to actually make the LED's functional, which they are now. Next is getting the operating system to turn them on automatically. It works right now only with default green light when you plug/unplug ac adapter.

If you're asking what do you do in terms of turning them off, just set the brightness on all 3 colors to 0
[G1 Android Development] shafty023:
That's definitely not normal and shouldn't be happening. You should download the Android SDK, hop into the tools directory and use "adb logcat" to watch the logs so you can see what error pops up that causes the reboot. Obviously, but I didn't state it, you'll need to connect your phone to the computer via usb. I've noticed if I skip small obvious steps somehow someone somewhere will forget to do it and magically think the phone communicates to the computer by sprinkling fairy dust on it, lol.
[G1 Android Development] RaiderX303:
thanks, that fixed it. didnt think to check spelling :P
[G1 Android Development] johnnylicious:
how do i fix the auto-rotate bug.
[G1 Android Development] jooshy180:
Oo i see... ok but i just did the commands and didt try to change the colors.. the green light is fine.. but yes the auto rotate isnt working, and is anybody else having problems with the sms? After i did this i noticed the messaging isnt right.. all my sent are showing up on the bottom.. and the recieved is showing up on top
[G1 Android Development] jroid:
ok so i just did all the commands. results were auto-rotate stopped working with no working led.
[G1 Android Development] jroid:
here's what I get in logcat when i test an led in missed call:

D/LED ( 796): LED created.

E/LED_DUAL( 67): open failed errno: 2

E/LED_DUAL( 67): open failed errno: 2

E/LED_DUAL( 67): open failed errno: 2

E/LED_DUAL( 67): open failed errno: 2

E/LED_DUAL( 67): open failed errno: 2

D/NOTIFY ( 796): LED Notification set with Timer: 300-300 / Color: -16776961
[G1 Android Development] Jceezy:
My messages were doing the same and I haven't even tried these led fixes
[G1 Android Development] jooshy180:
ok tmobiles fault? lol
[G1 Android Development] shafty023:
I've had that issue as well with sms but none of the commands issued would affect sms. From what I understood the list being out of order was a known issue with Hero. The commands for LED fixing dealt with devices and device modules, not the sqlite3 mms db or java framework classes.
[G1 Android Development] shafty023:
Nope known issue with the MMS app. I'm guessing its either the code in the Mms.apk or an issue with ordering in the Mms sqlite3 db
[G1 Android Development] shafty023:
That's what we want to happen, the G1 has a single LED at the top. The Hero phone will have Dual LED's. That's why you're getting an error about LED_DUAL failing.
[G1 Android Development] shafty023:
The only possible way that auto-rotate would stop working is if you fudged on copying over the sensors.trout.so. Strangely the Hero rom looks for sensors.hero.so and sensors.trout.so . Make sure both of those files have the same md5sum and both don't have a file size of 0.

md5sum /system/lib/hw/sensors.trout.so

md5sum /system/lib/hw/sensors.hero.so

Trout = dev phone

Hero = uhhh well the Hero phone

msm7k = hmmm I'd guess G1?

goldfish = another guess, maybe G1?
[G1 Android Development] Zarboz:
If we can manually insert a brightness value to the phone for the led cant we insert a brightness value in the sysfs? or can we combine the LED functions so that the 2nd LED wich is nonexistant on G1.. and the LED we got working will function as the same LED ?
[G1 Android Development] shafty023:
/sys which is running off sysfs (ram based file system) is created automatically and can not be written to. Try hopping in there and do a "touch file" and you'll see a notice that the directory does not exist. So it's not as easy as just creating any file in there. Same thing goes for the dual led that does not exist. We don't get to virtually create devices and place them in /sys as they are created by devices/modules via the kernel. So we can't point the non-existent dual led to our led via a symlink or anything.
[G1 Android Development] Zarboz:
kinda answers just a thought i dont do very much linux work.. so i didnt know if it would be possible to point commands aimed at LED2 at LED1 i guess that would take hardcore kernel mod huh?
[G1 Android Development] Lieu10ant:
since the LED can be dim or bright, is it possible for it to PULSE? like dim from bright and then to gradually turn bright from dim?
[G1 Android Development] shafty023:
ya we'll need to get the kernel devs involved on this one. I'm a linux guy and a software developer but never really got into virtual device nodes
[G1 Android Development] shafty023:
Yes if you wrote the right piece of software, that would be easy to implement. But of course the question you'd ask yourself is do you want it to pulse forever (IE write up a script in shell and run it as a background task), or would you want to implement it in a root only app (the app could only work on a rooted phone if you're directly modifying the device nodes in /sys as opposed to using the google api which at the moment doesn't work on Hero)
[G1 Android Development] justanothercrowd:
1.65r2 now has Shaftys LED support built in. Modify the led.sh script at /system/bin/led.sh to change the echo value.

Again thanks for your work on this.
[G1 Android Development] jooshy180:
so for the led to be able to work u have to modify these things? how?
[G1 Android Development] justanothercrowd:
its setup to echo on boot so you don't have to do anything...all the other cahnges are in the boot.img, if you want to mod the echo line change the script in /system/bin called led.sh
[G1 Android Development] chunga:
why instead of copying files you just don't symlink it?

ex:

ln -s /system/lib/hw/lights.msm7k.so /system/lib/hw/lights.trout.so
[G1 Android Development] amphillips822:
totally tits....thx all!!!!!!!!!!!!!!!!!!!!
[G1 Android Development] Zarboz:
Did you get custom colors to work?
[G1 Android Development] shafty023:
Hmmm there's no logical reason why I didn't. I guess while I was debugging the issue first instincts were to copy as opposed to symlink. But looking back now it makes more sense to symlink than to copy so we save space. I'll update the instructions on main post. Thanks chunga
[G1 Android Development] shafty023:
Check the main post where near the bottom of post #1 it explains how to change the colors along with code examples
[G1 Android Development] Zarboz:
question about the echo command for the blink file.... when you echo a place value of 1 on the blink file is that telling the hardware to activate with a value of 1? and if i change value to 0 i still get no trigger upon plugin or unplug but i do get a trigger upon messages email and missed call
[G1 Android Development] shafty023:
apparently when you set the blink file to a value of 1 it tells the system to activate the led. It only accepts a value of 0(off) or 1(on).
[G1 Android Development] Zarboz:
ok.. i figured as much.. i was wondering if there was a temp file that controls the brightnes variable (upon trigger:: or is that what your still searching for) i dont even know what to use to pop open the boot.img and look at the kernel.... if someone can point me in that direction i can delve through pages of code looking for light functions
[G1 Android Development] shafty023:
the kernel is the same kernel (patched to 2.6.29 for Hero) that is available if you download the Android source code and compile it. To open boot.img do a search in the forums for unpack/repack boot.img. Someone wrote a nice little perl script that'll do all the work for you. You WILL, and I repeat, WILL have to compile the android 1.5 source code in order to have the binary mkbootimg . You're not going to get it anywhere else. This means you MUST have either Linux/Mac in order to compile the android source code. It doesn't compile on Windows seeing as how Android is Linux.
[G1 Android Development] omnimon:
even after the fix, my auto rotate isnt working
[G1 Android Development] khoaitaychienvn:
so I just type all these commands to get the led working?
[G1 Android Development] Breakthecycle2:
I do have a question. I tried entering all the commands in terminal emulator to get the LED's to work. It keeps saying, "files exist", but the LED isn't on. Am I missing a step or three? I am using TwistedUmbrella's latest Hero ROM. Can I do this in ADB? IF so, what exactly do I need to type?
[G1 Android Development] shafty023:
replace line 1 with "adb remount"

prepend the rest of the lines with "adb shell"

of course don't add in the double quotes
[G1 Android Development] shafty023:
This will ENABLE leds but won't get them working just like they were in cupcake. This is mainly just progress towards getting them fully functional. Once you finish typing all the commands you will be able to manually turn on the leds and change the colors. Read my first post on how to manually change colors
[G1 Android Development] Breakthecycle2:
I did this and I got "link failed file exists". What am I missing?

EDIT: I did do the chmod entries (last three lines) and it didn't come back with any error message, but the LED is still not on at all. help!