forked from len0rd/rockbox
Extended default_event_handler() that calls a callback function prior to actually handling the event.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5263 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a7aa17ac1b
commit
0dc52d5c36
4 changed files with 21 additions and 8 deletions
12
apps/misc.c
12
apps/misc.c
|
|
@ -230,20 +230,30 @@ bool clean_shutdown(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
int default_event_handler(int event)
|
||||
int default_event_handler_ex(int event, void (*callback)(void *), void *parameter)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case SYS_USB_CONNECTED:
|
||||
if (callback != NULL)
|
||||
callback(parameter);
|
||||
#ifdef HAVE_MMC
|
||||
if (!mmc_detect() || (mmc_remove_request() == SYS_MMC_EXTRACTED))
|
||||
#endif
|
||||
usb_screen();
|
||||
return SYS_USB_CONNECTED;
|
||||
case SYS_POWEROFF:
|
||||
if (callback != NULL)
|
||||
callback(parameter);
|
||||
if (!clean_shutdown())
|
||||
return SYS_POWEROFF;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int default_event_handler(int event)
|
||||
{
|
||||
return default_event_handler_ex(event, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue