PepperDash / Essentials

The Essentials Application Framework Libraries
MIT License
133 stars 77 forks source link

[BUG]-DM Chassis Bridging Fails when HDCP Object Missing #1035

Open TrevorPayne opened 1 year ago

TrevorPayne commented 1 year ago

Was this bug identified in a specific build version? 1.12.1 - though I imagine it's been here for quite some time.

Describe the bug If the configuration of an DM-MDXXX Switcher does not contain the inputSlotSupportsHdcp2 object, Linking to the API will fail.

Stacktrace

Include a stack trace of the exception if possible.

[09:50:54.000]App 1:[dmMd16x16-1] Linking to Trilist 'C0'
[09:50:54.000]App 1:Port value for input card 1 is set
[09:50:54.000]App 1:Port is HdmiInputWithCec
[09:50:54.000]App 1:[dmMdBridge02] ERROR: Device dmMdBridge02 PostActivation failure: KeyNotFoundException
[09:50:54.000]App 1:[dmMdBridge02] Stack Trace:    at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(UInt32 key)
   at PepperDash.Essentials.DM.DmChassisController.LinkHdmiInputToApi(BasicTriList trilist, UInt32 ioSlot, DmChassisControllerJoinMap joinMap, UInt32 ioSlotJoin)
   at PepperDash.Essentials.DM.DmChassisController.LinkToApi(BasicTriList trilist, UInt32 joinStart, String joinMapKey, EiscApiAdvanced bridge)
   at PepperDash.Essentials.Core.Bridges.EiscApiAdvanced.LinkDevices()
   at PepperDash.Core.Device.<PostActivate>b__2(Action a)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at PepperDash.Core.Device.PostActivate()
   at PepperDash.Essentials.Core.DeviceManager.ActivateAll()
   at PepperDash.Essentials.ControlSystem.Load()
   at PepperDash.Essentials.ControlSystem.GoWithLoad()
   at PepperDash.Essentials.ControlSystem.StartSystem(Object obj)
   at Crestron.SimplSharp.CTimer.a(Object A_0)
   at System.Threading.Timer.ring()

To Reproduce Steps to reproduce the behavior:

  1. Build a DM Chassis device config without the inputSlotSupportsHdcp2 object.
  2. Bridge this device to another slot.

Expected behavior This should at the bare minimum fail gracefully to a default state and note the lack of this config rather than simply fail with a difficult to parse stack trace.

Additional context This was discovered while upgrading an essentials installation from 1.14.21 - which means this is a breaking change within a major version and should probably be fixed.

TrevorPayne commented 1 year ago

PepperDash.Essentials.DM.DmChassisController.LinkHdmiInputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)

There should be a null check before this line : SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);

and if it's null, we should set it to a default value.

jtalborough commented 1 year ago

Default to HDCP2 and the latest hardware releases