commit b4eac86279a737d84095c88f547efca46c0c4c6b Author: Alex Suykov Date: Thu Sep 10 22:36:44 2009 +0300 Brightness patch diff --git a/apps/action.h b/apps/action.h index 5df8639..7db2d91 100644 --- a/apps/action.h +++ b/apps/action.h @@ -100,6 +100,8 @@ enum { ACTION_STD_QUICKSCREEN, ACTION_STD_KEYLOCK, ACTION_STD_REC, + ACTION_STD_BRIDOWN,/* only if HAVE_BACKLIGHT_BRIGHTNESS */ + ACTION_STD_BRIUP, ACTION_F3, /* just so everything works again, possibly change me */ /* code context actions */ diff --git a/apps/gui/list.c b/apps/gui/list.c index e45d71d..48c67a8 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -655,6 +655,14 @@ bool gui_synclist_do_button(struct gui_synclist * lists, setvol(); return true; #endif +#ifdef HAVE_BACKLIGHT_BRIGHTNESS + case ACTION_STD_BRIUP: + setbri( 1); + return true; + case ACTION_STD_BRIDOWN: + setbri(-1); + return true; +#endif case ACTION_STD_PREV: case ACTION_STD_PREVREPEAT: gui_list_select_at_offset(lists, -next_item_modifier); diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 945a764..e6546e4 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -883,6 +883,12 @@ long gui_wps_show(void) } } break; + case ACTION_STD_BRIUP: + setbri( 1); + break; + case ACTION_STD_BRIDOWN: + setbri(-1); + break; /* fast forward OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ case ACTION_WPS_SEEKFWD: diff --git a/apps/keymaps/keymap-c200.c b/apps/keymaps/keymap-c200.c index dddb328..b4fb1cc 100644 --- a/apps/keymaps/keymap-c200.c +++ b/apps/keymaps/keymap-c200.c @@ -49,6 +49,9 @@ static const struct button_mapping button_context_standard[] = { { ACTION_STD_REC, BUTTON_REC|BUTTON_POWER, BUTTON_NONE }, { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_BRIUP, BUTTON_REC|BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_STD_BRIDOWN, BUTTON_REC|BUTTON_VOL_DOWN, BUTTON_NONE }, + LAST_ITEM_IN_LIST }; /* button_context_standard */ @@ -73,6 +76,8 @@ static const struct button_mapping button_context_wps[] = { { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_BRIUP, BUTTON_REC|BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_STD_BRIDOWN, BUTTON_REC|BUTTON_VOL_DOWN, BUTTON_NONE }, { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, diff --git a/apps/misc.c b/apps/misc.c index 8fe6631..8f35288 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -747,6 +747,21 @@ void setvol(void) settings_save(); } +#ifdef HAVE_BACKLIGHT_BRIGHTNESS +void setbri(int dbri) +{ + dbri += global_settings.brightness; + if (dbri < MIN_BRIGHTNESS_SETTING) + dbri = MIN_BRIGHTNESS_SETTING; + if (dbri > MAX_BRIGHTNESS_SETTING) + dbri = MAX_BRIGHTNESS_SETTING; + + global_settings.brightness = dbri; + backlight_set_brightness(dbri); + settings_save(); +} +#endif + char* strrsplt(char* str, int c) { char* s = strrchr(str, c); diff --git a/apps/misc.h b/apps/misc.h index 5107054..576952e 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -81,6 +81,10 @@ void check_bootfile(bool do_rolo); /* check range, set volume and save settings */ void setvol(void); +/* same for brightness */ +#ifdef HAVE_BACKLIGHT_BRIGHTNESS +void setbri(int dbri); +#endif #ifdef HAVE_LCD_COLOR int hex_to_rgb(const char* hex, int* color);