[Kernel] SD Card activity LED

Search This thread

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
#include <cyanogen/std_disclaimer.h>

Ever wish your G1 had an activity light for the sd slot? Now it can!

The Linux kernel includes built-in support for triggers through sysfs (/sys/class/leds/*/trigger) which allow for such things to be set up. The only thing stopping us from using these is the fact that android triggers the lights manually, which then disables our trigger... What I've done is rename button-backlight to btn-backlight in the kernel, and added an init script to set it up automatically on boot. On G1 hardware, this results in the light under the call,home,back,end, and home buttons to flicker any time there's sd activity... I've applied the same patch for sapphire/myTouch and N1, although I have no way of testing these platforms, it shouldn't cause any problems.

This kernel:
-Is compiled against the latest cm-kernel code (as of May 21)
-Is available with and without bfs
-Turns your button panel into an SD indicator
-Includes an init script to set up the trigger at boot (runs before bootanimation!)

If you like my work, BUY CYANOGEN AND/OR KOUSH A BEER!

EDIT: look on page 5 for a update-sdled-v5.zip for the latest version... G1 (button backlights) and myTouch (jogball) support for sd activity without an init script, as well as a nand-disk option that can be set from a userinit.sh

EDIT: new v6 build on page 6.... rebased off the latest cm-kernel, which means oc support is now included....
 
Last edited:

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
whoops... I forgot to attach them... here's the files...
 

Attachments

  • update-ledsd-kernel.zip
    3.4 MB · Views: 134
  • update-ledsd-kernel+BFS.zip
    3.4 MB · Views: 59
  • button-backlight-as-trigger.diff.txt
    1.2 KB · Views: 107

meisterlampe2000

Senior Member
Jun 1, 2006
327
16
wow nice mod ! is it possible to change these led to the jogdial button underneath? i am using a mytouch -:) again,nice work...
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
Thanks! It should be easy enough to make that work... I just need to know what the jog dial is named under sysfs... I'll take a look at the code and see what I can find...

-------------------------------------
Sent from my HTC Dream
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
Meisterlampe2000: (or anyone else with a mytouch) could you please run the following command in terminal emulator or adb shell and post the output?

#ls /sys/class/leds

-------------------------------------
Sent from my HTC Dream
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
Cool, so I found jogball-backlight declared in board-mahimahi-microp.c (strange, I expected to find it in board-sapphire...

I'll get it compiled and posted in a few minutes for ya

-------------------------------------
Sent from my HTC Dream
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
Overclocking is done at a kernel level, so in order to have both, I'd have to release an oc version... I've been considering running an oc kernel on my end anyway, so I will post a version with that once I've made the switch... as far as internal flash activity, I haven't discovered a way, but it should be possible... the only problem is that an led can only be set to one trigger, so if it is set up for internal flash, you don't get sd activity shown... I'll definitely be looking into it though
-------------------------------------
Sent from my HTC Dream
 

theMODEL22

Senior Member
Jul 13, 2009
166
9
Choctaw, OK
you should add it or at least try it, throw these two together and i think you might have something that'll be thrown into a lot of ROM's
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
myTouch jogball version

Ok, so here's a version that does the same thing, but with the myTouch jogball... THIS ONE WILL NOT WORK ON G1, as the init script sets up the jogball instead of the button backlight.. it is otherwise identical to the first one without bfs.

EDIT: wrong file edited... should work on the N1 trackball... if you wanna try the jogball on the myTouch, scroll down, I just posted another update
 

Attachments

  • update_mytouch_sd_jogball.zip
    3.4 MB · Views: 17
Last edited:

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
you should add it or at least try it, throw these two together and i think you might have something that'll be thrown into a lot of ROM's

Yeah, if I can find a kernel led trigger for the internal flash, I may be able to then create a trigger that will register with both triggers to provide a single activity light for both... I definitely like the idea
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
Ok, so here's a version that does the same thing, but with the myTouch jogball... THIS ONE WILL NOT WORK ON G1, as the init script sets up the jogball instead of the button backlight.. it is otherwise identical to the first one without bfs.

but as I said in the first post, I have no way of testing it... it shouldn't cause any problems... but as always NANDROID THAT ***** FIRST!
 

meisterlampe2000

Senior Member
Jun 1, 2006
327
16
MH, the file location seemed to be strange...

It´s not working on Sapphire...

Here is what i get for /sys/class/leds

->blue,jogball-backlight,btn-backlight,lcd-backlight,green and red :)

I guess, all those mixed colors are done via RGB for the Status LED ?

...anyway, for the Jogball, it must be jogball-backlight somehow ?

Thanks for that first shot !
 

jummama

Senior Member
Oct 28, 2006
54
3
Lynnwood
MH, the file location seemed to be strange...

It´s not working on Sapphire...

Here is what i get for /sys/class/leds

->blue,jogball-backlight,btn-backlight,lcd-backlight,green and red :)

I guess, all those mixed colors are done via RGB for the Status LED ?

...anyway, for the Jogball, it must be jogball-backlight somehow ?

Thanks for that first shot !

Hmm, looks like I need to do some more grepping... strangely, the only jogball-backlight I found was in a board-mahimahi file... so I guess this second release is actually just for any n1 users that want it on their jogball, lol
-------------------------------------
Sent from my HTC Dream
 

Top Liked Posts