summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/misc.c12
-rw-r--r--apps/misc.h1
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h15
4 files changed, 21 insertions, 8 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 5be6264fdc..f632ecc7eb 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -230,20 +230,30 @@ bool clean_shutdown(void)
230 return false; 230 return false;
231} 231}
232 232
233int default_event_handler(int event) 233int default_event_handler_ex(int event, void (*callback)(void *), void *parameter)
234{ 234{
235 switch(event) 235 switch(event)
236 { 236 {
237 case SYS_USB_CONNECTED: 237 case SYS_USB_CONNECTED:
238 if (callback != NULL)
239 callback(parameter);
238#ifdef HAVE_MMC 240#ifdef HAVE_MMC
239 if (!mmc_detect() || (mmc_remove_request() == SYS_MMC_EXTRACTED)) 241 if (!mmc_detect() || (mmc_remove_request() == SYS_MMC_EXTRACTED))
240#endif 242#endif
241 usb_screen(); 243 usb_screen();
242 return SYS_USB_CONNECTED; 244 return SYS_USB_CONNECTED;
243 case SYS_POWEROFF: 245 case SYS_POWEROFF:
246 if (callback != NULL)
247 callback(parameter);
244 if (!clean_shutdown()) 248 if (!clean_shutdown())
245 return SYS_POWEROFF; 249 return SYS_POWEROFF;
246 break; 250 break;
247 } 251 }
248 return 0; 252 return 0;
249} 253}
254
255int default_event_handler(int event)
256{
257 return default_event_handler_ex(event, NULL, NULL);
258}
259
diff --git a/apps/misc.h b/apps/misc.h
index 9588886b1d..e31224823d 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -40,6 +40,7 @@ void screen_dump(void);
40 40
41bool settings_parseline(char* line, char** name, char** value); 41bool settings_parseline(char* line, char** name, char** value);
42bool clean_shutdown(void); 42bool clean_shutdown(void);
43int default_event_handler_ex(int event, void (*callback)(void *), void *parameter);
43int default_event_handler(int event); 44int default_event_handler(int event);
44 45
45#endif 46#endif
diff --git a/apps/plugin.c b/apps/plugin.c
index af6770213d..bf71aa11e3 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -262,6 +262,7 @@ static const struct plugin_api rockbox_api = {
262#ifndef SIMULATOR 262#ifndef SIMULATOR
263 system_memory_guard, 263 system_memory_guard,
264#endif 264#endif
265 default_event_handler_ex,
265}; 266};
266 267
267int plugin_load(const char* plugin, void* parameter) 268int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 52a060d428..96c4f6fe55 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -60,7 +60,7 @@
60#endif 60#endif
61 61
62/* increase this every time the api struct changes */ 62/* increase this every time the api struct changes */
63#define PLUGIN_API_VERSION 27 63#define PLUGIN_API_VERSION 28
64 64
65/* update this to latest version if a change to the api struct breaks 65/* update this to latest version if a change to the api struct breaks
66 backwards compatibility (and please take the opportunity to sort in any 66 backwards compatibility (and please take the opportunity to sort in any
@@ -289,15 +289,16 @@ struct plugin_api {
289 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, 289 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
290 int style); 290 int style);
291#endif 291#endif
292 void (*mpeg_flush_and_reload_tracks)(void); 292 void (*mpeg_flush_and_reload_tracks)(void);
293 int (*strncasecmp)(const char *s1, const char *s2, size_t n); 293 int (*strncasecmp)(const char *s1, const char *s2, size_t n);
294 int (*mpeg_get_file_pos)(void); 294 int (*mpeg_get_file_pos)(void);
295 unsigned long (*find_next_frame)(int fd, int *offset, 295 unsigned long (*find_next_frame)(int fd, int *offset,
296 int max_offset, unsigned long last_header); 296 int max_offset, unsigned long last_header);
297 unsigned long (*mpeg_get_last_header)(void); 297 unsigned long (*mpeg_get_last_header)(void);
298#ifndef SIMULATOR 298#ifndef SIMULATOR
299 int (*system_memory_guard)(int newmode); 299 int (*system_memory_guard)(int newmode);
300#endif 300#endif
301 int (*default_event_handler_ex)(int event, void (*callback)(void *), void *parameter);
301}; 302};
302 303
303/* defined by the plugin loader (plugin.c) */ 304/* defined by the plugin loader (plugin.c) */