# HG changeset patch # User Stephane Lenclud # Date 1468776929 -7200 # Node ID ce63ebb51da4816a28042767a688cbe79b2d1247 # Parent 8784c59c784e2b9c71db552a5b900898fdb1d49e Published V0.9.1.0 Fixing libcec to prevent turning back on TV after standby. diff -r 8784c59c784e -r ce63ebb51da4 Server/CecClient.cs --- a/Server/CecClient.cs Sat Jul 16 00:24:08 2016 +0200 +++ b/Server/CecClient.cs Sun Jul 17 19:35:29 2016 +0200 @@ -44,10 +44,10 @@ /// /// /// - public Client(string aDeviceName, byte aHdmiPort, CecLogLevel aLogLevel = CecLogLevel.Warning) + public Client(string aDeviceName, byte aHdmiPort, CecDeviceType aDeviceType = CecDeviceType.PlaybackDevice, CecLogLevel aLogLevel = CecLogLevel.Warning) { Config = new LibCECConfiguration(); - Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice; + Config.DeviceTypes.Types[0] = aDeviceType; Config.DeviceName = aDeviceName; Config.HDMIPort = aHdmiPort; //Config.ClientVersion = LibCECConfiguration.CurrentVersion; @@ -509,21 +509,7 @@ LogLevel = int.Parse(splitCommand[1]); } } - - /// TODO: remove that - static void Main(string[] args) - { - Client p = new Client("CEC",2, CecLogLevel.All); - if (p.Connect(10000)) - { - p.MainLoop(); - } - else - { - Console.WriteLine("Could not open a connection to the CEC adapter"); - } - } - + /// /// Provide direct access to CEC library /// diff -r 8784c59c784e -r ce63ebb51da4 Server/ConsumerElectronicControl.cs --- a/Server/ConsumerElectronicControl.cs Sat Jul 16 00:24:08 2016 +0200 +++ b/Server/ConsumerElectronicControl.cs Sun Jul 17 19:35:29 2016 +0200 @@ -51,7 +51,7 @@ } //CEC - iCecClient = new Cec.Client(aDeviceName,aHdmiPort, CecLogLevel.Notice); + iCecClient = new Cec.Client(aDeviceName,aHdmiPort, CecDeviceType.PlaybackDevice, CecLogLevel.All&~CecLogLevel.Traffic&~CecLogLevel.Debug); if (!iCecClient.Connect(1000)) { Debug.WriteLine("WARNING: No CEC connection!"); @@ -80,16 +80,24 @@ private void OnMonitorPowerOn() { - Debug.WriteLine("ON"); - iCecClient.Lib.PowerOnDevices(CecLogicalAddress.Tv); - iCecClient.Lib.SetActiveSource(CecDeviceType.Tv); + Console.WriteLine("ON"); + //Turn on the TV + //iCecClient.Lib.PowerOnDevices(CecLogicalAddress.Tv); + //iCecClient.Lib.SendKeypress(CecLogicalAddress.Tv,CecUserControlCode.PowerOnFunction,true); + //Set ourselves as the active source + iCecClient.Lib.SetActiveSource(CecDeviceType.PlaybackDevice); MonitorPowerOn = true; } private void OnMonitorPowerOff() { - Debug.WriteLine("OFF"); + Console.WriteLine("OFF"); + //Try turning off the TV iCecClient.Lib.StandbyDevices(CecLogicalAddress.Tv); + //iCecClient.Lib.SendKeypress(CecLogicalAddress.Tv, CecUserControlCode.PowerOffFunction, true); + //Tell everyone that we are no longer active + //iCecClient.Lib.SetInactiveView(); + MonitorPowerOn = false; } diff -r 8784c59c784e -r ce63ebb51da4 Server/SharpDisplayManager.csproj --- a/Server/SharpDisplayManager.csproj Sat Jul 16 00:24:08 2016 +0200 +++ b/Server/SharpDisplayManager.csproj Sun Jul 17 19:35:29 2016 +0200 @@ -34,7 +34,7 @@ index.htm false 0 - 0.9.0.0 + 0.9.1.0 false true true diff -r 8784c59c784e -r ce63ebb51da4 Server/cec.dll Binary file Server/cec.dll has changed