summaryrefslogtreecommitdiff
authorTellen Yu <tellen.yu@amlogic.com>2016-02-17 09:18:46 (GMT)
committer Tellen Yu <tellen.yu@amlogic.com>2016-02-17 09:18:46 (GMT)
commit21808c24992aef5fd7aaeb1d68dca29c79f2dbd1 (patch)
tree9c8e26d4e6b69402932c3b9f59fb23d669cd6982
parenta8b07dba8dc814868f61e4838655948cf4dc4f85 (diff)
downloadtv_input-21808c24992aef5fd7aaeb1d68dca29c79f2dbd1.zip
tv_input-21808c24992aef5fd7aaeb1d68dca29c79f2dbd1.tar.gz
tv_input-21808c24992aef5fd7aaeb1d68dca29c79f2dbd1.tar.bz2
tvin detect thread need use tvin object that has been initialized
Change-Id: I6301a8226ea4c310ea19b86289ed75c032c069aa
Diffstat
-rw-r--r--tvapi/libtv/tv/CTv.cpp2
-rw-r--r--tvapi/libtv/tvin/CTvin.cpp14
-rw-r--r--tvapi/libtv/tvin/CTvin.h3
-rw-r--r--tvapi/libtv/tvutils/CTvInput.cpp47
4 files changed, 34 insertions, 32 deletions
diff --git a/tvapi/libtv/tv/CTv.cpp b/tvapi/libtv/tv/CTv.cpp
index 3ed762b..f3c8764 100644
--- a/tvapi/libtv/tv/CTv.cpp
+++ b/tvapi/libtv/tv/CTv.cpp
@@ -72,6 +72,7 @@ static void sqliteLogCallback(void *data, int iErrCode, const char *zMsg)
}
CTv::CTv() :
+ mSigDetectThread(&mTvin),
mSourceConnectDetectThread(&mTvin),
mHDMIRxCEC ( &mTvin ),
mTvScanner ( &mTvin ),
@@ -1639,7 +1640,6 @@ int CTv::StartTvLock ()
mFrontDev.Open(FE_ANALOG);
mFrontDev.autoLoadFE();
mSigDetectThread.startDetect();
- mSigDetectThread.initSigState();
mTvMsgQueue.startMsgQueue();
resetDmxAndAvSource();
SetDisplayMode ( mVpp.GetDisplayMode ( CTvin::Tvin_SourceInputToSourceInputType(m_source_input) ), CTvin::Tvin_SourceInputToSourceInputType(m_source_input), mSigDetectThread.getCurSigInfo().fmt);
diff --git a/tvapi/libtv/tvin/CTvin.cpp b/tvapi/libtv/tvin/CTvin.cpp
index 07e5b67..fd90068 100644
--- a/tvapi/libtv/tvin/CTvin.cpp
+++ b/tvapi/libtv/tvin/CTvin.cpp
@@ -3029,11 +3029,12 @@ int CTvin::get_hdmi_sampling_rate()
}
//**************************************************************************
-CTvin::CTvinSigDetect::CTvinSigDetect ()
+CTvin::CTvinSigDetect::CTvinSigDetect (CTvin *pTvin)
{
mDetectState = STATE_STOPED;
mpObserver = NULL;
+ mpTvin = pTvin;
initSigState();
}
@@ -3049,14 +3050,8 @@ int CTvin::CTvinSigDetect::startDetect(bool bPause)
return mDetectState;
}
- m_cur_sig_info.trans_fmt = TVIN_TFMT_2D;
- m_cur_sig_info.fmt = TVIN_SIG_FMT_NULL;
- m_cur_sig_info.status = TVIN_SIG_STATUS_NULL;
- m_cur_sig_info.reserved = 0;
-
- m_pre_sig_info = m_cur_sig_info;
-
m_request_pause_detect = bPause;
+ initSigState();
this->run();
return mDetectState;
}
@@ -3122,8 +3117,7 @@ void CTvin::CTvinSigDetect::setVdinNoSigCheckKeepTimes(int times, bool isOnce)
int CTvin::CTvinSigDetect::Tv_TvinSigDetect ( int &sleeptime )
{
- CTvin tvin;
- tvin.VDIN_GetSignalInfo ( &m_cur_sig_info ); //get info
+ mpTvin->VDIN_GetSignalInfo ( &m_cur_sig_info ); //get info
//set no sig check times
static long long sNosigKeepTime = 0;
//LOGD("stime=%d status=%d, fmt = %d sNosigKeepTime = %d, mKeepNosigTime = %d", sleeptime, m_cur_sig_info.status,m_cur_sig_info.fmt, sNosigKeepTime, mKeepNosigTime);
diff --git a/tvapi/libtv/tvin/CTvin.h b/tvapi/libtv/tvin/CTvin.h
index 1f7b8be..61ba064 100644
--- a/tvapi/libtv/tvin/CTvin.h
+++ b/tvapi/libtv/tvin/CTvin.h
@@ -1156,7 +1156,7 @@ public:
class CTvinSigDetect: public CThread {
public:
static const int VDIN_NOSIG_DEFAULT_CHECK_TIMES = 1;
- CTvinSigDetect ();
+ CTvinSigDetect (CTvin *pTvin);
~CTvinSigDetect();
int startDetect(bool bPause = true);
int stopDetect();
@@ -1206,6 +1206,7 @@ public:
int Tv_TvinSigDetect ( int &args );
//member
+ CTvin *mpTvin;
tvin_info_t m_cur_sig_info;
tvin_info_t m_pre_sig_info;
int mKeepNosigTime;
diff --git a/tvapi/libtv/tvutils/CTvInput.cpp b/tvapi/libtv/tvutils/CTvInput.cpp
index 87d7352..7e3af96 100644
--- a/tvapi/libtv/tvutils/CTvInput.cpp
+++ b/tvapi/libtv/tvutils/CTvInput.cpp
@@ -5,14 +5,19 @@
#include <fcntl.h>
#include <CTvLog.h>
#include <utils/Timers.h>
+
#define LOG_TAG "FBC"
+
+#define SEND_KEY_ACTION_UP 0x00
+#define SEND_KEY_ACTION_DOWN 0x01
+
CTvInput::CTvInput()
{
mKeyEventFd_IR = open(KEY_EVENT_0, O_RDWR);
mKeyEventFd = open(KEY_EVENT_1, O_RDWR);
if (mKeyEventFd < 0 || mKeyEventFd_IR < 0) {
LOGD( "could not open /dev/input/event1\n ");
- return ;
+ return;
}
mRepeatKeyCode = -1;
mRepeatKeydisTime = -1;
@@ -38,7 +43,7 @@ void CTvInput::sendkeyEvent(const int &type, const int &code, const int &value)
ret = write(mKeyEventFd, &event, sizeof(event));
if (ret < sizeof(event)) {
LOGD("sendkeyEvent :write event failed, %s\n", strerror(errno));
- return ;
+ return;
}
}
@@ -54,53 +59,55 @@ void CTvInput::sendIRkeyEvent(const int &type, const int &code, const int &value
ret = write(mKeyEventFd_IR, &event, sizeof(event));
if (ret < sizeof(event)) {
LOGD("sendIRkeyEvent :write event failed, %s\n", strerror(errno));
- return ;
+ return;
}
}
void CTvInput::sendkeyCode(const int &code)
{
- sendkeyEvent(1 , code, 1); //down
- sendkeyEvent(0, 0, 0); //clear
- sendkeyEvent(1 , code, 0); //up
- sendkeyEvent(0, 0, 0); //clear
+ sendkeyEvent(EV_KEY , code, SEND_KEY_ACTION_DOWN); //down
+ sendkeyEvent(EV_SYN, 0, 0); //clear
+ sendkeyEvent(EV_KEY , code, SEND_KEY_ACTION_UP); //up
+ sendkeyEvent(EV_SYN, 0, 0); //clear
}
void CTvInput::sendkeyCode_Up(const int &code)
{
- sendkeyEvent(1 , code, 0); //up
- sendkeyEvent(0, 0, 0); //clear
+ sendkeyEvent(EV_KEY , code, SEND_KEY_ACTION_UP); //up
+ sendkeyEvent(EV_SYN, 0, 0); //clear
}
void CTvInput::sendkeyCode_Down(const int &code)
{
- sendkeyEvent(1 , code, 1); //down
- sendkeyEvent(0, 0, 0); //clear
+ sendkeyEvent(EV_KEY , code, SEND_KEY_ACTION_DOWN); //down
+ sendkeyEvent(EV_SYN, 0, 0); //clear
}
+
void CTvInput::sendIRkeyCode(const int &code)
{
- sendIRkeyEvent(1 , code, 1); //down
- sendIRkeyEvent(0, 0, 0); //clear
- sendIRkeyEvent(1 , code, 0); //up
- sendIRkeyEvent(0, 0, 0); //clear
+ sendIRkeyEvent(EV_KEY , code, SEND_KEY_ACTION_DOWN); //down
+ sendIRkeyEvent(EV_SYN, 0, 0); //clear
+ sendIRkeyEvent(EV_KEY , code, SEND_KEY_ACTION_UP); //up
+ sendIRkeyEvent(EV_SYN, 0, 0); //clear
}
void CTvInput::sendIRkeyCode_Up(const int &code)
{
- sendIRkeyEvent(1 , code, 0); //up
- sendIRkeyEvent(0, 0, 0); //clear
+ sendIRkeyEvent(EV_KEY , code, SEND_KEY_ACTION_UP); //up
+ sendIRkeyEvent(EV_SYN, 0, 0); //clear
}
void CTvInput::sendIRkeyCode_Down(const int &code)
{
- sendIRkeyEvent(1 , code, 1); //down
- sendIRkeyEvent(0, 0, 0); //clear
+ sendIRkeyEvent(EV_KEY , code, SEND_KEY_ACTION_DOWN); //down
+ sendIRkeyEvent(EV_SYN, 0, 0); //clear
}
nsecs_t CTvInput::getNowMs()
{
return systemTime(SYSTEM_TIME_MONOTONIC) / 1000000;
}
+
void CTvInput::sendKeyRepeatStart(const int &code, int disTime, int repeatDisTime)
{
CMutex::Autolock _l(mLock);
@@ -120,7 +127,7 @@ void CTvInput::sendKeyRepeatStop()
mRepeatKeydisTime = -1;
}
-bool CTvInput::threadLoop()
+bool CTvInput::threadLoop()
{
int sleeptime = 100;//ms