diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 16095b2cd..419cd3769 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -278,21 +278,36 @@ CRCInput::~CRCInput() * stopInput - stop reading rcin for plugins * **************************************************************************/ -void CRCInput::stopInput() +void CRCInput::stopInput(const bool ext) { + if (isLocked()) + return; + input_stopped = true; close(); + if (ext) + postMsg(NeutrinoMessages::LOCK_RC_EXTERN, 0); +} + +bool CRCInput::isLocked(void) +{ + return input_stopped; } /************************************************************************** * restartInput - restart reading rcin after calling plugins * **************************************************************************/ -void CRCInput::restartInput() +void CRCInput::restartInput(const bool ext) { + if (!isLocked()) + return; + close(); open(); input_stopped = false; + if (ext) + postMsg(NeutrinoMessages::UNLOCK_RC_EXTERN, 0); } #if 0 //never used diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index a6d43e9db..0f7869e43 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -278,8 +278,9 @@ class CRCInput { return fd_rc[0]; } - void stopInput(); - void restartInput(); + void stopInput(const bool ext = false); + void restartInput(const bool ext = false); + bool isLocked(void); uint64_t repeat_block; uint64_t repeat_block_generic; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1cef929db..ca1769fa4 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3394,6 +3394,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CRCLock::getInstance()->exec(NULL, CRCLock::NO_USER_INPUT); return messages_return::handled; } + else if (msg == NeutrinoMessages::LOCK_RC_EXTERN || msg == NeutrinoMessages::UNLOCK_RC_EXTERN) + { + printf("CNeutrinoApp::handleMsg: RC is %s now\n", msg == NeutrinoMessages::LOCK_RC_EXTERN ? "LOCKED" : "UNLOCKED"); + return messages_return::handled; + } else if( msg == NeutrinoMessages::CHANGEMODE ) { printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", data & mode_mask, (data & norezap) != norezap); if((data & mode_mask)== mode_radio) { diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 4049ead7e..fe89d019a 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -71,10 +71,13 @@ struct NeutrinoMessages { REMIND = CRCInput::RC_Messages + 18, LOCK_RC = CRCInput::RC_Messages + 19, UNLOCK_RC = CRCInput::RC_Messages + 20, - REBOOT = CRCInput::RC_Messages + 21, - RELOAD_SETUP = CRCInput::RC_Messages + 22, - SHOW_MAINMENU = CRCInput::RC_Messages + 23, - LEAVE_ALL = CRCInput::RC_Messages + 24, + LOCK_RC_EXTERN = CRCInput::RC_Messages + 21, + UNLOCK_RC_EXTERN = CRCInput::RC_Messages + 22, + REBOOT = CRCInput::RC_Messages + 23, + RELOAD_SETUP = CRCInput::RC_Messages + 24, + SHOW_MAINMENU = CRCInput::RC_Messages + 25, + LEAVE_ALL = CRCInput::RC_Messages + 26, + EVT_VOLCHANGED = CRCInput::RC_Events + 1, EVT_MUTECHANGED = CRCInput::RC_Events + 2, diff --git a/src/zapit/include/zapit/client/msgtypes.h b/src/zapit/include/zapit/client/msgtypes.h index dd479f868..c38b754d5 100644 --- a/src/zapit/include/zapit/client/msgtypes.h +++ b/src/zapit/include/zapit/client/msgtypes.h @@ -150,9 +150,8 @@ class CZapitMessages CMD_GET_MODE43 = 109, CMD_SET_MODE43 = 110, CMD_STOP_PIP = 111, - CMD_ZAPTO_EPG = 112 - - + CMD_ZAPTO_EPG = 112, + CMD_LOCKRC = 113 }; struct commandBoolean diff --git a/src/zapit/include/zapit/client/zapitclient.h b/src/zapit/include/zapit/client/zapitclient.h index 0995abf1f..47a90177c 100644 --- a/src/zapit/include/zapit/client/zapitclient.h +++ b/src/zapit/include/zapit/client/zapitclient.h @@ -375,6 +375,9 @@ class CZapitClient:public CBasicClient /* get dvb transmission type */ delivery_system_t getDeliverySystem(void); + /* Lock remote control */ + void lockRc(const bool mute); + void zaptoNvodSubService(const int num); /* send diseqc 1.2 motor command */ diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index a7f3ba252..f733112ef 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -611,6 +611,19 @@ void CZapitClient::getVolume(unsigned int *left, unsigned int *right) close_connection(); } + +void CZapitClient::lockRc(const bool b) +{ + CZapitMessages::commandBoolean msg; + //VALGRIND_PARANOIA; + + msg.truefalse = b; + + OpenThreads::ScopedLock lock(mutex); + send(CZapitMessages::CMD_LOCKRC, (char*)&msg, sizeof(msg)); + + close_connection(); +} #if 0 //never used delivery_system_t CZapitClient::getDeliverySystem(void) diff --git a/src/zapit/src/pzapit.cpp b/src/zapit/src/pzapit.cpp index d31e8a718..744187486 100644 --- a/src/zapit/src/pzapit.cpp +++ b/src/zapit/src/pzapit.cpp @@ -70,6 +70,8 @@ int usage (const char * basename) std::cout << "switch to pal mode: " << basename << " --pal" << std::endl; std::cout << "switch to hd 720p mode: " << basename << " --720p" << std::endl; std::cout << "send diseqc 1.2 motor command: " << basename << " -m " << std::endl; + std::cout << "lock remote control: " << basename << " -lockrc" << std::endl; + std::cout << "unlock remote control: " << basename << " -unlockrc" << std::endl; return -1; } @@ -92,6 +94,7 @@ int main (int argc, char** argv) int nvod = -1; int arat = -1; int m43 = -1; + int lockrc = -1; const char * channelName = NULL; bool playback = false; @@ -351,6 +354,16 @@ int main (int argc, char** argv) continue; } } + else if (!strncmp(argv[i], "-lockrc", 7)) + { + lockrc = 1; + continue; + } + else if (!strncmp(argv[i], "-unlockrc", 9)) + { + lockrc = 0; + continue; + } else if (i < argc - 1) { if ((sscanf(argv[i], "%d", &bouquet) > 0) && (sscanf(argv[++i], "%u", &channel) > 0)) @@ -418,6 +431,11 @@ int main (int argc, char** argv) zapit.setVolume(volume, volume); return 0; } + if (lockrc != -1) + { + zapit.lockRc(lockrc); + return 0; + } if (rezap) { zapit.Rezap(); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 375c1f228..c9febc2d4 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -1862,6 +1862,17 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) break; } + case CZapitMessages::CMD_LOCKRC: { + CZapitMessages::commandBoolean msgBoolean; + CBasicServer::receive_data(connfd, &msgBoolean, sizeof(msgBoolean)); + extern CRCInput *g_RCInput; + if (msgBoolean.truefalse) + g_RCInput->stopInput(true); + else + g_RCInput->restartInput(true); + break; + } + case CZapitMessages::CMD_SET_VOLUME: { CZapitMessages::commandVolume msgVolume; CBasicServer::receive_data(connfd, &msgVolume, sizeof(msgVolume));