diff --git a/apps/plugin.c b/apps/plugin.c index 945e99ec71..c37b2fb29b 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -668,6 +668,8 @@ static const struct plugin_api rockbox_api = { appsversion, /* new stuff at the end, sort into place next time the API gets incompatible */ + + button_status_wdata, }; int plugin_load(const char* plugin, const void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 766a309c01..344026f986 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -836,6 +836,8 @@ struct plugin_api { const char *appsversion; /* new stuff at the end, sort into place next time the API gets incompatible */ + + int (*button_status_wdata)(int *pdata); }; /* plugin header */ diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index cc8a1b561a..6e30cb116d 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -86,6 +86,7 @@ static int button_read(void); #ifdef HAVE_TOUCHSCREEN static int last_touchscreen_touch; +static int lastdata = 0; #endif #if defined(HAVE_HEADPHONE_DETECTION) static struct timeout hp_detect_timeout; /* Debouncer for headphone plug/unplug */ @@ -304,6 +305,7 @@ static void button_tick(void) } } lastbtn = btn & ~(BUTTON_REL | BUTTON_REPEAT); + lastdata = data; } #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -575,6 +577,14 @@ int button_status(void) return lastbtn; } +#ifdef HAVE_BUTTON_DATA +int button_status_wdata(int *pdata) +{ + *pdata = lastdata; + return lastbtn; +} +#endif + void button_clear_queue(void) { queue_clear(&button_queue); diff --git a/firmware/export/button.h b/firmware/export/button.h index 3947f07207..3aac1af9d6 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -37,6 +37,9 @@ long button_get (bool block); long button_get_w_tmo(int ticks); intptr_t button_get_data(void); int button_status(void); +#ifdef HAVE_BUTTON_DATA +int button_status_wdata(int *pdata); +#endif void button_clear_queue(void); #ifdef HAVE_LCD_BITMAP void button_set_flip(bool flip); /* turn 180 degrees */