Index: apps/settings.c =================================================================== --- apps/settings.c (revision 17722) +++ apps/settings.c (working copy) @@ -731,6 +731,7 @@ lcd_remote_set_contrast(global_settings.remote_contrast); lcd_remote_set_invert_display(global_settings.remote_invert); lcd_remote_set_flip(global_settings.remote_flip_display); + remote_button_set_flip(global_settings.remote_flip_display); lcd_remote_scroll_speed(global_settings.remote_scroll_speed); lcd_remote_scroll_step(global_settings.remote_scroll_step); lcd_remote_scroll_delay(global_settings.remote_scroll_delay); Index: firmware/export/button.h =================================================================== --- firmware/export/button.h (revision 17722) +++ firmware/export/button.h (working copy) @@ -43,6 +43,7 @@ void set_backlight_filter_keypress(bool value); #ifdef HAVE_REMOTE_LCD void set_remote_backlight_filter_keypress(bool value); +void remote_button_set_flip(bool flip); /* turn 180 degrees */ #endif #endif Index: firmware/drivers/button.c =================================================================== --- firmware/drivers/button.c (revision 17722) +++ firmware/drivers/button.c (working copy) @@ -58,6 +58,7 @@ static bool filter_first_keypress; #ifdef HAVE_REMOTE_LCD static bool remote_filter_first_keypress; +static bool remote_flipped; #endif #endif /* HAVE_BACKLIGHT */ #ifdef HAVE_HEADPHONE_DETECTION @@ -403,6 +404,7 @@ filter_first_keypress = false; #ifdef HAVE_REMOTE_LCD remote_filter_first_keypress = false; + remote_flipped = false; #endif #endif @@ -424,6 +426,31 @@ static int button_flip(int button) { int newbutton; +#ifdef HAVE_LCD_REMOTE + if (button & BUTTON_REMOTE) + { + newbutton = button & +#if CONFIG_KEYPAD == IRIVER_H100_PAD || \ + CONFIG_KEYPAD == IRIVER_H300_PAD + ~(BUTTON_RC_REW | BUTTON_RC_FF | + BUTTON_RC_VOL_UP | BUTTON_RC_VOL_DOWN | + BUTTON_RC_REC | BUTTON_RC_MODE); + if (button & BUTTON_RC_REW) + newbutton |= BUTTON_RC_FF; + if (button & BUTTON_RC_FF) + newbutton |= BUTTON_RC_REW; + if (button & BUTTON_RC_VOL_UP) + newbutton |= BUTTON_RC_VOL_DOWN; + if (button & BUTTON_RC_VOL_DOWN) + newbutton |= BUTTON_RC_VOL_UP; + if (button & BUTTON_RC_REC) + newbutton |= BUTTON_RC_MODE; + if (button & BUTTON_RC_MODE) + newbutton |= BUTTON_RC_REC; +#endif + return newbutton; + } +#endif newbutton = button & ~(BUTTON_LEFT | BUTTON_RIGHT @@ -491,6 +518,18 @@ { remote_filter_first_keypress = value; } + +void remote_button_set_flip(bool flip) +{ + if (flip != remote_flipped) /* not the current setting */ + { + /* avoid race condition with the button_tick() */ + int oldlevel = disable_irq_save(); + lastbtn = button_flip(lastbtn); + remote_flipped = flip; + restore_irq(oldlevel); + } +} #endif #endif @@ -509,9 +548,18 @@ int retval; #ifdef HAVE_LCD_BITMAP - if (btn && flipped) - btn = button_flip(btn); /* swap upside down */ + if (btn) + { + if (flipped +#ifdef HAVE_REMOTE_LCD + || ((btn&BUTTON_REMOTE) && remote_flipped) #endif + ) + { + btn = button_flip(btn); /* swap upside down */ + } + } +#endif /* Filter the button status. It is only accepted if we get the same status twice in a row. */