Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > White sleep LED controllable?

White sleep LED controllable?
Thread Tools
Fresh-Faced Recruit
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 11, 2004, 04:24 PM
 
I've noticed that when i pull out the RAM from my TiBook and turn it on, the white sleep LED behaves differently than usual - in this case it turns on while the machine is running and blinks twice every x seconds to indicate that something's wrong. That would, IMHO, imply that the circuit driving the LED isn't just a dumb pulse width modulated fade in/out thingy that activates when the machine is in sleep, but rather something completely controlled by firmware (not necesserily OF part - perhaps something in the PMU?).

Now the question that's been bothering me is this: would it be possible to control the LED via software? If it would, it'd make for a rather cool software mod - you could, for example, set it to switch on or blink when a new mail comes in so you could tell it from across the room even with the screen backlight blanked out, or it could be set to indicate CPU activity, act as a HDD activity light or any number of things...

If it is possible to control it (by some kind of low level direct calls), it'd probably require writing a new kext. Kernel extensions, drivers and stuff like that are, unfortunately, way beyond my beginner's coding skills. Any experienced coders out there with an idea?

Orcinus
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Mar 11, 2004, 08:31 PM
 
Back when I was in college and some friends and I were messing around with LinuxPPC, we noticed that our Power Macs' (various Beige G3 and earlier models) power on indicator lights weren't activating when booted into the Open Firmware interface or into Linux. We realized that thus they must have been controlled by the OS instead of the hardware, and IIRC one of the guys even managed to get to where he could control the light from a Linux program.

So yes, it's theoretically possible, assuming that newer Macs use similar architectures for their LEDs. You'll have to find yourself a hardware hacker if you want to do it, though.
Rick Roe
icons.cx | weblog
     
Fresh-Faced Recruit
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 12, 2004, 07:47 AM
 
Hmmmmm...
I wonder what AppleLED.kext does...

Orcinus

EDIT: Nope, that wouldn't do anything - it doesn't seem to be loaded at all...
(Last edited by orcinus; Mar 12, 2004 at 08:29 AM. )
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Mar 12, 2004, 05:58 PM
 
Actually, chances are good that if the LED is being controlled by software, the source for such is available in Darwin.
Rick Roe
icons.cx | weblog
     
Fresh-Faced Recruit
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 14, 2004, 04:58 PM
 
Hmmm probably... then again, isn't all proprietary (hardware related) code outside of Darwin (and, more importantly, GPL)?

Orcinus

EDIT: I was doing some Googling on the subject and, well, it appears LinuxPPC actually DID GET a patch recently that enables the pbooks to use sleep LED as a HDD activity LED! So it seems it really IS POSSIBLE!
     
Banned
Join Date: Apr 2002
Location: -
Status: Offline
Reply With Quote
Mar 14, 2004, 07:58 PM
 
Originally posted by orcinus:
Hmmm probably... then again, isn't all proprietary (hardware related) code outside of Darwin (and, more importantly, GPL)?

Orcinus

EDIT: I was doing some Googling on the subject and, well, it appears LinuxPPC actually DID GET a patch recently that enables the pbooks to use sleep LED as a HDD activity LED! So it seems it really IS POSSIBLE!
Very interesting

Maybe someone could ask on the mailing list... or investigate with the source...

that'd be a cool gadget... HD activity LED

I also have a LED on my iBook!
     
Fresh-Faced Recruit
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 15, 2004, 09:35 AM
 
Ok...
If anyone's interested, here's the link to original thread i've bumped into:
http://www.ussg.iu.edu/hypermail/lin...09.0/0748.html

Judging by some of the lines, it indeed seems the code communicates with PMU to do it's voodoo:
+config BLK_DEV_IDE_PMAC_BLINK
+ bool "Blink laptop LED on drive activity"
+ depends on BLK_DEV_IDE_PMAC && ADB_PMU
(i was refering to the ADB_PMU dep part)

Orcinus
     
Mac Enthusiast
Join Date: May 2001
Location: 127.0.0.1
Status: Offline
Reply With Quote
Mar 16, 2004, 11:06 AM
 
What a great idea... thanks for posting this!

I followed the thread you linked to and the actual C code that was patched in to enable this behaviour was very minimal. I'm sure Darwin has different structs than Linux but this definitely seems do-able, and seems like a very interesting project. If I find myself with some time (haha) I'd like to do the kext tutorial and use this as a learning experience. If someone gets this done, please post back to this thread!

Code:
/* needs drive->queue to be set */ ide_toggle_bounce(drive, 1); /* enable led activity for disk drives only */ if (drive->media == ide_disk && hwif->led_act) blk_queue_activity_fn(q, hwif->led_act, drive); return 0; }
     
Fresh-Faced Recruit
Join Date: Mar 2004
Status: Offline
Reply With Quote
Mar 16, 2004, 02:02 PM
 
Originally posted by joltguy:
I followed the thread you linked to and the actual C code that was patched in to enable this behaviour was very minimal.
The code is minimal because everything needed is already defined in various includes, it would seem... I should definately grab a copy of LinuxPPC IDE and PMU driver sources and check them out. When i find myself some time too, ofcourse, which seems to be a scarce resource lately

Orcinus
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:48 PM.
All contents of these forums © 1995-2009 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.4 © 2000-2009, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2