Turn off charging LED?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
mirzab14
Posts: 8
Joined: Mon Jan 21, 2008 5:37 pm

Turn off charging LED?

Post by mirzab14 »

I've been wondering if this is possible. I know its possible to turn off the WLAN, MS, and POWER LED's but is it possible to turn off the orange "charge" LED when A/C adapter is plugged in?

I've searched but couldn't find anything.

This is the code for the LEDControl plugin.

Code: Select all

#include <pspkernel.h>
#include <pspctrl.h>

#define MS_LED 0
#define WLAN_LED 1
#define POWER_LED 2

#define STATE_ON 1
#define STATE_OFF 0

PSP_MODULE_INFO&#40;"LEDControl", 0x1000, 1, 0&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;
int currentState = STATE_ON;

int main_thread&#40;SceSize args, void *argp&#41;
&#123;	
	SceCtrlData pad;

	while&#40;1&#41;
	&#123;
		sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
		if&#40;pad.Buttons & PSP_CTRL_LTRIGGER&#41; &#123;
			if&#40;pad.Buttons & PSP_CTRL_VOLDOWN&#41;
			&#123;
				if&#40;currentState == STATE_ON&#41;
				&#123;
					sceSysconCtrlLED&#40;MS_LED, STATE_OFF&#41;;
					sceSysconCtrlLED&#40;WLAN_LED, STATE_OFF&#41;;
					sceSysconCtrlLED&#40;POWER_LED, STATE_OFF&#41;;
					currentState = STATE_OFF;
				&#125;
				else
				&#123;
					sceSysconCtrlLED&#40;MS_LED, STATE_ON&#41;;
					sceSysconCtrlLED&#40;WLAN_LED, STATE_ON&#41;;
					sceSysconCtrlLED&#40;POWER_LED, STATE_ON&#41;;
					currentState = STATE_ON;
				&#125;
			&#125;

		&#125;
    		sceKernelDelayThreadCB&#40;100000&#41;;
	&#125;

	return 0;
&#125;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
	// Create a thread
	int thid = sceKernelCreateThread&#40;"LEDControl", main_thread, 0x30, 0x1000, 0, NULL&#41;;
	if&#40;thid >= 0&#41; sceKernelStartThread&#40;thid, args, argp&#41;;

	return 0;
&#125;
Maybe its a hardware thing and it can't be controlled by software?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Yes it can be done.
Have a look at Road Dog source.
I got the sample from this forum.

It might be just a matter of defining the next LED:

Code: Select all

#define CHARGE_LED 3
or maybe not, but Road Dog definitely turns it off.
Art.
If not actually, then potentially.
mirzab14
Posts: 8
Joined: Mon Jan 21, 2008 5:37 pm

Post by mirzab14 »

I tried

Code: Select all

#define CHARGE_LED 3
and it doesn't work.

I looked at main.c of Road Dog but couldn't really tell why it does work and why mine doesn't.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Maybe it's a 1.50 kernel mode thing?
I can't say for sure why, just know it does turn it off for me.
It could also be because my toolchain is a very old version.

I can still adjust LCD brightness, yet others here have had
problems with the same sample code to do that.
If not actually, then potentially.
Post Reply