From 90051928eb442c2005d69320152a1ab23ee9800f Mon Sep 17 00:00:00 2001 From: feyris-tan Date: Sun, 26 Oct 2025 10:04:22 +0100 Subject: [PATCH] The blindscan will not retry signals for a few times. --- skyscraper8/GS/GSE/GseReader.cs | 23 +++++++++- skyscraper8/Program.cs | 1 + skyscraper8/Properties/launchSettings.json | 2 +- .../BaseBlindscanJob.cs | 42 ++++++++++++------- .../CoopBlindscanStreamReaderProxy.cs | 10 ++++- skyscraper8/Skyscraper/IntegerExtensions.cs | 24 +++++++++++ skyscraper8/Skyscraper/QualificationTool.cs | 3 +- 7 files changed, 86 insertions(+), 19 deletions(-) create mode 100644 skyscraper8/Skyscraper/IntegerExtensions.cs diff --git a/skyscraper8/GS/GSE/GseReader.cs b/skyscraper8/GS/GSE/GseReader.cs index e2272d1..7329c07 100644 --- a/skyscraper8/GS/GSE/GseReader.cs +++ b/skyscraper8/GS/GSE/GseReader.cs @@ -33,6 +33,8 @@ internal class GseReader : IMisHandler GsePacket child = new GsePacket(startIndicator, endIndicator, labelTypeIndicator); if (!startIndicator || !endIndicator) { + if (ms.Position == ms.Length) + return; child.FragmentId = ms.ReadUInt8(); gseLength--; } @@ -45,6 +47,8 @@ internal class GseReader : IMisHandler if (startIndicator) { + if (ms.GetAvailableBytes() < 2) + return; child.ProtocolType = ms.ReadUInt16BE(); gseLength -= 2; if (!endIndicator) @@ -81,6 +85,8 @@ internal class GseReader : IMisHandler if (gseLength > ms.GetAvailableBytes()) return; + if (gseLength <= -1) + return; child.GseDataBytes = ms.ReadBytes(gseLength); if (!startIndicator && endIndicator) @@ -120,6 +126,21 @@ internal class GseReader : IMisHandler return; } + if (!child.StartIndicator && !child.EndIndicator) + { + if (fragmentations == null) + { + //We haven't seen any starting frames yet, so we can't use an inbetween frame. We can throw this away. + return; + } + if (fragmentations[child.FragmentId.Value] == null) + { + //fragment beginning missing, we can throw this away. + return; + } + throw new NotImplementedException(child.ToString()); + } + if (child.StartIndicator && child.EndIndicator) { switch (child.ProtocolType) @@ -132,7 +153,7 @@ internal class GseReader : IMisHandler warnedEthertypes = new bool[0xffff]; if (!warnedEthertypes[child.ProtocolType.Value]) { - logger.WarnFormat("This GSE contains other traffic types (type {0:X4}) besides IP (type 0x0800). If it's not too much trouble, please consider submitting a sample.",child.ProtocolType.Value); + logger.WarnFormat("This GSE contains other traffic types (type 0x{0:X4}) besides IP (type 0x0800). If it's not too much trouble, please consider submitting a sample.",child.ProtocolType.Value); warnedEthertypes[child.ProtocolType.Value] = true; } break; diff --git a/skyscraper8/Program.cs b/skyscraper8/Program.cs index cff18c6..e91852c 100644 --- a/skyscraper8/Program.cs +++ b/skyscraper8/Program.cs @@ -34,6 +34,7 @@ using skyscraper8.SatIp; using skyscraper8.SatIp.RtspResponses; using skyscraper8.SimpleServiceDiscoveryProtocol; using skyscraper8.Skyscraper.Math; +using skyscraper8.Skyscraper; [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")] namespace skyscraper5 diff --git a/skyscraper8/Properties/launchSettings.json b/skyscraper8/Properties/launchSettings.json index 5d5c369..6055afb 100644 --- a/skyscraper8/Properties/launchSettings.json +++ b/skyscraper8/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "skyscraper8": { "commandName": "Project", - "commandLineArgs": "\"D:\\sorglos-iww-rww-aca-oca.ts\"", + "commandLineArgs": "udpin udp://127.0.0.1:6970", "remoteDebugEnabled": false }, "Container (Dockerfile)": { diff --git a/skyscraper8/Skyscraper/FrequencyListGenerator/BaseBlindscanJob.cs b/skyscraper8/Skyscraper/FrequencyListGenerator/BaseBlindscanJob.cs index b75338d..3b8b517 100644 --- a/skyscraper8/Skyscraper/FrequencyListGenerator/BaseBlindscanJob.cs +++ b/skyscraper8/Skyscraper/FrequencyListGenerator/BaseBlindscanJob.cs @@ -588,7 +588,7 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator if (!satelliteSr.Lock) { logger.Log(PluginLogLevel.Info, string.Format("Trying to SetChannel..."), 8); - bool channel = config.StreamReader.SetChannel(result.SearchResult.Freq, result.SearchResult.SR, result.SearchResult.Freq, result.SearchResult.FEC, config.LnbType.Lof1 * 1000, config.LnbType.Lof2 * 1000, config.LnbType.LofSw * 1000); + bool channel = config.StreamReader.SetChannel(result.SearchResult.Freq, result.SearchResult.SR, result.SearchResult.Pol, result.SearchResult.FEC, config.LnbType.Lof1 * 1000, config.LnbType.Lof2 * 1000, config.LnbType.LofSw * 1000); if (!channel) { result.State = BlindscanResultState.TuningFailed; @@ -598,23 +598,35 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator } else { - logger.Log(PluginLogLevel.Info, string.Format("Trying to get SignalInfo..."), 8); - bool signalInfo = config.StreamReader.SignalInfo(ref satelliteSr); - if (!signalInfo) + int attempts = result.SearchResult.Freq / 1000; + attempts = attempts.GetHighestDigit(); + bool sucess = false; + for (int i = 0; i < attempts; i++) { - result.State = BlindscanResultState.TuningFailed; - config.DataStorage.UpdateTransponderState(jobInDb, result.IsSatellite(), result.SearchResult, result.State, result.SearchResult2); - config.Ui.OnBlindscanLockFail(satelliteSr, result.State); - return; - } + logger.Log(PluginLogLevel.Info, string.Format("Trying to get SignalInfo..."), 8); + bool signalInfo = config.StreamReader.SignalInfo(ref satelliteSr); + if (!signalInfo) + { + result.State = BlindscanResultState.TuningFailed; + config.DataStorage.UpdateTransponderState(jobInDb, result.IsSatellite(), result.SearchResult, result.State, result.SearchResult2); + config.Ui.OnBlindscanLockFail(satelliteSr, result.State); + } - if (!satelliteSr.Lock) - { - result.State = BlindscanResultState.NoLock; - config.DataStorage.UpdateTransponderState(jobInDb, result.IsSatellite(), result.SearchResult, result.State, result.SearchResult2); - config.Ui.OnBlindscanLockFail(satelliteSr, result.State); + if (!satelliteSr.Lock) + { + result.State = BlindscanResultState.NoLock; + config.DataStorage.UpdateTransponderState(jobInDb, result.IsSatellite(), result.SearchResult, result.State, result.SearchResult2); + config.Ui.OnBlindscanLockFail(satelliteSr, result.State); + } + else + { + sucess = true; + break; + } + Thread.Sleep(1000); + } + if (!sucess) return; - } } } diff --git a/skyscraper8/Skyscraper/FrequencyListGenerator/CoopBlindscanStreamReaderProxy.cs b/skyscraper8/Skyscraper/FrequencyListGenerator/CoopBlindscanStreamReaderProxy.cs index 3c426d4..e3612ee 100644 --- a/skyscraper8/Skyscraper/FrequencyListGenerator/CoopBlindscanStreamReaderProxy.cs +++ b/skyscraper8/Skyscraper/FrequencyListGenerator/CoopBlindscanStreamReaderProxy.cs @@ -56,7 +56,11 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator { if (!_proxiedStreamReader.SendDiSEqC(lastDiseqcType, lastDiseqcOpcode)) return false; - } + if (!_proxiedStreamReader.SendDiSEqC(lastDiseqcType, lastDiseqcOpcode)) + return false; + if (!_proxiedStreamReader.SendDiSEqC(lastDiseqcType, lastDiseqcOpcode)) + return false; + } currentlySelectedTuner = targetTuner; return true; @@ -260,9 +264,13 @@ namespace skyscraper8.Skyscraper.FrequencyListGenerator if (!SwitchTuner(_setFilterTuner)) return false; + bool diseqc = SendDiSEqC(lastDiseqcType, lastDiseqcOpcode); + if (!_proxiedStreamReader.BLScanEx(freq, freq_range, pol, lof1, lof2, lofsw, minsr, std, ref pSearchResult)) return false; + logger.InfoFormat("Frequency: {0}, Polarity: {1}, Lock: {2}", freq, pol, pSearchResult.Lock); + return true; } diff --git a/skyscraper8/Skyscraper/IntegerExtensions.cs b/skyscraper8/Skyscraper/IntegerExtensions.cs new file mode 100644 index 0000000..8d10bb8 --- /dev/null +++ b/skyscraper8/Skyscraper/IntegerExtensions.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace skyscraper8.Skyscraper +{ + internal static class IntegerExtensions + { + public static int GetHighestDigit(this int source) + { + int result = 0; + while (source > 0) + { + int currentDigit = source % 10; + if (currentDigit > result) + result = currentDigit; + source /= 10; + } + return result; + } + } +} diff --git a/skyscraper8/Skyscraper/QualificationTool.cs b/skyscraper8/Skyscraper/QualificationTool.cs index 10019d3..af24a46 100644 --- a/skyscraper8/Skyscraper/QualificationTool.cs +++ b/skyscraper8/Skyscraper/QualificationTool.cs @@ -30,9 +30,10 @@ namespace skyscraper5.src.Skyscraper string versionString = version.ToString(); switch(versionString) { + case "1.2.5.208": return QualificationToolResultEnum.Good; case "1.2.5.194": return QualificationToolResultEnum.Bad; //Won't find most transponders with a 6903x case "1.2.5.176": return QualificationToolResultEnum.Bad; //Won't find most transponders with a 6903x - case "1.2.4.101": return QualificationToolResultEnum.Good; //Works great, but is reather slow with a 6903x + case "1.2.4.101": return QualificationToolResultEnum.Bad; //Breaks GS encapsulation on 6903x. default: return QualificationToolResultEnum.Unknown; } }