[Optimus V Android Development] mmarz:
As you know, the LG Optimus line of phones doesn't have an external notification light for missed calls and other events. This mod will turn the backlight for your hard keys into a notification light. Since it uses Tasker, other notifications can be added easily. I then show you how to turn the backlight LED into an external LED.

This mod consists of two parts, the software mod and the hardware mod. You don't have to do the hardware mod, but it completes the the look and functionality of the mod.

Software Mod

Method 1 - No Flashing - The most efficient and least taxing on your battery

In method 2 (the original method), I will show you how to use Tasker and some scripts to make your button backlight flash for an incoming notification. One problem with that technique is that it requires a script to be run every time the lights are flashed. This resulted in a dramatic increase in battery drain since the phone was kept from going completely idle. I tried creating a script that runs perpetually and only flashes the lights when a setting is changed, but when the phone does go idle, it slows down or completely stops the script.

I decided to try a new approach to the lights. Instead of to flashing the lights, when a notification comes in, I would leave the lights permanently on until the screen is turned on again. This however required a modified kernel. The default action by all of the kernels is to turn off the key lights when the phone goes idle. Picasticks was kind enough to provide me with a modified version of his kernel that stopped the lights being turned off. With that in hand, I tested what happens when I leave the key lights on. It turns out that the LEDs consume very very very little energy. Over the course of a 20 hour test, my phone only lost 22% of its battery power. Until I can figure out a way to make the lights flash in an efficient way, or Picasticks can find a low level way to incorporate it into the kernel, this is the most efficient solution. You may think that flashing the lights has to be more efficient than leaving them on. If you wake the phone to do it, you are burning through a lot more juice than if you just keep the light on. Think of it the same way florescent lights work. There is a cost associated with turning it on. If you repeat the process of turning them on too often, you consume more juice than just leaving them on. In this case, waking the phone uses 25-60mA for a few seconds where as the LEDs consume less than 1mA. If you waked the phone every 10 seconds to flash the lights and the phone stayed out of idle for only one second, that would equal 25mA * 6 = 150mAs for the most conservative estimate of the amount of battery consumed in 1 min. If I leave the light on and use the most liberal estimate for battery consumption (1mA), then it would consume 60mAs, almost three times less. If we flash the lights every 3 seconds like I did in method 2, that would consume at least 500 mAs, over 8 times as much as leaving the lights on. If you still don't believe me, try both out and let me know how it goes.

Here is how to set this up to work on your phone with Tasker:

(If you already installed method 2, you can start at step 5.)

Install tasker

Install sl4a

Download the KeylightsNoFlash_v2.rar and extract it.

Place sush into /system/bin and change the permissions to "rwxr-xr-x"

adb remount
adb push sush /system/bin/
adb shell chmod 755 /system/bin/sush

or through terminal emulator:

mount -o remount,rw -t yaffs2 /system /system
cp /sdcard/sush /system/bin/sush
chmod 755 /system/bin/sush

Place userbackup.xml in /sdcard/tasker

Place the six script files into /sdcard/sl4a/scripts

Open tasker, hit the menu, profile data, restore

Press apply to exit Tasker, and Go to Settings>Accessibility> Enable Accessibility for Tasker

Place Picasticks modified kernel (picasticks-07-led1.zip) onto your micro SD card.

Reboot into recovery.

Use the flash zip feature to install the modified kernel.

This will turn on the button backlight LEDs if you get a missed call, text, GV message, Gtalk message, Groove IP missed call, Sipdroid, missed call, cSipSimple missed call, new email, or new Gmail. If you want other notifications to trigger the lights, in Tasker hit New -> Event -> UI -> Notification -> Owner Application -> and select the app who's notifications you want to trigger the lights. When the Task Selection Menu pops up, select Togglekeylights. There is a 14 second delay built into the light to allow the phone to go back to sleep before turning on the light for missed calls.

If you don't want to use Picastick's kernel, then ask your kernel dev to be as kind as Picasticks and create you a kernel that disables the the sleep feature of the button backlights.

