forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Switching on/off the LEDs? How?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
melado



Joined: 18 Sep 2006
Posts: 7

PostPosted: Thu Dec 13, 2007 12:25 am    Post subject: Switching on/off the LEDs? How? Reply with quote

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
View user's profile Send private message
Aura



Joined: 24 Jul 2007
Posts: 37

PostPosted: Thu Dec 13, 2007 1:32 am    Post subject: Reply with quote

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
View user's profile Send private message
melado



Joined: 18 Sep 2006
Posts: 7

PostPosted: Thu Dec 13, 2007 4:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Nekuz0r



Joined: 02 Apr 2007
Posts: 3

PostPosted: Sat Dec 15, 2007 1:22 am    Post subject: Reply with quote

i suggest you to test other value by your self ;)
like 0, 2, 3 .... ;)
Back to top
View user's profile Send private message
M.Jackson



Joined: 10 Sep 2007
Posts: 85

PostPosted: Sat Dec 15, 2007 4:00 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
SilverSpring



Joined: 27 Feb 2007
Posts: 115

PostPosted: Sat Dec 15, 2007 5:02 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Sat Dec 15, 2007 8:37 am    Post subject: Reply with quote

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
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Sun Dec 16, 2007 3:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Mon Dec 17, 2007 11:47 am    Post subject: Reply with quote

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
View user's profile Send private message
CodeKiller



Joined: 31 Jul 2008
Posts: 1

PostPosted: Sun Aug 31, 2008 1:48 am    Post subject: Reply with quote

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
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Aug 31, 2008 6:24 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sun Aug 31, 2008 11:48 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group