catching power events question

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

Moderators: cheriff, TyRaNiD

Post Reply
MrDosu
Posts: 3
Joined: Thu Feb 15, 2007 10:56 am

catching power events question

Post by MrDosu »

Hi,

id like to catch the power events like in the power callback eg:

Code: Select all

int power_callback(int unknown, int pwrflags, void* unknown2)
{
    if ( pwrflags & PSP_POWER_CB_POWER_SWITCH ) {
        printf("night night...\n");
    } else if ( pwrflags & PSP_POWER_CB_RESUME_COMPLETE ) {
        printf("returning from sleep...\n");
    }
    int cbid = sceKernelCreateCallback("Power Callback", power_callback, NULL);
    scePowerRegisterCallback(0, cbid);
    return 0;
}
but would like to circumvent the need for installing the "normal" home button and volume key callbacks that are done by calling

sceKernelSleepThreadCB();

does any of u guys know a way to get those power events without te home button showing up the exit scren and volume buttons working?

thx in advance :D
No Keyboard Present - Press F1 to continue
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

For suspend/resume, listen to sysevents with an event mask of 0x00FFFF00, you'll figure it out when you see the events :) (0x400X for suspend, 0x1000X for resume, iirc)

There's a simple sample in the SDK for this, just remove the dispatches and register it to listen to the system event mask (0x00ffff00). This would be the only *neat* way not to use callbacks for this, in my opinion.

For other events than standby/resume, well... I guess you need to fiddle around ;)
MrDosu
Posts: 3
Joined: Thu Feb 15, 2007 10:56 am

Post by MrDosu »

great mate! :D

the 4 the quick reply just what i needed, 2 thumbs up
No Keyboard Present - Press F1 to continue
Post Reply