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 

catching power events question

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



Joined: 15 Feb 2007
Posts: 3

PostPosted: Fri Mar 02, 2007 11:28 pm    Post subject: catching power events question Reply with quote

Hi,

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

Code:
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
Back to top
View user's profile Send private message Send e-mail
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Fri Mar 02, 2007 11:48 pm    Post subject: Reply with quote

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 ;)
Back to top
View user's profile Send private message
MrDosu



Joined: 15 Feb 2007
Posts: 3

PostPosted: Fri Mar 02, 2007 11:53 pm    Post subject: Reply with quote

great mate! :D

the 4 the quick reply just what i needed, 2 thumbs up
_________________
No Keyboard Present - Press F1 to continue
Back to top
View user's profile Send private message Send e-mail
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