diff -ruN rockbox-devel/apps/gui/gwps-common.c rockbox/apps/gui/gwps-common.c --- rockbox-devel/apps/gui/gwps-common.c 2006-01-04 03:48:48.000000000 +0900 +++ rockbox/apps/gui/gwps-common.c 2006-01-08 06:08:37.298582400 +0900 @@ -34,6 +34,10 @@ #include "abrepeat.h" #include "mp3_playback.h" #include "backlight.h" +#if ((CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)) +#include "button.h" +#include "remote-flag.h" +#endif #include "lang.h" #include "misc.h" @@ -1954,9 +1958,29 @@ bool exit = false; bool usb = false; int i = 0; +#if ((CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)) + long button_tmp; +#endif while (!exit) { +#if ((CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)) + if (rc_flag[global_settings.remote_type] == true) + { + button_tmp = button & (BUTTON_RRC_FF | BUTTON_RRC_REW | BUTTON_RRC_VOL_UP | BUTTON_RRC_VOL_DOWN); + switch(button_tmp) + { + case BUTTON_RRC_FF: + case BUTTON_RRC_VOL_UP: + button ^= (BUTTON_RRC_FF | BUTTON_RRC_VOL_UP); + break; + case BUTTON_RRC_REW: + case BUTTON_RRC_VOL_DOWN: + button ^= (BUTTON_RRC_REW | BUTTON_RRC_VOL_DOWN); + break; + } + } +#endif switch ( button ) { case WPS_FFWD: diff -ruN rockbox-devel/apps/gui/gwps.c rockbox/apps/gui/gwps.c --- rockbox-devel/apps/gui/gwps.c 2005-12-09 10:11:14.000000000 +0900 +++ rockbox/apps/gui/gwps.c 2006-01-08 06:10:01.930276800 +0900 @@ -26,6 +26,7 @@ #include "font.h" #include "backlight.h" #include "button.h" +#include "remote-flag.h" #include "kernel.h" #include "tree.h" #include "debug.h" @@ -91,6 +92,9 @@ unsigned long right_lastclick = 0; unsigned long left_lastclick = 0; int i; +#if ((CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)) + long button_tmp; +#endif wps_state_init(); @@ -218,6 +222,24 @@ if (!audio_status()) exit = true; +#if ((CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)) + if (rc_flag[global_settings.remote_type] == true) + { + button_tmp = button & (BUTTON_RRC_FF | BUTTON_RRC_REW | BUTTON_RRC_VOL_UP | BUTTON_RRC_VOL_DOWN); + switch(button_tmp) + { + case BUTTON_RRC_FF: + case BUTTON_RRC_VOL_UP: + button ^= (BUTTON_RRC_FF | BUTTON_RRC_VOL_UP); + break; + case BUTTON_RRC_REW: + case BUTTON_RRC_VOL_DOWN: + button ^= (BUTTON_RRC_REW | BUTTON_RRC_VOL_DOWN); + break; + } + } +#endif + switch(button) { #ifdef WPS_CONTEXT diff -ruN rockbox-devel/apps/gui/remote-flag.h rockbox/apps/gui/remote-flag.h --- rockbox-devel/apps/gui/remote-flag.h 1970-01-01 09:00:00.000000000 +0900 +++ rockbox/apps/gui/remote-flag.h 2006-01-07 17:27:05.000000000 +0900 @@ -0,0 +1,24 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: remote-flag.h,v 1.00 2006/1/7 00:17:24 takka Exp $ + * + * Copyright (C) 2006 takka + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _REMOTE_FLAG_H +#define _REMOTE_FLAG_H + +static int rc_flag[4] ={ false, true , true , true }; /* UpDown RightLeft change flag */ + +#endif diff -ruN rockbox-devel/apps/lang/english.lang rockbox/apps/lang/english.lang --- rockbox-devel/apps/lang/english.lang 2005-12-23 00:30:26.000000000 +0900 +++ rockbox/apps/lang/english.lang 2006-01-08 06:04:57.732862400 +0900 @@ -3568,3 +3568,37 @@ eng: "Screen Scroll Step Size" voice: "Screen Scroll Step Size" new: + +id: LANG_REMOTE_TYPE +desc: in settings_menu() +eng: "Remote Type" +voice: "Remote Type" +new: + +id: LANG_REMOTE_TYPE_H100 +desc: Remote type H100 +eng: "H100" +voice: "H100" +new: + + +id: LANG_REMOTE_TYPE_H300_LCD +desc: Remote type H300 LCD +eng: "H300 LCD" +voice: "H300 LCD" +new: + + +id: LANG_REMOTE_TYPE_H300 +desc: Remote type H300 +eng: "H300" +voice: "H300" +new: + + +id: LANG_REMOTE_TYPE_OTHER +desc: Remote type OTHER +eng: "OTHER" +voice: "OTHER" +new: + diff -ruN rockbox-devel/apps/settings.c rockbox/apps/settings.c --- rockbox-devel/apps/settings.c 2005-12-23 00:30:12.000000000 +0900 +++ rockbox/apps/settings.c 2006-01-08 06:04:57.752891200 +0900 @@ -492,6 +492,11 @@ #ifdef HAVE_BACKLIGHT_BRIGHTNESS {4, S_O(brightness), 9, "brightness", NULL }, #endif +#if (CONFIG_KEYPAD == IRIVER_H100_PAD) + {2, S_O(remote_type), RC_TYPE_H100,"remote type", NULL }, +#elif (CONFIG_KEYPAD == IRIVER_H300_PAD) + {2, S_O(remote_type), RC_TYPE_H300,"remote type", NULL }, +#endif #ifdef HAVE_LCD_BITMAP {1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on }, @@ -891,6 +896,7 @@ #ifdef HAVE_REMOTE_LCD_TICKING lcd_remote_emireduce(global_settings.remote_reduce_ticking); #endif + set_remote_type(global_settings.remote_type); remote_backlight_set_timeout(global_settings.remote_backlight_timeout); #ifdef HAVE_CHARGING remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged); diff -ruN rockbox-devel/apps/settings.h rockbox/apps/settings.h --- rockbox-devel/apps/settings.h 2005-12-24 00:51:38.000000000 +0900 +++ rockbox/apps/settings.h 2006-01-08 06:04:57.762905600 +0900 @@ -377,6 +377,7 @@ then according to timeout_values[] */ int remote_backlight_timeout_plugged; bool remote_caption_backlight; /* turn on backlight at end and start of track */ + int remote_type; /* remote type 0=H1x0, 1=H3x0 LCD, 2=H3x0 nonLCD, 3=other */ #ifdef HAVE_REMOTE_LCD_TICKING bool remote_reduce_ticking; /* 0=normal operation, 1=EMI reduce on with cost more CPU. */ diff -ruN rockbox-devel/apps/settings_menu.c rockbox/apps/settings_menu.c --- rockbox-devel/apps/settings_menu.c 2005-12-23 00:30:16.000000000 +0900 +++ rockbox/apps/settings_menu.c 2006-01-08 06:04:57.772920000 +0900 @@ -122,6 +122,19 @@ return rc; } +static bool remote_type(void) +{ + static const struct opt_items names[] = { + { STR(LANG_REMOTE_TYPE_H100) }, + { STR(LANG_REMOTE_TYPE_H300_LCD) }, + { STR(LANG_REMOTE_TYPE_H300) }, + { STR(LANG_REMOTE_TYPE_OTHER) } + }; + bool rc = set_option( str(LANG_REMOTE_TYPE), &global_settings.remote_type, INT, names, 4, NULL); + set_remote_type(global_settings.remote_type); + return rc; +} + #ifdef HAVE_REMOTE_LCD_TICKING static bool remote_reduce_ticking(void) { @@ -1591,6 +1604,7 @@ #ifdef HAVE_REMOTE_LCD_TICKING { ID2P(LANG_REDUCE_TICKING), remote_reduce_ticking }, #endif + { ID2P(LANG_REMOTE_TYPE), remote_type }, }; m=menu_init( items, sizeof(items) / sizeof(*items), NULL, diff -ruN rockbox-devel/firmware/drivers/button.c rockbox/firmware/drivers/button.c --- rockbox-devel/firmware/drivers/button.c 2005-12-23 00:30:38.000000000 +0900 +++ rockbox/firmware/drivers/button.c 2006-01-08 06:04:57.792948800 +0900 @@ -48,6 +48,24 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */ #endif +#ifdef HAVE_REMOTE_LCD +static int remote_type = 0; + +/* H100 , H300 LCD , H300 , OTHER */ +int rc_button_0[4] = { BUTTON_RC_STOP , BUTTON_RC_REW , BUTTON_NONE , BUTTON_RC_STOP }; /* 0x00 <= data < 0x10 */ +int rc_button_1[4] = { BUTTON_RC_VOL_DOWN, BUTTON_RC_VOL_UP , BUTTON_RC_VOL_UP , BUTTON_RC_VOL_DOWN }; /* 0x10 <= data < 0x20 */ +int rc_button_2[4] = { BUTTON_RC_MODE , BUTTON_RC_STOP , BUTTON_RC_VOL_DOWN, BUTTON_RC_MODE }; /* 0x20 <= data < 0x40 */ +int rc_button_3[4] = { BUTTON_RC_VOL_UP , BUTTON_RC_MODE , BUTTON_NONE , BUTTON_RC_VOL_UP }; /* 0x40 <= data < 0x58 */ +int rc_button_4[4] = { BUTTON_RC_BITRATE , BUTTON_RC_REC , BUTTON_NONE , BUTTON_RC_BITRATE }; /* 0x58 <= data < 0x74 */ +int rc_button_5[4] = { BUTTON_RC_REC , BUTTON_RC_ON , BUTTON_NONE , BUTTON_RC_REC }; /* 0x74 <= data < 0x88 */ +int rc_button_6[4] = { BUTTON_RC_SOURCE , BUTTON_RC_BITRATE , BUTTON_NONE , BUTTON_RC_SOURCE }; /* 0x88 <= data < 0xb0 */ +int rc_button_7[4] = { BUTTON_RC_FF , BUTTON_RC_SOURCE , BUTTON_NONE , BUTTON_RC_FF }; /* 0xb0 <= data < 0xc0 */ +int rc_button_8[4] = { BUTTON_RC_MENU , BUTTON_RC_FF , BUTTON_RC_REW , BUTTON_RC_MENU }; /* 0xc0 <= data < 0xd8 */ +int rc_button_9[4] = { BUTTON_RC_REW , BUTTON_RC_VOL_DOWN, BUTTON_RC_FF , BUTTON_RC_REW }; /* 0xd8 <= data < 0xf0 */ +int rc_button_10[4] ={ BUTTON_RC_ON , BUTTON_RC_MENU , BUTTON_RC_ON , BUTTON_RC_ON }; /* GPI01 */ + +#endif + /* how often we check to see if a button is pressed */ #define POLL_FREQUENCY HZ/100 @@ -602,40 +620,40 @@ if (data < 0x74) if (data < 0x40) if (data < 0x20) - if(data < 0x10) - btn = BUTTON_RC_STOP; - else - btn = BUTTON_RC_VOL_DOWN; - else - btn = BUTTON_RC_MODE; + if(data < 0x10) /* 0x00 <= data < 0x10 */ + btn = rc_button_0[remote_type]; + else /* 0x10 <= data < 0x20 */ + btn = rc_button_1[remote_type]; + else /* 0x20 <= data < 0x40 */ + btn = rc_button_2[remote_type]; else - if (data < 0x58) - btn = BUTTON_RC_VOL_UP; - else - btn = BUTTON_RC_BITRATE; + if (data < 0x58) /* 0x40 <= data < 0x58 */ + btn = rc_button_3[remote_type]; + else /* 0x58 <= data < 0x74 */ + btn = rc_button_4[remote_type]; else if (data < 0xb0) - if (data < 0x88) - btn = BUTTON_RC_REC; - else - btn = BUTTON_RC_SOURCE; + if (data < 0x88) /* 0x74 <= data < 0x88 */ + btn = rc_button_5[remote_type]; + else /* 0x88 <= data < 0xb0 */ + btn = rc_button_6[remote_type]; else if (data < 0xd8) - if(data < 0xc0) - btn = BUTTON_RC_FF; - else - btn = BUTTON_RC_MENU; - else - if (data < 0xf0) - btn = BUTTON_RC_REW; - } - + if(data < 0xc0) /* 0xb0 <= data < 0xc0 */ + btn = rc_button_7[remote_type]; + else /* 0xc0 <= data < 0xd8 */ + btn = rc_button_8[remote_type]; + else + if (data < 0xf0) /* 0xd8 <= data < 0xf0 */ + btn = rc_button_9[remote_type]; + } /* 0xf0 <= data */ + /* special buttons */ data = GPIO1_READ; if (!hold_button && ((data & 0x20) == 0)) btn |= BUTTON_ON; if (!remote_hold_button && ((data & 0x40) == 0)) - btn |= BUTTON_RC_ON; + btn |= rc_button_10[remote_type]; #elif CONFIG_KEYPAD == IRIVER_H300_PAD @@ -687,33 +705,33 @@ if (data < 0x74) if (data < 0x40) if (data < 0x20) - if(data < 0x10) - btn = BUTTON_RC_STOP; - else - btn = BUTTON_RC_VOL_DOWN; - else - btn = BUTTON_RC_MODE; + if(data < 0x10) /* 0x00 <= data < 0x10 */ + btn = rc_button_0[remote_type]; + else /* 0x10 <= data < 0x20 */ + btn = rc_button_1[remote_type]; + else /* 0x20 <= data < 0x40 */ + btn = rc_button_2[remote_type]; else - if (data < 0x58) - btn = BUTTON_RC_VOL_UP; - else - btn = BUTTON_RC_BITRATE; + if (data < 0x58) /* 0x40 <= data < 0x58 */ + btn = rc_button_3[remote_type]; + else /* 0x58 <= data < 0x74 */ + btn = rc_button_4[remote_type]; else if (data < 0xb0) - if (data < 0x88) - btn = BUTTON_RC_REC; - else - btn = BUTTON_RC_SOURCE; + if (data < 0x88) /* 0x74 <= data < 0x88 */ + btn = rc_button_5[remote_type]; + else /* 0x88 <= data < 0xb0 */ + btn = rc_button_6[remote_type]; else if (data < 0xd8) - if(data < 0xc0) - btn = BUTTON_RC_FF; - else - btn = BUTTON_RC_MENU; - else - if (data < 0xf0) - btn = BUTTON_RC_REW; - } + if(data < 0xc0) /* 0xb0 <= data < 0xc0 */ + btn = rc_button_7[remote_type]; + else /* 0xc0 <= data < 0xd8 */ + btn = rc_button_8[remote_type]; + else + if (data < 0xf0) /* 0xd8 <= data < 0xf0 */ + btn = rc_button_9[remote_type]; + } /* 0xf0 <= data */ /* special buttons */ if (!hold_button) @@ -729,7 +747,7 @@ if (!hold_button && ((data & 0x20) == 0)) btn |= BUTTON_ON; if (!remote_hold_button && ((data & 0x40) == 0)) - btn |= BUTTON_RC_ON; + btn |= rc_button_10[remote_type]; #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD @@ -909,7 +927,19 @@ static bool remote_button_hold_only(void) { - return (GPIO1_READ & 0x00100000)?true:false; + bool rc = false; + switch(remote_type) + { + case RC_TYPE_H300: + rc = (adc_scan(ADC_REMOTE) == 0x00)?true:false; + break; + case RC_TYPE_H100: + case RC_TYPE_H300_LCD: + case RC_TYPE_OTHER: + rc = (GPIO1_READ & 0x00100000)?true:false; + break; + } + return rc; } bool remote_button_hold(void) @@ -935,3 +965,7 @@ queue_clear(&button_queue); } +void set_remote_type(int type) +{ + remote_type = type; +} diff -ruN rockbox-devel/firmware/export/button.h rockbox/firmware/export/button.h --- rockbox-devel/firmware/export/button.h 2005-12-19 09:11:28.000000000 +0900 +++ rockbox/firmware/export/button.h 2006-01-08 06:04:57.802963200 +0900 @@ -45,6 +45,8 @@ bool remote_button_hold(void); #endif +extern void set_remote_type(int type); + #if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD bool button_hold(void); #endif @@ -66,6 +68,14 @@ #define BUTTON_RC_LEFT (BUTTON_LEFT | BUTTON_REMOTE) #define BUTTON_RC_RIGHT (BUTTON_RIGHT| BUTTON_REMOTE) +#define BUTTON_RRC_VOL_UP 0x00000008 +#define BUTTON_RRC_VOL_DOWN 0x00000800 +#define BUTTON_RRC_FF 0x02000000 +#define BUTTON_RRC_REW 0x04000000 +#define RC_TYPE_H100 0 +#define RC_TYPE_H300_LCD 1 +#define RC_TYPE_H300 2 +#define RC_TYPE_OTHER 3 #if CONFIG_KEYPAD == IRIVER_H100_PAD /* iRiver H100 specific button codes */ diff -ru rockbox-devel/apps/tree.c rockbox/apps/tree.c --- rockbox-devel/apps/tree.c 2005-12-06 07:44:41.000000000 +0900 +++ rockbox/apps/tree.c 2005-12-17 14:57:27.480700800 +0900 @@ -576,11 +576,14 @@ switch ( button ) { #ifdef TREE_ENTER case TREE_ENTER: - case TREE_ENTER | BUTTON_REPEAT: +// case TREE_ENTER | BUTTON_REPEAT: #endif #ifdef TREE_RC_RUN case TREE_RC_RUN: #endif +#ifdef TREE_RC_ENTER + case TREE_RC_ENTER: +#endif case TREE_RUN: #ifdef TREE_RUN_PRE if (((button == TREE_RUN) @@ -606,17 +609,30 @@ break; case TREE_EXIT: - case TREE_EXIT | BUTTON_REPEAT: +// case TREE_EXIT | BUTTON_REPEAT: #ifdef TREE_RC_EXIT case TREE_RC_EXIT: #endif +#ifdef TREE_RC_EXIT2 + case TREE_RC_EXIT2: +#endif +#ifdef TREE_RC_EXIT3 + case TREE_RC_EXIT3: + if (lastbutton == TREE_RC_EXIT3) + break; +#endif if (*tc.dirfilter > NUM_FILTER_MODES && tc.dirlevel < 1) { exit_func = true; break; } /* if we are in /, nothing to do */ if (tc.dirlevel == 0) + { + if (audio_status() & AUDIO_STATUS_PLAY) + start_wps=true; + while(button_get_w_tmo(HZ/5)) {} break; + } if (id3db) db_exit(&tc); diff -ru rockbox-devel/apps/tree.h rockbox/apps/tree.h --- rockbox-devel/apps/tree.h 2005-11-22 12:38:07.000000000 +0900 +++ rockbox/apps/tree.h 2005-12-17 15:00:57.713000000 +0900 @@ -52,6 +52,9 @@ #define TREE_RC_PGUP BUTTON_RC_SOURCE #define TREE_RC_PGDN BUTTON_RC_BITRATE #define TREE_RC_EXIT BUTTON_RC_STOP +#define TREE_RC_ENTER BUTTON_RC_VOL_UP +#define TREE_RC_EXIT2 BUTTON_RC_VOL_DOWN +#define TREE_RC_EXIT3 (BUTTON_RC_MENU | BUTTON_REPEAT) #define TREE_RC_RUN (BUTTON_RC_MENU | BUTTON_REL) #define TREE_RC_RUN_PRE BUTTON_RC_MENU #define TREE_RC_MENU (BUTTON_RC_MODE | BUTTON_REL) diff -ru rockbox-devel/apps/menu.c rockbox/apps/menu.c --- rockbox-devel/apps/menu.c 2005-12-06 07:44:42.000000000 +0900 +++ rockbox/apps/menu.c 2005-12-23 07:28:15.802593600 +0900 @@ -64,6 +64,9 @@ static struct menu menus[MAX_MENUS]; static bool inuse[MAX_MENUS] = { false }; +static int lastkey = BUTTON_NONE; + + char * menu_get_itemname(int selected_item, void * data, char *buffer) { struct menu *local_menus=(struct menu *)data; @@ -153,6 +156,13 @@ #ifdef MENU_RC_ENTER2 case MENU_RC_ENTER2: #endif +#ifdef MENU_RC_ENTER3 + case MENU_RC_ENTER3: +#endif +#ifdef MENU_RC_ENTER2_PRE + if ((key == MENU_RC_ENTER2) && (lastkey != MENU_RC_ENTER2_PRE)) + break; +#endif return gui_synclist_get_sel_pos(&(menus[m].synclist)); @@ -169,6 +179,14 @@ #ifdef MENU_RC_EXIT_MENU case MENU_RC_EXIT_MENU: #endif +#ifdef MENU_RC_EXIT2 + case MENU_RC_EXIT2: +#endif +#ifdef MENU_RC_EXIT3 + case MENU_RC_EXIT3: + if (lastkey == MENU_RC_EXIT3) + break; +#endif exit = true; break; @@ -177,6 +195,8 @@ return MENU_ATTACHED_USB; break; } + if ( key ) + lastkey = key; gui_syncstatusbar_draw(&statusbars, false); } return MENU_SELECTED_EXIT; diff -ru rockbox-devel/apps/menu.h rockbox/apps/menu.h --- rockbox-devel/apps/menu.h 2005-12-19 09:11:26.000000000 +0900 +++ rockbox/apps/menu.h 2005-12-22 22:44:04.982416000 +0900 @@ -34,8 +34,12 @@ #define MENU_RC_EXIT BUTTON_RC_STOP #define MENU_RC_EXIT_MENU BUTTON_RC_MODE #define MENU_RC_ENTER BUTTON_RC_ON -#define MENU_RC_ENTER2 BUTTON_RC_MENU +#define MENU_RC_ENTER2 (BUTTON_RC_MENU | BUTTON_REL) +#define MENU_RC_ENTER2_PRE BUTTON_RC_MENU +#define MENU_RC_ENTER3 BUTTON_RC_VOL_UP +#define MENU_RC_EXIT2 BUTTON_RC_VOL_DOWN +#define MENU_RC_EXIT3 (BUTTON_RC_MENU | BUTTON_REPEAT) #elif CONFIG_KEYPAD == RECORDER_PAD