 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Ixar
Joined: 26 Sep 2006 Posts: 11
|
Posted: Wed Sep 16, 2009 10:47 pm Post subject: Adding features to firmware applications ? |
|
|
Hi !
It's a long time since I read this forum, and I have read several threads regarding PRX modules.
I would like to know if it possible the enhance an exisitng application, such as the video player embedded in the firmware using a PRX to hook some function maybe ?
In fact I would like to disable the LEDs when playing video as it disturbs my eyes. Using the toolchain is not an issue for me, but I can't determine how I should do the hook to limit it to this scenario.
Any pointer welcome ;)
Thank you for your help ! |
|
| Back to top |
|
 |
ab5000
Joined: 06 May 2008 Posts: 74
|
Posted: Wed Sep 16, 2009 11:30 pm Post subject: Re: Adding features to firmware applications ? |
|
|
| Ixar wrote: | Hi !
It's a long time since I read this forum, and I have read several threads regarding PRX modules.
I would like to know if it possible the enhance an exisitng application, such as the video player embedded in the firmware using a PRX to hook some function maybe ?
In fact I would like to disable the LEDs when playing video as it disturbs my eyes. Using the toolchain is not an issue for me, but I can't determine how I should do the hook to limit it to this scenario.
Any pointer welcome ;)
Thank you for your help ! |
Try LEDControl or LedOff. _________________
| Code: | %:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%> |
|
|
| Back to top |
|
 |
Ixar
Joined: 26 Sep 2006 Posts: 11
|
Posted: Thu Sep 17, 2009 12:43 am Post subject: Re: Adding features to firmware applications ? |
|
|
| ab5000 wrote: | | Try LEDControl or LedOff. |
Indeed I already saw those programs, but I would like to do something more elegant.
- I would like to hook the sceSysconCtrlLED call to avoid setting the leds every time... and I could let the blinking power led to have the low battery warning as the parameter are different for blinking ;)
- I would like to disable the power led only while watching video, by detecting the sony default video player (but how could I detect it ?)
In fact I have read several topics on PRX and hooking, but I would like to have your feedback on the feasability as I am no PRX hacking expert ;) |
|
| Back to top |
|
 |
ab5000
Joined: 06 May 2008 Posts: 74
|
Posted: Thu Sep 17, 2009 12:58 am Post subject: Re: Adding features to firmware applications ? |
|
|
| Ixar wrote: | | ab5000 wrote: | | Try LEDControl or LedOff. |
Indeed I already saw those programs, but I would like to do something more elegant.
- I would like to hook the sceSysconCtrlLED call to avoid setting the leds every time... and I could let the blinking power led to have the low battery warning as the parameter are different for blinking ;)
- I would like to disable the power led only while watching video, by detecting the sony default video player (but how could I detect it ?)
In fact I have read several topics on PRX and hooking, but I would like to have your feedback on the feasability as I am no PRX hacking expert ;) |
use M33 SDK, it's very simple to hook something.
hook function -> call real function to poweroff all the leds -> done. _________________
| Code: | %:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%> |
|
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Thu Sep 17, 2009 1:03 am Post subject: |
|
|
If you need to disable the MemoryStick led you can hook sceGpioPortSet function.
in the custom function OR the argument with 0x40, check it and in that case simply return. (0x80 is the value for the wlan led if you want..)
Power leds from what i know are not controlled by gpio. _________________ Ciao! from Italy |
|
| Back to top |
|
 |
