From 4bc98666836fb60be59fae35c0b3cf9abcc7d700 Mon Sep 17 00:00:00 2001 From: focus Date: Fri, 17 Sep 2010 12:41:59 +0000 Subject: [PATCH] Update to test descrete codes. Power-toggle key should be redefined, if power key should work as descrete power-on git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@775 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/english.locale | 1 + src/driver/rcinput.cpp | 16 +++++++++++++ src/driver/rcinput.h | 18 +++++++++++++++ src/neutrino.cpp | 46 +++++++++++++++++++++++++++++++------- src/neutrino_menue.cpp | 7 +++++- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/system/settings.h | 1 + 8 files changed, 82 insertions(+), 9 deletions(-) diff --git a/data/locale/english.locale b/data/locale/english.locale index 17f43acec..fb22a95d0 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -431,6 +431,7 @@ keybindingmenu.lastchannel Quick Zap keybindingmenu.modechange Modechange keybindingmenu.pagedown page down keybindingmenu.pageup page up +keybindingmenu.poweroff Power toggle keybindingmenu.quickzap Quickzap keybindingmenu.repeatblock repeat delay keybindingmenu.repeatblockgeneric generic delay diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index a267662ef..128c79db7 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1448,6 +1448,22 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key) return "prev"; case RC_nokey: return "none"; + case RC_power_on: + return "power on"; + case RC_power_off: + return "power off"; + case RC_standby_on: + return "standby on"; + case RC_standby_off: + return "standby off"; + case RC_mute_on: + return "mute on"; + case RC_mute_off: + return "mute off"; + case RC_analog_on: + return "analog on"; + case RC_analog_off: + return "analog off"; default: printf("unknown key: %d (0x%x) \n", key, key); return "unknown"; diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 6add6ca1d..6322e4590 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -75,6 +75,15 @@ #define KEY_BOTTOMRIGHT 0x1a5 #endif +#define KEY_POWERON KEY_FN_F1 +#define KEY_POWEROFF KEY_FN_F2 +#define KEY_STANDBYON KEY_FN_F3 +#define KEY_STANDBYOFF KEY_FN_F4 +#define KEY_MUTEON KEY_FN_F5 +#define KEY_MUTEOFF KEY_FN_F6 +#define KEY_ANALOGON KEY_FN_F7 +#define KEY_ANALOGOFF KEY_FN_F8 + typedef uint32_t neutrino_msg_t; typedef uint32_t neutrino_msg_data_t; @@ -188,7 +197,16 @@ class CRCInput RC_games = KEY_GAMES, RC_next = KEY_NEXT, RC_prev = KEY_PREVIOUS, + RC_www = KEY_WWW, + RC_power_on = KEY_POWERON, + RC_power_off = KEY_POWEROFF, + RC_standby_on = KEY_STANDBYON, + RC_standby_off = KEY_STANDBYOFF, + RC_mute_on = KEY_MUTEON, + RC_mute_off = KEY_MUTEOFF, + RC_analog_on = KEY_ANALOGON, + RC_analog_off = KEY_ANALOGOFF, RC_timeout = 0xFFFFFFFF, RC_nokey = 0xFFFFFFFE }; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 82088ed8e..e80454604 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1019,6 +1019,7 @@ printf("***************************** rec dir %s timeshift dir %s\n", g_settings //rc-key configuration g_settings.key_tvradio_mode = configfile.getInt32( "key_tvradio_mode", CRCInput::RC_nokey ); + g_settings.key_power_off = configfile.getInt32( "key_power_off", CRCInput::RC_standby ); g_settings.key_channelList_pageup = configfile.getInt32( "key_channelList_pageup", CRCInput::RC_page_up ); g_settings.key_channelList_pagedown = configfile.getInt32( "key_channelList_pagedown", CRCInput::RC_page_down ); @@ -1544,6 +1545,7 @@ void CNeutrinoApp::saveSetup(const char * fname) //rc-key configuration configfile.setInt32( "key_tvradio_mode", g_settings.key_tvradio_mode ); + configfile.setInt32( "key_power_off", g_settings.key_power_off ); configfile.setInt32( "key_channelList_pageup", g_settings.key_channelList_pageup ); configfile.setInt32( "key_channelList_pagedown", g_settings.key_channelList_pagedown ); @@ -3187,7 +3189,21 @@ _repeat: return messages_return::handled; } } - else if (msg == CRCInput::RC_standby) { + else if (msg == CRCInput::RC_standby_on) { + if (data == 0) + g_RCInput->postMsg(NeutrinoMessages::STANDBY_ON, 0); + return messages_return::handled; + } + else if (msg == CRCInput::RC_standby_off) { + if (data == 0) + g_RCInput->postMsg(NeutrinoMessages::STANDBY_OFF, 0); + return messages_return::handled; + } + else if (msg == CRCInput::RC_power_off) { + g_RCInput->postMsg(NeutrinoMessages::SHUTDOWN, 0); + return messages_return::handled; + } + else if (msg == (neutrino_msg_t) g_settings.key_power_off /*CRCInput::RC_standby*/) { if (data == 0) { neutrino_msg_t new_msg; @@ -3242,6 +3258,7 @@ _repeat: g_RCInput->postMsg(new_msg, 0); return messages_return::cancel_all | messages_return::handled; } + return messages_return::handled; #if 0 else /* data == 1: KEY_POWER released */ if (standby_pressed_at.tv_sec != 0) /* check if we received a KEY_POWER pressed event before */ @@ -3264,13 +3281,6 @@ _repeat: setVolume(msg, (mode != mode_scart)); return messages_return::handled; } -#if 0 - else if ((msg == CRCInput::RC_left) || (msg == CRCInput::RC_right)) // FIXME temp, until new remote - { - setVolume(msg, (mode != mode_scart)); - return messages_return::handled; - } -#endif else if( msg == CRCInput::RC_spkr ) { if( mode == mode_standby ) { //switch lcd off/on @@ -3282,6 +3292,24 @@ _repeat: } return messages_return::handled; } + else if( msg == CRCInput::RC_mute_on ) { + AudioMute( true, true); + return messages_return::handled; + } + else if( msg == CRCInput::RC_mute_off ) { + AudioMute( false, true); + return messages_return::handled; + } + else if( msg == CRCInput::RC_analog_on ) { + g_settings.analog_out = 1; + audioDecoder->EnableAnalogOut(true); + return messages_return::handled; + } + else if( msg == CRCInput::RC_analog_off ) { + g_settings.analog_out = 0; + audioDecoder->EnableAnalogOut(false); + return messages_return::handled; + } else if( msg == CRCInput::RC_mode ) { videoSettings->nextMode(); return messages_return::handled; @@ -5072,6 +5100,7 @@ void CNeutrinoApp::loadKeys(const char * fname) if(!res) return; //rc-key configuration g_settings.key_tvradio_mode = tconfig.getInt32( "key_tvradio_mode", CRCInput::RC_nokey ); + g_settings.key_power_off = tconfig.getInt32( "power_off", CRCInput::RC_standby ); g_settings.key_channelList_pageup = tconfig.getInt32( "key_channelList_pageup", CRCInput::RC_minus ); g_settings.key_channelList_pagedown = tconfig.getInt32( "key_channelList_pagedown", CRCInput::RC_plus ); @@ -5116,6 +5145,7 @@ void CNeutrinoApp::saveKeys(const char * fname) CConfigFile tconfig(',', true); //rc-key configuration tconfig.setInt32( "key_tvradio_mode", g_settings.key_tvradio_mode ); + tconfig.setInt32( "key_power_off", g_settings.key_power_off ); tconfig.setInt32( "key_channelList_pageup", g_settings.key_channelList_pageup ); tconfig.setInt32( "key_channelList_pagedown", g_settings.key_channelList_pagedown ); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 41169c324..d81ea0c50 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -2761,6 +2761,7 @@ const CMenuOptionChooser::keyval KEYBINDINGMENU_BOUQUETHANDLING_OPTIONS[KEYBINDI enum keynames { KEY_TV_RADIO_MODE, + KEY_POWER_OFF, KEY_PAGE_UP, KEY_PAGE_DOWN, KEY_LIST_START, @@ -2791,10 +2792,11 @@ enum keynames { KEY_UNLOCK }; -#define KEYBINDS_COUNT 29 +#define KEYBINDS_COUNT 30 const neutrino_locale_t keydescription_head[KEYBINDS_COUNT] = { LOCALE_KEYBINDINGMENU_TVRADIOMODE, + LOCALE_KEYBINDINGMENU_POWEROFF, LOCALE_KEYBINDINGMENU_PAGEUP, LOCALE_KEYBINDINGMENU_PAGEDOWN, LOCALE_EXTRA_KEY_LIST_START, @@ -2828,6 +2830,7 @@ const neutrino_locale_t keydescription_head[KEYBINDS_COUNT] = const neutrino_locale_t keydescription[KEYBINDS_COUNT] = { LOCALE_KEYBINDINGMENU_TVRADIOMODE, + LOCALE_KEYBINDINGMENU_POWEROFF, LOCALE_KEYBINDINGMENU_PAGEUP, LOCALE_KEYBINDINGMENU_PAGEDOWN, LOCALE_EXTRA_KEY_LIST_START, @@ -2882,6 +2885,7 @@ void CNeutrinoApp::InitKeySettings(CMenuWidget &keySettings) int * keyvalue_p[KEYBINDS_COUNT] = { &g_settings.key_tvradio_mode, + &g_settings.key_power_off, &g_settings.key_channelList_pageup, &g_settings.key_channelList_pagedown, &g_settings.key_list_start, @@ -2926,6 +2930,7 @@ void CNeutrinoApp::InitKeySettings(CMenuWidget &keySettings) bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MODECHANGE)); bindSettings->addItem(new CMenuForwarder(keydescription[KEY_TV_RADIO_MODE], true, NULL, keychooser[KEY_TV_RADIO_MODE])); + bindSettings->addItem(new CMenuForwarder(keydescription[KEY_POWER_OFF], true, NULL, keychooser[KEY_POWER_OFF])); bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_CHANNELLIST)); diff --git a/src/system/locals.h b/src/system/locals.h index 14aa37533..bf9bc53b5 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -461,6 +461,7 @@ typedef enum { LOCALE_KEYBINDINGMENU_MODECHANGE, LOCALE_KEYBINDINGMENU_PAGEDOWN, LOCALE_KEYBINDINGMENU_PAGEUP, + LOCALE_KEYBINDINGMENU_POWEROFF, LOCALE_KEYBINDINGMENU_QUICKZAP, LOCALE_KEYBINDINGMENU_REPEATBLOCK, LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 313e5f191..de71d31b6 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -461,6 +461,7 @@ const char *locale_real_names[] = { "keybindingmenu.modechange", "keybindingmenu.pagedown", "keybindingmenu.pageup", + "keybindingmenu.poweroff", "keybindingmenu.quickzap", "keybindingmenu.repeatblock", "keybindingmenu.repeatblockgeneric", diff --git a/src/system/settings.h b/src/system/settings.h index 73feff459..45a5fc50b 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -274,6 +274,7 @@ struct SNeutrinoSettings int key_lastchannel; int key_list_start; int key_list_end; + int key_power_off; int menu_left_exit; int audio_run_player; int key_click;