Restricting a particular dvb card from tuning to channels with a selected modulation

Message ID 4BB9B41C.3010702@tvdr.de
State New
Headers

Commit Message

Klaus Schmidinger April 5, 2010, 9:57 a.m. UTC
  On 05.04.2010 00:55, Teemu Rantanen wrote:
> Hi,
> 
> There's a new version of the patch implemented as a plugin. It seems to
> work, but there are few things to notice:
> 
> - Plugin does not cache which devices are Reddo devices, instead it
> probes sysfs every time QAM256 channel is being tuned into (on any
> device). It would be nice if cDeviceHook added a mechanism for a hook to
> store context for each device. Hooking into device probe (like full
> feature card plugin does) would be much nicer way, but it would
> interfere with other plugins which need the same mechanism.

The proper way of doing this is to check the modulation types
in cDvbDevice::ProvidesTransponder(), as in the attached patch (which will
be part of VDR 1.7.15). If the "reddo" driver doesn't set the FE_CAN_QAM_256
flag correctly, it needs to be fixed there.

> - VDR crashes at very late in exit() when clearing some list (most
> likely cDeviceHook list), but I couldn't find a way to avoid that

>From PLUGINS.html:

  A plugin that creates a derived cDeviceHook ...
  shall not delete this object. It will be automatically deleted when the
  program ends

I have added a similar note to device.h now.

> ...
> - The sysfs probe code in full feature card plugin is buggy :-)

Would you mind posting a patch that fixes this?

Klaus

> The plugin is available here:
> 
> http://tvr.dy.fi/vdr/vdr-disablereddoqam256-0.0.1.tgz
  

Comments

Teemu Rantanen April 5, 2010, 10:43 a.m. UTC | #1
Hi,

I tried also without delete cDeviceHook but it still crashed...

Well, the fixes are basically available in the plugin, as I copied the probe
method (and modified slightly to suit the plugin). Those are:
- The sysfs filenames are idVendor (subsystem_vendor) and idProduct
(subsystem_device)
- You need to set strtoul() base as 16 as the files don't have 0x in front
of the hex

What about making this an utility method in VDR? Give device file name and
return id...


Teemu

2010/4/5 Klaus Schmidinger <Klaus.Schmidinger@tvdr.de>

> From PLUGINS.html:
>
>  A plugin that creates a derived cDeviceHook ...
>  shall not delete this object. It will be automatically deleted when the
>  program ends
>
> I have added a similar note to device.h now.
>
> > ...
> > - The sysfs probe code in full feature card plugin is buggy :-)
>
> Would you mind posting a patch that fixes this?
>
> Klaus
>
>
  
Klaus Schmidinger April 5, 2010, 2:35 p.m. UTC | #2
On 05.04.2010 12:43, Teemu Rantanen wrote:
> Hi,
> 
> I tried also without delete cDeviceHook but it still crashed...

Please try creating the cReddoDeviceHook in cPluginDisableReddoQAM256::Initialize(),
as suggested in PLUGINS.html.

> Well, the fixes are basically available in the plugin, as I copied the
> probe method (and modified slightly to suit the plugin). Those are:
> - The sysfs filenames are idVendor (subsystem_vendor) and idProduct
> (subsystem_device)

This is what I get here:

root@video:/home/kls/vdr/VDR > ls -l /sys/class/dvb/dvb0.frontend0/device/subsystem_*
-r--r--r-- 1 root root 4096 2010-04-05 16:25 /sys/class/dvb/dvb0.frontend0/device/subsystem_device
-r--r--r-- 1 root root 4096 2010-04-05 16:25 /sys/class/dvb/dvb0.frontend0/device/subsystem_vendor

root@video:/home/kls/vdr/VDR > ls -l /sys/class/dvb/dvb0.frontend0/device/id*
ls: cannot access /sys/class/dvb/dvb0.frontend0/device/id*: No such file or directory

Maybe a bug in the driver?

> - You need to set strtoul() base as 16 as the files don't have 0x in
> front of the hex

root@video:/home/kls/vdr/VDR > cat /sys/class/dvb/dvb0.frontend0/device/subsystem_device
0x0000
root@video:/home/kls/vdr/VDR > cat /sys/class/dvb/dvb0.frontend0/device/subsystem_vendor
0x13c2

Maybe the "reddo" driver behaves differently than the FuSi driver?