marksteven
Joined: 21 Sep 2009 Posts: 3
|
Posted: Tue Sep 22, 2009 7:09 pm Post subject: |
|
|
Hi,
According to me,you should use following program.That code can easily resolve your problem.
%:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%>
Thanks for sharing this information. _________________ fetes des meres
Last edited by marksteven on Thu Sep 24, 2009 6:57 pm; edited 1 time in total |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Tue Sep 22, 2009 8:15 pm Post subject: |
|
|
| phobox wrote: | If you need to disable the MemoryStick led you can hook sceGpioPortSet function.
in the custom function OR the argument with 0x40, check it and in that case simply return. (0x80 is the value for the wlan led if you want..)
Power leds from what i know are not controlled by gpio. |
There is confusion about controlling the LEDs.
sceSysconCtrlLED is like a master kill switch. If they are turned off with this, they will not blink when the memory stick is active or WiFi is active etc.
If you turn them on with sceSysconCtrlLED, the LEDs will not magically light up. This only ALLOWS the LEDs to be activated by the actual functions that turn on the LEDs. i.e. They blink only during activity and will not permanently stay on when you enable them with sceSysconCtrlLED. This applies to Power, WiFi and MemoryStick LEDs.
Turning off MemoryStick and WiFi LEDs with sceSysconCtrlLED will turn them off for good. The blinking of the Power LED during low battery is done by enabling/disabling using sceSysconCtrlLED. So if you disable the power LED with sceSysconCtrlLED it will stay off until the battery is low and starts blinking. This is probably a good thing anyway.
So basically for turning off LEDs, or blinking Power LED use sceSysconCtrlLED. For blinking other LEDs you need GPIO or other methods.
You can detect when the video player module is loaded and just disable the LEDs at that time. I didn't test it so if "video_plugin_module" is not the correct name, try the other video module names.
main.c
| Code: | #include <pspsdk.h>
#include <pspkernel.h>
#include <pspsysmem_kernel.h>
#include <stdio.h>
#include <psppower.h>
#include <string.h>
#include <systemctrl.h>
PSP_MODULE_INFO("Video LEDs", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceSysconCtrlLED(int SceLED, int state);
int OnModuleStart(SceModule2 *mod);
void ToggleLEDs(int);
STMOD_HANDLER previous = NULL;
int OnModuleStart(SceModule2 *mod)
{
if (strcmp(mod->modname, "video_plugin_module") == 0) //detect when video player opened
{
ToggleLEDs(0);
}
else if (sceKernelFindModuleByName("video_plugin_module") == NULL) //detect when video player unloaded
{
ToggleLEDs(1);
}
if (!previous)
return 0;
return previous(mod);
}
void ToggleLEDs(int state)
{
sceSysconCtrlLED(0, state);
sceSysconCtrlLED(1, state);
sceSysconCtrlLED(2, state);
}
int main_thread(SceSize args, void *argp)
{
previous = sctrlHENSetStartModuleHandler(OnModuleStart);
return sceKernelExitDeleteThread(0);
}
int module_start(SceSize args, void *argp)
{
SceUID th;
th = sceKernelCreateThread("main_thread", main_thread, 0x12, 0x500, 0, NULL);
if (th >= 0)
{
sceKernelStartThread(th, args, argp);
}
return 0;
}
int module_stop(SceSize args, void *argp)
{
return 0;
}
|
M33SDK files are in ../include and ../lib
makefile
| Code: | TARGET = videoleds
OBJS = import.o main.o exports.o
INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -fno-pic
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
PSP_FW_VERSION = 500
LIBDIR = ../lib
LIBS = -lpsppower_driver -lpspsystemctrl_kernel
LDFLAGS = -nostdlib -nodefaultlibs
#EXTRA_TARGETS = EBOOT.PBP
#PSP_EBOOT_TITLE = LEDs
#PSP_EBOOT_ICON="icon0.png"
#PSP_EBOOT_PIC1="pic1.png"
#PSP_EBOOT_SND0="snd0.at3"
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
|
exports.exp
| Code: | # Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_FUNC_HASH(module_stop)
PSP_EXPORT_END
PSP_END_EXPORTS
|
import.S
| Code: | .set noreorder
#include "pspstub.s"
STUB_START "sceSyscon_driver",0x00010011,0x00010005
STUB_FUNC 0x18BFBE65,sceSysconCtrlLED
STUB_END
|
Last edited by Torch on Thu Sep 24, 2009 4:51 am; edited 1 time in total |
|
| Back to top |
|
 |
Ixar
Joined: 26 Sep 2006 Posts: 11
|
Posted: Tue Sep 22, 2009 8:58 pm Post subject: |
|
|
| Torch: thank you very much for your crystal clear answer ! All the details I needed are there ! I get back to you with my results during the week ! |
|
| Back to top |
|
 |
|
|
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
|