#include "plugin.h" PLUGIN_HEADER static struct plugin_api* rb; struct ButtonItem { int button_code; int ret_code; int pre_button_relative_index; } ; enum { ACTION_UNUSED = -1, ACTION_NONE = 0, ACTION_UP, ACTION_DOWN, ACTION_LEFT, ACTION_RIGHT, ACTION_SELECT, ACTION_MENU, }; static struct ButtonItem standard_buttons #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ (CONFIG_KEYPAD == IRIVER_H300_PAD) [6/* button count*/] = { {BUTTON_UP,ACTION_UP,0}, {BUTTON_DOWN,ACTION_DOWN,0}, {BUTTON_LEFT,ACTION_LEFT,0}, {BUTTON_RIGHT,ACTION_RIGHT,0}, {BUTTON_SELECT,ACTION_SELECT,0}, {BUTTON_MODE,ACTION_MENU,0}, #endif }; /* static struct ButtonItem standard_buttons */ int read_button(struct ButtonItem *items, int button_count, int timeout) { static int last_button = BUTTON_NONE; static struct ButtonItem *last_button_list = NULL; static int last_i = 0; int button; int i=0; int ret; if (timeout) button = rb->button_get_w_tmo(timeout); else button = rb->button_get(1); if (button == BUTTON_NONE || button == SYS_USB_CONNECTED) { last_button = button; last_i=0; last_button_list = NULL; return button; } if ((last_button == button) && (items == last_button_list)) i = last_i; ret = BUTTON_NONE; /* in case the button is not in the list */ while (i