| View previous topic :: View next topic |
| Author |
Message |
melado
Joined: 18 Sep 2006 Posts: 7
|
Posted: Thu Dec 13, 2007 12:25 am Post subject: Switching on/off the LEDs? How? |
|
|
Is it possible to switch on/off the PSP LEDs (wifi, power, MS) via software? I've read that last version of IR Shell can do this, but I don't know how it's done.
Thanks. |
|
| Back to top |
|
 |
Aura

Joined: 24 Jul 2007 Posts: 37
|
Posted: Thu Dec 13, 2007 1:32 am Post subject: |
|
|
First, use the search, 2nd read the headers...
| Code: | | int sceSysconCtrlLED(int SceLED, int state); |
-Aura _________________ Live. Love. Be. Believe.
Free downgrading/unbricking service list! |
|
| Back to top |
|
 |
melado
Joined: 18 Sep 2006 Posts: 7
|
Posted: Thu Dec 13, 2007 4:56 am Post subject: |
|
|
Hi! Thank you very much for your reply.
I did use the search but I couldn't find anything useful searching "led" or "leds". And if I search sceSysconCtrlLED, I find a thread, but it doesn't talk about that function.
I found the file with that function, but it says "only SCE_LED_POWER". Is this right? Isn't any way to control the other 2 LEDs?
Thanks again. |
|
| Back to top |
|
 |
Nekuz0r
Joined: 02 Apr 2007 Posts: 3
|
Posted: Sat Dec 15, 2007 1:22 am Post subject: |
|
|
i suggest you to test other value by your self ;)
like 0, 2, 3 .... ;) |
|
| Back to top |
|
 |
M.Jackson
Joined: 10 Sep 2007 Posts: 85
|
Posted: Sat Dec 15, 2007 4:00 am Post subject: |
|
|
| Nekuz0r wrote: | i suggest you to test other value by your self ;)
like 0, 2, 3 .... ;) |
If I remember correctly, none of those values can control the LEDs except the one for power. However, I did find some code from the IPL SDK that does work in controlling the other two LEDs:
#define REG32(a) *(volatile unsigned long *)(a)
// Turn on both LEDs at the same time
REG32( 0xbe240008 ) = 0xC0; /* GPIO SET */
// Turn off both LEDs
REG32(0xbe24000c) = 0xC0; /* GPIO CLEAR */
// Turn on the LED for memory stick
REG32( 0xbe240008 ) = 0x40;
// Turn off the LED for memory stick
REG32( 0xbe24000c ) = 0x40;
Hope it helps. |
|
| Back to top |
|
 |
SilverSpring
Joined: 27 Feb 2007 Posts: 115
|
Posted: Sat Dec 15, 2007 5:02 am Post subject: |
|
|
Unless you plan to bypass the kernel completely dont use the IPL sdk to do it. It can produce unwanted side effects.
Use the sceLed lib instead (only controls ms/wlan leds).
| Code: | // led (0-ms, 1-wlan)
// mode (on/off, and some others)
// param controls a bunch of other things like blinking, the rate it blinks, how long to blink for, etc.
int sceLedSetMode(int led, int mode, SceLedParam *param); |
Im sure someone will post a proper sample on how to use, *cough*adrahil*cough*. |
|
| Back to top |
|
 |
adrahil
Joined: 16 Mar 2006 Posts: 277
|
Posted: Sat Dec 15, 2007 8:37 am Post subject: |
|
|
For the Power LED you should use Syscon call, but for WLAN/MS leds, you can use this:
| Code: | typedef struct{
int oncnt;
int offcnt;
int endcnt;
int endstat;
}SceLedParam;
#define LED_MODE_OFF 0
#define LED_MODE_ON 1
#define LED_MODE_TIMED 2
#define LED_MODE_DELAY 3
#define LED_TYPE_MS 0
#define LED_TYPE_WLAN 1
int sceLedSetMode(int led, int mode, SceLedParam* param); |
Just link in the led.prx exports and off you go :) (Forget about modes 2 and 3, as 0 and 1 are enough) |
|
| Back to top |
|
 |
PSPfreak!

Joined: 14 Nov 2007 Posts: 34
|
Posted: Sun Dec 16, 2007 3:49 pm Post subject: |
|
|
| adrahil wrote: |
Just link in the led.prx exports and off you go :) (Forget about modes 2 and 3, as 0 and 1 are enough) |
as im a N00B do you mean like
| Code: | | LoadStartModule("flash0:/kd/led.prx"); |
or
| Code: | SceUID mod;
mod = LoadStartModule("flash0:/kd/led.prx");
if (mod < 0)
{
ErrorExit(6000, "Error %08X loading/starting led.prx\n", mod);
} |
and i found this code somewere and im not sure if it would help?
| Code: | #include <pspkernel.h>
//==============================
//Definitions for the LED function. For now, only
// the power LED is functioning....
#define POWER_LED 1
#define STATE_ON 1
#define STATE_OFF 0
extern int sceSysconCtrlLED(int LedID,int state);
//==============================
[...]
while(1){
sceSysconCtrlLED(POWER_LED, STATE_ON);
sceKernelDelayThreadCB(100000);
sceSysconCtrlLED(POWER_LED, STATE_OFF);
sceKernelDelayThreadCB(100000);
}
[...] |
|
|
| Back to top |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Mon Dec 17, 2007 11:47 am Post subject: |
|
|
It's good to see this finaly out, thanks.
Potential for controlling other devices through relays is really here with this
if you wanted to open a PSP to tap the LED ports.
I hope there is nothing naughty about doing it this way?
I don't notice any bad side effects.
| Code: |
int sceSysconCtrlLED(int SceLED, int state);
sceSysconCtrlLED(1,0); // turn off LEDs
sceSysconCtrlLED(0,0);
sceSysconCtrlLED(2,0);
sceSysconCtrlLED(3,0);
|
Cheers, Art. _________________ If not actually, then potentially. |
|
| Back to top |
|
 |
CodeKiller
Joined: 31 Jul 2008 Posts: 1
|
Posted: Sun Aug 31, 2008 1:48 am Post subject: |
|
|
Is it possible to "take over" the leds? I mean to use the leds for own madess >:-) while using standard syscalls, that normally use the leds.
In specific: i wan't to use the wlan led, but also plan to use ad-hoc wlan (which is normally also blink the led) but i think they will interfere. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun Aug 31, 2008 6:24 am Post subject: |
|
|
| You want to hook the LED functions so that you can call the original vectors, but everyone else gets your hook function. |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Sun Aug 31, 2008 11:48 am Post subject: |
|
|
| Is there a way to turn off only *one* of the Power LEDs? There are actually 2 green LEDs for the Power. |
|
| Back to top |
|
 |
|