From: Lars Op den Kamp <lars@opdenkamp.eu>
Date: Fri, 13 Dec 2013 10:26:20 +0000 (+0100)
Subject: suppress sending some commands when the tv is not present/responding to polls
X-Git-Tag: upstream/2.2.0~1^2~3^2~8
X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4e8df669d985ccf7ffa300535a8f8221195ed588;p=deb_libcec.git

suppress sending some commands when the tv is not present/responding to polls
---

diff --git a/src/LibCecTray/controller/actions/ConnectToDevice.cs b/src/LibCecTray/controller/actions/ConnectToDevice.cs
index fa78591..e35906a 100644
--- a/src/LibCecTray/controller/actions/ConnectToDevice.cs
+++ b/src/LibCecTray/controller/actions/ConnectToDevice.cs
@@ -74,9 +74,12 @@ namespace LibCECTray.controller.actions
       SendEvent(UpdateEventType.StatusText, Resources.action_sending_power_on);
       _lib.PowerOnDevices(CecLogicalAddress.Broadcast);
 
-      SendEvent(UpdateEventType.StatusText, Resources.action_detecting_tv_vendor);
-      SendEvent(UpdateEventType.ProgressBar, 30);
-      SendEvent(UpdateEventType.TVVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.Tv));
+      if (_lib.IsActiveDevice(CecLogicalAddress.Tv))
+      {
+        SendEvent(UpdateEventType.StatusText, Resources.action_detecting_tv_vendor);
+        SendEvent(UpdateEventType.ProgressBar, 30);
+        SendEvent(UpdateEventType.TVVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.Tv));
+      }
 
       SendEvent(UpdateEventType.ProgressBar, 50);
       SendEvent(UpdateEventType.StatusText, Resources.action_detecting_avr);
@@ -91,7 +94,7 @@ namespace LibCECTray.controller.actions
         SendEvent(UpdateEventType.AVRVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.AudioSystem));
       }
 
-      if (!_lib.GetDevicePowerStatus(CecLogicalAddress.Tv).Equals(CecPowerStatus.On))
+      if (_lib.IsActiveDevice(CecLogicalAddress.Tv)&& !_lib.GetDevicePowerStatus(CecLogicalAddress.Tv).Equals(CecPowerStatus.On))
       {
         SendEvent(UpdateEventType.ProgressBar, 70);
         SendEvent(UpdateEventType.StatusText, Resources.action_activating_source);