Fix DVB-S2 to DVB-S switch back on Kaffeine

Kaffeine basically tried to switch back to DVB-S using FE_SET_FRONTEND.
This ioctl was not designed to allow mode switching.

The only ioctl that (explicitly) sets a mode is FE_SET_PROPERTY.

Yet, there's a compat code there that should have been converting the
call into something different than SYS_UNKNOWN.

So, let's fix the code there. It will hopefully do the right thing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2012-04-17 18:44:38 -03:00
parent 084e405734
commit 185d60abac
2 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,65 @@
From c6c6fa8dcc27aad6ce3467544be0f57fd82b99a3 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Date: Tue, 17 Apr 2012 18:32:19 -0300
Subject: [PATCH] [media] dvb_frontend: Fix a regression when switching back
to DVB-S
There are some softwares (Kaffeine and likely xine) that uses a
DVBv5 call to switch to DVB-S2, but expects that a DVBv3 call to
switch back to DVB-S. Well, this is not right, as a DVBv3 call
doesn't know anything about delivery systems.
However, as, by accident, this used to work, we need to restore its
behavior, in order to avoid regressions with those softwares.
Reported on this Fedora 16 bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=812895
Reported-by: Dieter Roever <Dieter.Roever@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 4555baa..bb582fd 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1443,6 +1443,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
__func__);
return -EINVAL;
}
+ /*
+ * Get a delivery system that is compatible with DVBv3
+ * NOTE: in order for this to work with softwares like Kaffeine that
+ * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to
+ * DVB-S, drivers that support both should put the SYS_DVBS entry
+ * before the SYS_DVBS2, otherwise it won't switch back to DVB-S.
+ * The real fix is that userspace applications should not use DVBv3
+ * and not trust on calling FE_SET_FRONTEND to switch the delivery
+ * system.
+ */
+ ncaps = 0;
+ while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) {
+ if (fe->ops.delsys[ncaps] == desired_system) {
+ delsys = desired_system;
+ break;
+ }
+ ncaps++;
+ }
+ if (delsys == SYS_UNDEFINED) {
+ dprintk("%s() Couldn't find a delivery system that matches %d\n",
+ __func__, desired_system);
+ }
} else {
/*
* This is a DVBv5 call. So, it likely knows the supported
@@ -1491,9 +1513,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
__func__);
return -EINVAL;
}
- c->delivery_system = delsys;
}
+ c->delivery_system = delsys;
+
/*
* The DVBv3 or DVBv5 call is requesting a different system. So,
* emulation is needed.

View File

@ -710,6 +710,7 @@ Patch2802: linux-2.6-silence-acpi-blacklist.patch
# add-poll-requested-events.patch was added for 3.4
Patch2900: add-poll-requested-events.patch
Patch2901: drivers-media-update.patch
Patch2902: dvb_frontend_switch_regression_fix.patch
# fs fixes
@ -1417,6 +1418,7 @@ ApplyPatch quite-apm.patch
# apply if non-empty
ApplyPatch add-poll-requested-events.patch
ApplyOptionalPatch drivers-media-update.patch
ApplyPatch dvb_frontend_switch_regression_fix.patch
# Patches headed upstream
@ -2229,6 +2231,9 @@ fi
# and build.
%changelog
* Tue Apr 17 2012 Mauro Carvalho Chehab <mchehab@redhat.com>
- Fix DVB-S2->DVB-S switch regression (rhbz 812895)
* Tue Apr 17 2012 Josh Boyer <jwboyer@redhat.com>
- Fix oops in nfs_have_delegation (rhbz 811138)
- Fix oops on invalid AMD microcode load (rhbz 797559)