From 0538ffe18f3b4b6a979955e2552adce8d122ce1b Mon Sep 17 00:00:00 2001 From: mm1352000 Date: Fri, 6 Jan 2012 18:43:09 +1300 Subject: [PATCH] Some changes: - remove the recently added LNB LOF workaround. TBS have acknowledged the issue and are going to release new drivers that fix the problem. - refactor SetLnbPower() and SetTuningParameters() to be more generic as already done for Twinhan --- .../ConditionalAccess/ConditionalAccess.cs | 2 +- .../Turbosight/Turbosight.cs | 56 ++++++++++--------- .../DVB/Graphs/DVBS/TvCardDVBS.cs | 10 +++- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/ConditionalAccess.cs b/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/ConditionalAccess.cs index b77c2ac9ed7..ffeb70a35a9 100644 --- a/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/ConditionalAccess.cs +++ b/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/ConditionalAccess.cs @@ -924,7 +924,7 @@ public DVBSChannel SetDVBS2Modulation(ScanParameters parameters, DVBSChannel cha } if (_turbosight != null) { - return _turbosight.SetTuningParameters(channel); + return (DVBSChannel)_turbosight.SetTuningParameters(channel as DVBBaseChannel); } if (_technoTrend != null) { diff --git a/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/Turbosight/Turbosight.cs b/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/Turbosight/Turbosight.cs index af38d11fd15..a7a53b8d3b2 100644 --- a/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/Turbosight/Turbosight.cs +++ b/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/ConditionalAccess/Turbosight/Turbosight.cs @@ -373,7 +373,7 @@ public Turbosight(IBaseFilter tunerFilter) _tunerFilter = tunerFilter; _generalBuffer = Marshal.AllocCoTaskMem(TbsAccessParamsSize); OpenCi(); - SetLnbPowerState(true); + SetPowerState(true); } /// @@ -389,13 +389,13 @@ public bool IsTurbosight } /// - /// Turn the LNB power supply on or off. + /// Turn the LNB or aerial power supply on or off. /// /// True to turn power supply on, otherwise false. /// true if the power supply state is set successfully, otherwise false - public bool SetLnbPowerState(bool powerOn) + public bool SetPowerState(bool powerOn) { - Log.Log.Debug("Turbosight: set LNB power state, on = {0}", powerOn); + Log.Log.Debug("Turbosight: set power state, on = {0}", powerOn); TbsAccessParams accessParams = new TbsAccessParams(); accessParams.AccessMode = TbsAccessMode.LnbPower; @@ -494,14 +494,20 @@ public bool SetToneState(ToneBurst toneBurstState, Tone22k tone22kState) } /// - /// Set DVB-S2 tuning parameters that could not previously be set through BDA interfaces. + /// Set tuning parameters that can or could not previously be set through BDA interfaces. /// /// The channel to tune. - /// The channel with DVB-S2 parameters set. - public DVBSChannel SetTuningParameters(DVBSChannel channel) + /// The channel with parameters adjusted as necessary. + public DVBBaseChannel SetTuningParameters(DVBBaseChannel channel) { Log.Log.Debug("Turbosight: set tuning parameters"); - switch (channel.InnerFecRate) + DVBSChannel ch = channel as DVBSChannel; + if (ch == null) + { + return channel; + } + + switch (ch.InnerFecRate) { case BinaryConvolutionCodeRate.Rate1_2: case BinaryConvolutionCodeRate.Rate2_3: @@ -510,42 +516,38 @@ public DVBSChannel SetTuningParameters(DVBSChannel channel) case BinaryConvolutionCodeRate.Rate4_5: case BinaryConvolutionCodeRate.Rate5_6: case BinaryConvolutionCodeRate.Rate7_8: - channel.InnerFecRate = channel.InnerFecRate; + ch.InnerFecRate = ch.InnerFecRate; break; case BinaryConvolutionCodeRate.Rate8_9: - channel.InnerFecRate = BinaryConvolutionCodeRate.Rate5_11; + ch.InnerFecRate = BinaryConvolutionCodeRate.Rate5_11; break; case BinaryConvolutionCodeRate.Rate9_10: - channel.InnerFecRate = BinaryConvolutionCodeRate.Rate7_8; + ch.InnerFecRate = BinaryConvolutionCodeRate.Rate7_8; break; default: - channel.InnerFecRate = BinaryConvolutionCodeRate.RateNotSet; + ch.InnerFecRate = BinaryConvolutionCodeRate.RateNotSet; break; } - Log.Log.Debug(" inner FEC rate = {0}", channel.InnerFecRate); + Log.Log.Debug(" inner FEC rate = {0}", ch.InnerFecRate); - if (channel.InnerFecRate != BinaryConvolutionCodeRate.RateNotSet) + if (ch.InnerFecRate != BinaryConvolutionCodeRate.RateNotSet) { - if (channel.ModulationType == ModulationType.ModNotSet) + if (ch.ModulationType == ModulationType.ModNotSet) { - channel.ModulationType = ModulationType.ModQpsk; + ch.ModulationType = ModulationType.ModQpsk; } - else if (channel.ModulationType == ModulationType.ModQpsk) + else if (ch.ModulationType == ModulationType.ModQpsk) { - channel.ModulationType = ModulationType.ModOqpsk; + ch.ModulationType = ModulationType.ModOqpsk; } - else if (channel.ModulationType == ModulationType.Mod8Psk) - { - channel.ModulationType = ModulationType.ModBpsk; - } - else + else if (ch.ModulationType == ModulationType.Mod8Psk) { - channel.ModulationType = ModulationType.ModNotDefined; + ch.ModulationType = ModulationType.ModBpsk; } } - Log.Log.Debug(" modulation = {0}", channel.ModulationType); + Log.Log.Debug(" modulation = {0}", ch.ModulationType); - return channel; + return ch as DVBBaseChannel; } #region conditional access @@ -1419,7 +1421,7 @@ public void Dispose() { if (_isTurbosight) { - SetLnbPowerState(false); + SetPowerState(false); if (_mmiHandlerThread != null) { _stopMmiHandlerThread = true; diff --git a/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/Graphs/DVBS/TvCardDVBS.cs b/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/Graphs/DVBS/TvCardDVBS.cs index 97751d35825..c7981151196 100644 --- a/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/Graphs/DVBS/TvCardDVBS.cs +++ b/TvEngine3/TVLibrary/TVLibrary/Implementations/DVB/Graphs/DVBS/TvCardDVBS.cs @@ -339,6 +339,14 @@ private bool BeforeTune(ref int subChannelId, IChannel channel) int lnbSwitch; BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lowOsc, out hiOsc, out lnbSwitch); Log.Log.Info("LNB low:{0} hi:{1} switch:{2}", lowOsc, hiOsc, lnbSwitch); + if (lnbSwitch == 0) + lnbSwitch = 18000; + IDVBSTuningSpace tuningSpace = (IDVBSTuningSpace)_tuningSpace; + tuningSpace.put_LNBSwitch(lnbSwitch * 1000); + tuningSpace.put_LowOscillator(lowOsc * 1000); + tuningSpace.put_HighOscillator(hiOsc * 1000); + /*BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lowOsc, out hiOsc, out lnbSwitch); + Log.Log.Info("LNB low:{0} hi:{1} switch:{2}", lowOsc, hiOsc, lnbSwitch); if (lnbSwitch == 0) { lnbSwitch = 18000000; @@ -353,7 +361,7 @@ private bool BeforeTune(ref int subChannelId, IChannel channel) IDVBSTuningSpace tuningSpace = (IDVBSTuningSpace)_tuningSpace; tuningSpace.put_LNBSwitch(lnbSwitch); tuningSpace.put_LowOscillator(lof); - tuningSpace.put_HighOscillator(lof); + tuningSpace.put_HighOscillator(lof);*/ ITuneRequest request; _tuningSpace.CreateTuneRequest(out request); _tuneRequest = (IDVBTuneRequest)request;