> What about making this an utility method in VDR? Give device file name
> and return id...

Will do.


Have you tried whether it works with my patch?
In that case you wouldn't even need the whole plugin.

Klaus

> 2010/4/5 Klaus Schmidinger <Klaus.Schmidinger@tvdr.de
> <mailto:Klaus.Schmidinger@tvdr.de>>
> 
>     From PLUGINS.html:
> 
>      A plugin that creates a derived cDeviceHook ...
>      shall not delete this object. It will be automatically deleted when the
>      program ends
> 
>     I have added a similar note to device.h now.
> 
>     > ...
>     > - The sysfs probe code in full feature card plugin is buggy :-)
> 
>     Would you mind posting a patch that fixes this?
> 
>     Klaus
  
Teemu Rantanen April 5, 2010, 4:14 p.m. UTC | #3
Ok, so the sysfs names of vendor/product are driver-dependent... All my usb
devices have idVendor/idProduct even though only one of them is "Reddo".

Tried to create the hook on Initialize(), still crashes on exit().

Haven't tried your patch, because as far as I know the driver claims it can
do QAM256, and even if that was disabled today it would take some time to
get into all linux distributions... Btw it even claims to support QAM256 on
the product package, but it still doesn't work. I guess that's the reason
they are so inexpensive here...


Teemu

2010/4/5 Klaus Schmidinger <Klaus.Schmidinger@tvdr.de>

> On 05.04.2010 12:43, Teemu Rantanen wrote:
> > Hi,
> >
> > I tried also without delete cDeviceHook but it still crashed...
>
> Please try creating the cReddoDeviceHook in
> cPluginDisableReddoQAM256::Initialize(),
> as suggested in PLUGINS.html.
>
> > Well, the fixes are basically available in the plugin, as I copied the
> > probe method (and modified slightly to suit the plugin). Those are:
> > - The sysfs filenames are idVendor (subsystem_vendor) and idProduct
> > (subsystem_device)
>
> This is what I get here:
>
> root@video:/home/kls/vdr/VDR > ls -l
> /sys/class/dvb/dvb0.frontend0/device/subsystem_*
> -r--r--r-- 1 root root 4096 2010-04-05 16:25
> /sys/class/dvb/dvb0.frontend0/device/subsystem_device
> -r--r--r-- 1 root root 4096 2010-04-05 16:25
> /sys/class/dvb/dvb0.frontend0/device/subsystem_vendor
>
> root@video:/home/kls/vdr/VDR > ls -l
> /sys/class/dvb/dvb0.frontend0/device/id*
> ls: cannot access /sys/class/dvb/dvb0.frontend0/device/id*: No such file or
> directory
>
> Maybe a bug in the driver?
>
> > - You need to set strtoul() base as 16 as the files don't have 0x in
> > front of the hex
>
> root@video:/home/kls/vdr/VDR > cat
> /sys/class/dvb/dvb0.frontend0/device/subsystem_device
> 0x0000
> root@video:/home/kls/vdr/VDR > cat
> /sys/class/dvb/dvb0.frontend0/device/subsystem_vendor
> 0x13c2
>
> Maybe the "reddo" driver behaves differently than the FuSi driver?
>
> > What about making this an utility method in VDR? Give device file name
> > and return id...
>
> Will do.
>
>
> Have you tried whether it works with my patch?
> In that case you wouldn't even need the whole plugin.
>
> Klaus
>
>
  
Klaus Schmidinger April 5, 2010, 4:37 p.m. UTC | #4
On 05.04.2010 18:14, Teemu Rantanen wrote:
> Ok, so the sysfs names of vendor/product are driver-dependent... All my
> usb devices have idVendor/idProduct even though only one of them is "Reddo".

I'm not saying that what the FuSI driver does is correct, either ;-)
Somebody with more knowledge should clarify this and fix the driver
that is faulty.

> Tried to create the hook on Initialize(), still crashes on exit().

Well, then I guess you'll need to do some debugging to find out what
really goes wrong here.

> Haven't tried your patch, because as far as I know the driver claims it
> can do QAM256, and even if that was disabled today it would take some
> time to get into all linux distributions... Btw it even claims to
> support QAM256 on the product package, but it still doesn't work. I
> guess that's the reason they are so inexpensive here...

At any rate, these things *must* be fixed in the driver!
Even if it takes a while for a fix to get into the main kernel source.

