From c0b5d14a3cda6b91509cfb63cd04c940eb3dc656 Mon Sep 17 00:00:00 2001
From: Lawrence Rust <lvr@softsystem.co.uk>
Date: Sun, 6 Nov 2011 13:53:58 +0100
Subject: [PATCH 41/51] libmythtv: Set the modulation system for all dvb-s2 channels

This works around a change in Linux 3.x handling of ioctl FE_SET_PROPERTY
when DTV_DELIVERY_SYSTEM is set to 0.  In previous versions dvb_frontend
interpreted this as meaning dvb-s and passed that value on to the frontend
driver.  In versions 3.0 and later the value 0 is left unchanged and so the
tune operation fails.

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
---
 mythtv/libs/libmythtv/dtvmultiplex.cpp |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp
index 35b4666..9b5e2ec 100644
--- a/mythtv/libs/libmythtv/dtvmultiplex.cpp
+++ b/mythtv/libs/libmythtv/dtvmultiplex.cpp
@@ -262,6 +262,24 @@ bool DTVMultiplex::ParseDVB_S2(
         return false;
     }
 
+    switch (mod_sys)
+    {
+    case DTVModulationSystem::kModulationSystem_UNDEFINED:
+        // Force dvb-s if using qpsk
+        if (DTVModulation::kModulationQPSK == modulation)
+            mod_sys = DTVModulationSystem::kModulationSystem_DVBS;
+        else
+            mod_sys = DTVModulationSystem::kModulationSystem_DVBS2;
+        break;
+    case DTVModulationSystem::kModulationSystem_DVBS:
+    case DTVModulationSystem::kModulationSystem_DVBS2:
+        break;
+    default:
+        LOG(VB_GENERAL, LOG_ERR, LOC + "Unsupported S2 modulation system " +
+                QString("parameter '%1', aborting.").arg(_mod_sys));
+        return false;
+    }
+
     if (!_rolloff.isEmpty())
         ok &= rolloff.Parse(_rolloff);
 
-- 
1.7.4.1

