From 9656269826fd604e0081c45b93399eb679ad0466 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Mon, 17 Apr 2023 22:27:56 -0500 Subject: [PATCH] fix: resolve issue where displayport hdcp event not registered properly fix: resolve issue where feedback from Displayport HDCP capability was improperly named --- .../Transmitters/DmTx4kz302CController.cs | 44 ++++++------- .../Endpoints/Transmitters/DmTxHelpers.cs | 63 ++++++++++--------- 2 files changed, 58 insertions(+), 49 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index d96698f7..bd74bf5a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -121,7 +121,7 @@ namespace PepperDash.Essentials.DM Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; - Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChange; + Tx.DisplayPortInput.InputStreamChange += InputStreamChangeEvent; Tx.BaseEvent += Tx_BaseEvent; Tx.OnlineStatusChange += Tx_OnlineStatusChange; @@ -131,8 +131,7 @@ namespace PepperDash.Essentials.DM HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); - - DisplayPortInHdcpCapabilityFeedback = new IntFeedback("DisplayPortHdcpCapability", + DisplayPortInHdcpCapabilityFeedback = new IntFeedback("DisplayPortInHdcpCapability", () => (int)tx.DisplayPortInput.HdcpCapabilityFeedback); @@ -171,13 +170,19 @@ namespace PepperDash.Essentials.DM (ActualActiveVideoInput == eVst.Hdmi1 && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue) || (ActualActiveVideoInput == eVst.Hdmi2 - && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), + && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.DisplayPort + && tx.DisplayPortInput.VideoAttributes.HdcpActiveFeedback.BoolValue), HdcpStateFeedbackFunc = () => { if (ActualActiveVideoInput == eVst.Hdmi1) - return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); - return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : ""; + return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); + return ActualActiveVideoInput == eVst.DisplayPort + ? tx.DisplayPortInput.VideoAttributes.HdcpStateFeedback.ToString() + : ""; }, VideoResolutionFeedbackFunc = () => @@ -186,6 +191,8 @@ namespace PepperDash.Essentials.DM return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); if (ActualActiveVideoInput == eVst.Hdmi2) return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == eVst.DisplayPort) + return tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString(); return ActualActiveVideoInput == eVst.Vga ? tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString() : ""; }, VideoSyncFeedbackFunc = () => @@ -193,6 +200,8 @@ namespace PepperDash.Essentials.DM && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) || (ActualActiveVideoInput == eVst.Hdmi2 && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.DisplayPort + && tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) || (ActualActiveVideoInput == eVst.Vga && tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) @@ -211,28 +220,15 @@ namespace PepperDash.Essentials.DM AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, - Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback); + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback, DisplayPortInHdcpCapabilityFeedback); - // Set Ports for CEC HdmiIn1.Port = Tx.HdmiInputs[1]; HdmiIn2.Port = Tx.HdmiInputs[2]; + DisplayPortIn.Port = Tx.DisplayPortInput; HdmiLoopOut.Port = Tx.HdmiOutput; DmOut.Port = Tx.DmOutput; } - void DisplayPortInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) - { - Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - - switch (args.EventId) - { - case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - DisplayPortVideoSyncFeedback.FireUpdate(); - break; - } - } - - public override bool CustomActivate() { @@ -344,11 +340,17 @@ namespace PepperDash.Essentials.DM case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId: if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.DisplayPortInput) DisplayPortInHdcpCapabilityFeedback.FireUpdate(); + + Debug.Console(2, this, "DisplayPortHDCP Mode Trigger = {0}", + DisplayPortInHdcpCapabilityFeedback.IntValue); + HdcpStateFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); + if (inputStream == Tx.DisplayPortInput) DisplayPortVideoSyncFeedback.FireUpdate(); break; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index 25f8c8d1..84007032 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; @@ -44,7 +42,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmtx401")) return new DmTx401CController(key, name, new DmTx401C(dmInput), true); if (typeName.StartsWith("hdbasettx")) - new HDBaseTTxController(key, name, new HDTx3CB(dmInput)); + return new HDBaseTTxController(key, name, new HDTx3CB(dmInput)); return null; } @@ -83,6 +81,7 @@ namespace PepperDash.Essentials.DM /// /// /// + /// /// public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) { @@ -180,7 +179,7 @@ namespace PepperDash.Essentials.DM return null; } } - else if (parentDev is DmpsRoutingController) + if (parentDev is DmpsRoutingController) { // Get the DMPS chassis and link stuff up var dmpsDev = (parentDev as DmpsRoutingController); @@ -237,11 +236,8 @@ namespace PepperDash.Essentials.DM } } - else - { - Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a processor, DM Chassis or DMPS.", key, pKey); - return null; - } + Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a processor, DM Chassis or DMPS.", key, pKey); + return null; } } @@ -336,8 +332,6 @@ namespace PepperDash.Essentials.DM txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]); txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]); - trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; - if (txR.InputPorts[DmPortName.HdmiIn] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn]; @@ -384,7 +378,7 @@ namespace PepperDash.Essentials.DM { var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback; if (intFeedback != null) - intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port2HdcpState.JoinNumber]); } if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) @@ -401,16 +395,17 @@ namespace PepperDash.Essentials.DM if (tx.Feedbacks["DisplayPortInHdcpCapability"] != null) { + var intFeedback = tx.Feedbacks["DisplayPortInHdcpCapability"] as IntFeedback; if (intFeedback != null) + intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port3HdcpState.JoinNumber]); - } - if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) - { - var port = inputPort.Port as EndpointDisplayPortInput; - - SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port3HdcpState.JoinNumber, trilist); + if (inputPort.ConnectionType == eRoutingPortConnectionType.DisplayPort && inputPort.Port != null) + { + var port = inputPort.Port as EndpointDisplayPortInput; + SetHdcpCapabilityAction(port, joinMap.Port3HdcpState.JoinNumber, trilist); + } } } @@ -467,7 +462,7 @@ namespace PepperDash.Essentials.DM }); } else - { + { trilist.SetUShortSigAction(join, s => { @@ -476,17 +471,15 @@ namespace PepperDash.Essentials.DM } } - private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointDisplayPortInput port, uint join, + private void SetHdcpCapabilityAction(EndpointDisplayPortInput port, uint join, BasicTriList trilist) { - - trilist.SetUShortSigAction(join, s => { - port.HdcpCapability = (eHdcpCapabilityType)s; + Debug.Console(0, this, "Trying to set HDCP to {0} on port {1}", s, port.ToString()); + port.HdcpCapability = (eHdcpCapabilityType) s; }); - } } @@ -495,8 +488,22 @@ namespace PepperDash.Essentials.DM { public DmTxControllerFactory() { - TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", - "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g", "hdbasettx" }; + TypeNames = new List + { + "dmtx200c", + "dmtx201c", + "dmtx201s", + "dmtx4k100c", + "dmtx4k202c", + "dmtx4kz202c", + "dmtx4k302c", + "dmtx4kz302c", + "dmtx401c", + "dmtx401s", + "dmtx4k100c1g", + "dmtx4kz100c1g", + "hdbasettx" + }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) @@ -506,8 +513,8 @@ namespace PepperDash.Essentials.DM Debug.Console(1, "Factory Attempting to create new DM-TX Device"); var props = JsonConvert.DeserializeObject - (dc.Properties.ToString()); - return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props); + (dc.Properties.ToString()); + return DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props); } }