Klaus

> 2010/4/5 Klaus Schmidinger <Klaus.Schmidinger@tvdr.de
> <mailto:Klaus.Schmidinger@tvdr.de>>
> 
>     On 05.04.2010 12:43, Teemu Rantanen wrote:
>     > Hi,
>     >
>     > I tried also without delete cDeviceHook but it still crashed...
> 
>     Please try creating the cReddoDeviceHook in
>     cPluginDisableReddoQAM256::Initialize(),
>     as suggested in PLUGINS.html.
> 
>     > Well, the fixes are basically available in the plugin, as I copied the
>     > probe method (and modified slightly to suit the plugin). Those are:
>     > - The sysfs filenames are idVendor (subsystem_vendor) and idProduct
>     > (subsystem_device)
> 
>     This is what I get here:
> 
>     root@video:/home/kls/vdr/VDR > ls -l
>     /sys/class/dvb/dvb0.frontend0/device/subsystem_*
>     -r--r--r-- 1 root root 4096 2010-04-05 16:25
>     /sys/class/dvb/dvb0.frontend0/device/subsystem_device
>     -r--r--r-- 1 root root 4096 2010-04-05 16:25
>     /sys/class/dvb/dvb0.frontend0/device/subsystem_vendor
> 
>     root@video:/home/kls/vdr/VDR > ls -l
>     /sys/class/dvb/dvb0.frontend0/device/id*
>     ls: cannot access /sys/class/dvb/dvb0.frontend0/device/id*: No such
>     file or directory
> 
>     Maybe a bug in the driver?
> 
>     > - You need to set strtoul() base as 16 as the files don't have 0x in
>     > front of the hex
> 
>     root@video:/home/kls/vdr/VDR > cat
>     /sys/class/dvb/dvb0.frontend0/device/subsystem_device
>     0x0000
>     root@video:/home/kls/vdr/VDR > cat
>     /sys/class/dvb/dvb0.frontend0/device/subsystem_vendor
>     0x13c2
> 
>     Maybe the "reddo" driver behaves differently than the FuSi driver?
> 
>     > What about making this an utility method in VDR? Give device file name
>     > and return id...
> 
>     Will do.
> 
> 
>     Have you tried whether it works with my patch?
>     In that case you wouldn't even need the whole plugin.
> 
>     Klaus
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> vdr mailing list
> vdr@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
  

Patch

--- dvbdevice.c	2010/03/07 13:58:24	2.32
+++ dvbdevice.c	2010/04/04 11:15:25	2.33
@@ -889,7 +889,16 @@ 
   if (!cSource::IsSat(Channel->Source()))
      return DeviceHooksProvidesTransponder(Channel); // source is sufficient for non sat
   cDvbTransponderParameters dtp(Channel->Parameters());
-  if (frontendType == SYS_DVBS && dtp.System() == SYS_DVBS2)
+  if (dtp.System() == SYS_DVBS2 && frontendType == SYS_DVBS ||
+     dtp.Modulation() == QPSK && !(frontendInfo.caps & FE_CAN_QPSK) ||
+     dtp.Modulation() == QAM_16 && !(frontendInfo.caps & FE_CAN_QAM_16) ||
+     dtp.Modulation() == QAM_32 && !(frontendInfo.caps & FE_CAN_QAM_32) ||
+     dtp.Modulation() == QAM_64 && !(frontendInfo.caps & FE_CAN_QAM_64) ||
+     dtp.Modulation() == QAM_128 && !(frontendInfo.caps & FE_CAN_QAM_128) ||
+     dtp.Modulation() == QAM_256 && !(frontendInfo.caps & FE_CAN_QAM_256) ||
+     dtp.Modulation() == QAM_AUTO && !(frontendInfo.caps & FE_CAN_QAM_AUTO) ||
+     dtp.Modulation() == VSB_8 && !(frontendInfo.caps & FE_CAN_8VSB) ||
+     dtp.Modulation() == VSB_16 && !(frontendInfo.caps & FE_CAN_16VSB))
      return false; // requires modulation system which frontend doesn't provide
   if (!Setup.DiSEqC || Diseqcs.Get(CardIndex() + 1, Channel->Source(), Channel->Frequency(), dtp.Polarization()))
      return DeviceHooksProvidesTransponder(Channel);