All credit goes to Picasticks for this one. Thank you!

Method 2 - Flash the LEDs - This consumes way more power than method one but some may find it more aesthetically pleasing.

I had been using an app called keylights to flash the blacklight on my hardware keys when I had missed texts. More info about that app here: KeyLights 0.2 - Capacitive Lights As Notification - Updated June 3, 2010 Here is a modified version I made with more options: http://www.mediafire.com/?8dwto2rk8jjed62

Unfortunately, that app refuses to install on some of the roms. Also, the app would only notify you of texts but not missed calls, missed voip calls, GV messages, Gtalk messages...etc.

So I did some digging and figured out how to toggle the backlight myself. The attached script will turn the lights on for a split second second and then turn them off. If you open the script, you'll see that there really is nothing hard about implementing this. Combine this with Tasker and disabling the lights when you press the hardware keys, and you have yourself a dedicated notification light.

Here is how to set this up to work on your phone with Tasker:

Install tasker

Install sl4a

Download the Keylights.rar and extract it. (attached below)

Place userbackup.xml in /sdcard/tasker

Place sush into /system/bin and change the permissions to "rwxr-xr-x"

adb remount
adb push sush /system/bin/
adb shell chmod 755 /system/bin/sush

or through terminal emulator:

mount -o remount,rw -t yaffs2 /system /system
cp /sdcard/sush /system/bin/sush
chmod 755 /system/bin/sush

Place the four script files into /sdcard/sl4a/scripts

Open tasker, hit the menu, profile data, restore

Press apply to exit Tasker, and Go to Settings>Accessibility> Enable Accessibility for Tasker

Reboot!

This will flash the button backlight LEDs if you get a missed call, text, GV message, Gtalk message, or Groove IP missed call. If you want other notifications to trigger the lights, in Tasker hit New -> Event -> UI -> Notification -> Owner Application -> and select the app who's notifications you want to trigger the lights. When the Task Selection Menu pops up, select Togglekeylights.

If you want to change the interval of flashing, edit the task of the Keylights profile. Change all the wait values. That profile is setup in that way to minimize the number of loops Tasker has to do.

Here is an explanation of how the Tasker profiles are setup to flash the LED.

This mod stops the blacklight from turning on when you press the key. If you just want to do the same on your own without Tasker, run the following through adb shell or a script with root privileges:

chmod 0333 /sys/class/leds/button-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness

To reverse it:

chmod 0647 /sys/class/leds/button-backlight/brightness

or just reboot. You'll need to run the disable command after every boot if you want the backlight to not turn on with a press of the keys. With the backlight disabled, you will still be able to flash it using the script provided. You are merely locking out the system from turning on the backlight. To implement this using tasker, delete all of the Tasker profiles except "Boot".

If you do want your key backlight to function when you press the keys with this mod, delete the "Boot" profile, and reboot your phone.

Hardware Mod

I originally opened up my phone because I wanted to see if I could replace the LED used to backlight the hard key buttons with a brighter one and maybe change the color. I am using the backlight as a substitute for a notification light, but the keys are very dim. Well, it turned out that the LED for the backlight wasn't dim at all. It was super bright, and there were actually three of them. Because the buttons have their button circuitry directly under them, their backlight LED's are offset and the light that shines through is routed through a maze of rubber and plastic first. I decided that since the LED's were offset, I could just drill a hole directly over one of them and create my own notification light. The mod is very simple, but I'm going to purposely leave out pictures for some of the steps to scare away incompetent people that shouldn't be doing this to their electronic devices. If you can't figure out how to do this without the pictures, you shouldn't try this at all.

This will void your warranty in the most OBVIOUS way. Do not try this unless you are comfortable taking a drill to your phone.

Supplies:

Eye glass repair kit or equally tiny phillips head screw driver

A drill (drill press is preferred)

1-2 mm drill bit (I used 1.5mm)

A strong tape (I used kapton tape for its strength and color)

Superglue

A small section of foam as a diffuser

