cec: don't try to read or write in CUSBCECAdapterCommunication when the connection...
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 8 Feb 2012 22:32:56 +0000 (23:32 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 8 Feb 2012 22:34:51 +0000 (23:34 +0100)
src/lib/adapter/USBCECAdapterCommunication.cpp

index 1d9f562fd5198b295d990cf327735c5b4cbd4732..924c65a8b0a872ac29cdebc106e5b88f42f08817 100644 (file)
@@ -216,6 +216,8 @@ void *CUSBCECAdapterCommunication::Process(void)
 cec_adapter_message_state CUSBCECAdapterCommunication::Write(const cec_command &data, uint8_t iMaxTries, uint8_t iLineTimeout /* = 3 */, uint8_t iRetryLineTimeout /* = 3 */)
 {
   cec_adapter_message_state retVal(ADAPTER_MESSAGE_STATE_UNKNOWN);
+  if (!IsRunning())
+    return retVal;
 
   CCECAdapterMessage *output = new CCECAdapterMessage(data);
 
@@ -261,6 +263,9 @@ bool CUSBCECAdapterCommunication::Write(CCECAdapterMessage *data)
 
 bool CUSBCECAdapterCommunication::Read(cec_command &command, uint32_t iTimeout)
 {
+  if (!IsRunning())
+    return false;
+
   CCECAdapterMessage msg;
   if (Read(msg, iTimeout))
   {