A razor or scissors

Steps:

1. Turn off the phone (obviously). Remove the micro sd card, the back cover, and the battery.

2. You will see seven screws. Six are around the perimeter and one is where the battery would be.

3. Remove them all while taking note that the one in the battery compartment is much shorter than the others. You may need to place the phone on a flat surface and press very hard to get the screws started. They all have thread locking fluid on them. Take care to not strip the screw heads. I love the fact that for once the screws are not the stared security screws. Yay open systems!

4. Once the screws are removed, separate the silver back plate from the front plate and phone circuitry. There are small plastic tabs keeping the two connected. Using a finger nail, work your way around the phone until they all pop out. The back plate should come off with zero effort if all the tabs have been unlatched. All of the plastic side buttons will come off too. Don't lose them.

5. Remove the two screws and cover plate located over the micro usb plug. This might also take some muscle. These screws are different from the rest. Don't mix them up.

6. Carefully pop the PCB up. It should only be held down by two small plastics tabs on either side of the phone. The PCB will still be attached to the screen by a ribbon cable. We don't want to remove the PCB or the screen. We just want to get at the front row of buttons to slide them out. With the PCB moved up a bit, you should be able to remove the four buttons that are actually attached to one another.

Here is what it should look like:

Notice the three LED's marked by arrows?

Here is a top-down view:

The white ovals represent where the LED's are relative to the buttons. As you can see, the LED's are covered by both the webbing between the keys and the outer case of the phone.

I chose to use the LED on the left as the notification LED. This is because it is located a little bit higher on the phone than the other two. That made the drilling easier as I wasn't afraid of cracking that small plastic bridge. It was also a lot easier to tape up once I was done. It is up to you to decide which you want to use. The backlight for all your keys will still work no matter which one you pick.

7. The blue lines are where I cut the webbing between the keys. I had to even remove part of the menu button. That did not change the way the button worked.

8. Now for the drilling. Here I am about to drill my phone:

The boys in the machine shop were fascinated with what I was doing.

"Don't mind me. I'm just using an industrial drill press on my $200 phone."

As you can see, I taped the battery cover back on the phone to protect the PCB while drilling. Place a piece of cardboard on the inside to protect the PCB in case you drill too far down!

Here is the after picture:

I had to drill again with a larger bit (1.5mm), because my initial hole was a little too high. You can see the LED through the hole now. You could probably drill even further down on the phone, but the hole I made works fine with the diffuser.

Here I am manually holding the battery in place to see how the LED shines through the button webbing and the hole:

As you can see, that single LED is super bright.

9. Finally, cut out a piece of tape that will patch up the hole from the inside of the phone. In the center of the tape place a very small sliver of foam. You are making a super tiny band-aid. I used the kind of foam that is used to wrap around merchandise for shipping to prevent scratches. The foam will act as a diffuser for the light and make a secure seal around the hole. If we just used tape, the sticky side would be pointed toward the outside world and would most likely collect dust.

You want to make the tape as small as possible so that it doesn't interfere with the keys on either side but large enough so that it will secure the foam over the hole you just drilled. It will take a lot of trial and error to get it right. Once you have your band-aid in place, use the tip of a toothpick or needle to apply a very minute amount of superglue around the perimeter of the tape. This will ensure that it stays in place. Give the glue ample time to set before continuing.

10. Put your phone back together using the correct screws in the correct holes. Remove any dust from the silver back plate before screwing it on to ensure that dust doesn't settle on your camera. You don't have to worry about dust getting under your screen cover because we never broke the seal for that. After you are satisfied with how the mod came out, you can add a small amount of superglue from the outside into the hole, and allow it time to set before moving it again. This will completely seal the hole and further strengthen the band-aid.

In the end, I redid the hole using the far right led and filling it in with epoxy. Here is my final product:

But there you have it. A notification light in less than 30 mins of work.

With the flashing led script, disabling the led with key presses, and finally adding an external spot for the led, you'll have a fully functional and dedicated notification led.

Enjoy!