Project

General

Profile

Feature #2711

Support for Dual System USB Sticks

Added by B C over 9 years ago. Updated over 9 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
DVB
Target version:
-
Start date:
2015-03-12
Due date:
% Done:

0%

Estimated time:

Description

There are devices on the market like Astrometa DVB-C/T/T2 stick or PCTV 292e, which do support DVB-C and DVB-T. Always all frontends appear as DVB-T although one of them should be DVB-C. By now I have found two dirty workarounds to make DVB-C work on them (at least on Astrometa, OOB staging driver).

I can either delete frontend0 (DVB-T) and link frontend1 to it (so /dev/adapterX/frontend0 is equal to /dev/adapterX/frontend1) or
adapt the source in linuxdvb_adapter.c --> linuxdvb_adapter_add and fake the adapter to be of type DVB_TYPE_C instead of DVB_TYPE_T

As PCTV-292e drivers are not from staging and included since kernel 3.16, I expect them to at least behave correctly :-), quality of Astrometa is known to be poor, but the root cause seems to be the same (and with workaround seem to work fine for me). Is there a way to implement this correctly?


Files

a.patch (2.54 KB) a.patch First patch Jaroslav Kysela, 2015-03-19 13:14

History

#1

Updated by Jaroslav Kysela over 9 years ago

The tvheadend should probe all frontends and all delivery systems. The additional frontends should be added in this loop:

https://github.com/tvheadend/tvheadend/blob/master/src/input/mpegts/linuxdvb/linuxdvb_adapter.c#L318-L339

#2

Updated by B C over 9 years ago

well the dvb-c frontend is detected, but as dvb-t. As I said if I link frontend1 as frontend0 it is detected as dvb-c, but when there is frontend0 which is dvb-t it will get recogniced as dvb-t. It can for sure be a driver issue, if you want me to log something let me know.

#3

Updated by Jaroslav Kysela over 9 years ago

B C wrote:

well the dvb-c frontend is detected, but as dvb-t. As I said if I link frontend1 as frontend0 it is detected as dvb-c, but when there is frontend0 which is dvb-t it will get recogniced as dvb-t. It can for sure be a driver issue, if you want me to log something let me know.

You should see 2 tuners - DVB-T and DVB-C not only one... Could you put some diff --git a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c

Could you show me what is printed with this debug code?

diff --git a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
index ad9a919..09d4e2d 100644
--- a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
+++ b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
@@ -317,8 +317,10 @@ linuxdvb_adapter_add ( const char *path )
     linuxdvb_frontend_create(feconf, la, i, fe_path, dmx_path, dvr_path, type, dfi.name);
 #if DVB_VER_ATLEAST(5,5)
     fetypes[type] = 1;
+    printf("master type: %i\n", type);
     for (j = 0; j < cmd.u.buffer.len; j++) {
       delsys = cmd.u.buffer.data[j];
+      printf("delsys %i = %i\n", j, delsys);

       if ((delsys = linuxdvb2tvh_delsys(delsys)) == DVB_SYS_NONE)
         continue;
@@ -327,6 +329,8 @@ linuxdvb_adapter_add ( const char *path )
       if ((type = dvb_delsys2type(delsys)) == DVB_TYPE_NONE)
         continue;

+      printf("next type: %i\n", type);
+
       /* Couldn't find */
       if (fetypes[type])
         continue;
#4

Updated by B C over 9 years ago

I do see both frontends / tuner, but they both show up as DVB-T. So adapter4 is the device in question. Showing up in tvh as:

/dev/dvb/adapter4/[Realtek RTL2832 (DVB-T)]
  • Panasonic MN88473 : DVB-T #1 (which should be DVB-C) and
  • Realtek RTL2832 (DVB-T) : DVB-T #0

here are the debug messages:
2015-03-18 17:56:11.068 [ INFO] linuxdvb: adapter added /dev/dvb/adapter4
master type: 1
delsys 0 = 3
next type: 1
master type: 1
2015-03-18 17:56:11.683 [ INFO] linuxdvb: adapter added /dev/dvb/adapter3
master type: 3
delsys 0 = 5
next type: 3
delsys 1 = 6
next type: 3
delsys 2 = 4
master type: 3
delsys 0 = 5
next type: 3
delsys 1 = 6
next type: 3
delsys 2 = 4
2015-03-18 17:56:11.722 [ INFO] linuxdvb: adapter added /dev/dvb/adapter2
master type: 3
delsys 0 = 5
next type: 3
delsys 1 = 6
next type: 3
delsys 2 = 4
2015-03-18 17:56:11.737 [ INFO] linuxdvb: adapter added /dev/dvb/adapter1
master type: 3
delsys 0 = 5
next type: 3
delsys 1 = 6
next type: 3
delsys 2 = 4
2015-03-18 17:56:11.759 [ INFO] linuxdvb: adapter added /dev/dvb/adapter0

#5

Updated by Jaroslav Kysela over 9 years ago

Sorry, it's a bit unreadable. I thought you have only one adapter, could you replace printf with tvhinfo to have all lines in order ?

diff --git a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
index ad9a919..7d1b827 100644
--- a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
+++ b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
@@ -317,8 +317,10 @@ linuxdvb_adapter_add ( const char *path )
     linuxdvb_frontend_create(feconf, la, i, fe_path, dmx_path, dvr_path, type, dfi.name);
 #if DVB_VER_ATLEAST(5,5)
     fetypes[type] = 1;
+    tvhinfo("linuxdvb", "master type: %i", type);
     for (j = 0; j < cmd.u.buffer.len; j++) {
       delsys = cmd.u.buffer.data[j];
+      tvhinfo("linuxdvb", "delsys %i = %i", j, type);

       if ((delsys = linuxdvb2tvh_delsys(delsys)) == DVB_SYS_NONE)
         continue;
@@ -327,6 +329,8 @@ linuxdvb_adapter_add ( const char *path )
       if ((type = dvb_delsys2type(delsys)) == DVB_TYPE_NONE)
         continue;

+      tvhinfo("linuxdvb", "next type %i", type);
+
       /* Couldn't find */
       if (fetypes[type])
         continue;
#6

Updated by B C over 9 years ago

sure, here we go

2015-03-18 23:01:25.774 [ INFO] linuxdvb: adapter added /dev/dvb/adapter4
2015-03-18 23:01:25.776 [ INFO] linuxdvb: master type: 1
2015-03-18 23:01:25.776 [ INFO] linuxdvb: delsys 0 = 1
2015-03-18 23:01:25.776 [ INFO] linuxdvb: next type 1
2015-03-18 23:01:26.376 [ INFO] linuxdvb: master type: 1
2015-03-18 23:01:26.394 [ INFO] linuxdvb: adapter added /dev/dvb/adapter3
2015-03-18 23:01:26.394 [ INFO] linuxdvb: master type: 3
2015-03-18 23:01:26.394 [ INFO] linuxdvb: delsys 0 = 3
2015-03-18 23:01:26.394 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.394 [ INFO] linuxdvb: delsys 1 = 3
2015-03-18 23:01:26.394 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.394 [ INFO] linuxdvb: delsys 2 = 3
2015-03-18 23:01:26.435 [ INFO] linuxdvb: adapter added /dev/dvb/adapter2
2015-03-18 23:01:26.435 [ INFO] linuxdvb: master type: 3
2015-03-18 23:01:26.435 [ INFO] linuxdvb: delsys 0 = 3
2015-03-18 23:01:26.435 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.435 [ INFO] linuxdvb: delsys 1 = 3
2015-03-18 23:01:26.435 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.435 [ INFO] linuxdvb: delsys 2 = 3
2015-03-18 23:01:26.451 [ INFO] linuxdvb: adapter added /dev/dvb/adapter1
2015-03-18 23:01:26.451 [ INFO] linuxdvb: master type: 3
2015-03-18 23:01:26.451 [ INFO] linuxdvb: delsys 0 = 3
2015-03-18 23:01:26.451 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.451 [ INFO] linuxdvb: delsys 1 = 3
2015-03-18 23:01:26.451 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.451 [ INFO] linuxdvb: delsys 2 = 3
2015-03-18 23:01:26.474 [ INFO] linuxdvb: adapter added /dev/dvb/adapter0
2015-03-18 23:01:26.475 [ INFO] linuxdvb: master type: 3
2015-03-18 23:01:26.475 [ INFO] linuxdvb: delsys 0 = 3
2015-03-18 23:01:26.475 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.475 [ INFO] linuxdvb: delsys 1 = 3
2015-03-18 23:01:26.475 [ INFO] linuxdvb: next type 3
2015-03-18 23:01:26.475 [ INFO] linuxdvb: delsys 2 = 3

#7

Updated by B C over 9 years ago

looking at my log, I think you made a copy paste error, this should be right now for delsys

2015-03-18 23:06:43.756 [ INFO] linuxdvb: adapter added /dev/dvb/adapter4
2015-03-18 23:06:43.759 [ INFO] linuxdvb: master type: 1
2015-03-18 23:06:43.759 [ INFO] linuxdvb: delsys 0 = 3
2015-03-18 23:06:43.759 [ INFO] linuxdvb: next type 1
2015-03-18 23:06:44.356 [ INFO] linuxdvb: master type: 1
2015-03-18 23:06:44.374 [ INFO] linuxdvb: adapter added /dev/dvb/adapter3
2015-03-18 23:06:44.375 [ INFO] linuxdvb: master type: 3
2015-03-18 23:06:44.375 [ INFO] linuxdvb: delsys 0 = 5
2015-03-18 23:06:44.375 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.375 [ INFO] linuxdvb: delsys 1 = 6
2015-03-18 23:06:44.375 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.375 [ INFO] linuxdvb: delsys 2 = 4
2015-03-18 23:06:44.416 [ INFO] linuxdvb: adapter added /dev/dvb/adapter2
2015-03-18 23:06:44.416 [ INFO] linuxdvb: master type: 3
2015-03-18 23:06:44.416 [ INFO] linuxdvb: delsys 0 = 5
2015-03-18 23:06:44.416 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.416 [ INFO] linuxdvb: delsys 1 = 6
2015-03-18 23:06:44.416 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.416 [ INFO] linuxdvb: delsys 2 = 4
2015-03-18 23:06:44.433 [ INFO] linuxdvb: adapter added /dev/dvb/adapter1
2015-03-18 23:06:44.433 [ INFO] linuxdvb: master type: 3
2015-03-18 23:06:44.433 [ INFO] linuxdvb: delsys 0 = 5
2015-03-18 23:06:44.433 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.433 [ INFO] linuxdvb: delsys 1 = 6
2015-03-18 23:06:44.433 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.433 [ INFO] linuxdvb: delsys 2 = 4
2015-03-18 23:06:44.456 [ INFO] linuxdvb: adapter added /dev/dvb/adapter0
2015-03-18 23:06:44.457 [ INFO] linuxdvb: master type: 3
2015-03-18 23:06:44.457 [ INFO] linuxdvb: delsys 0 = 5
2015-03-18 23:06:44.457 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.457 [ INFO] linuxdvb: delsys 1 = 6
2015-03-18 23:06:44.457 [ INFO] linuxdvb: next type 3
2015-03-18 23:06:44.457 [ INFO] linuxdvb: delsys 2 = 4

#8

Updated by Jaroslav Kysela over 9 years ago

B C wrote:

looking at my log, I think you made a copy paste error, this should be right now for delsys

2015-03-18 23:06:43.756 [ INFO] linuxdvb: adapter added /dev/dvb/adapter4
2015-03-18 23:06:43.759 [ INFO] linuxdvb: master type: 1
2015-03-18 23:06:43.759 [ INFO] linuxdvb: delsys 0 = 3
2015-03-18 23:06:43.759 [ INFO] linuxdvb: next type 1
2015-03-18 23:06:44.356 [ INFO] linuxdvb: master type: 1

OK, adapter4 only reports two DVB-T frontends here. The mn88473 driver should report all three subsystems:

.delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_AC},

I added new line to debug prints to see more:

diff --git a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
index ad9a919..fafe86d 100644
--- a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
+++ b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c
@@ -244,6 +244,7 @@ linuxdvb_adapter_add ( const char *path )
     }
 #if DVB_VER_ATLEAST(5,5)
     r = ioctl(fd, FE_GET_PROPERTY, &cmdseq);
+    tvhinfo("linuxdvb", "get property for %s retval %d len %d", fe_path, r, cmd.u.buffer.len);
     if (!r && cmd.u.buffer.len) {
       struct dtv_property fecmd[2] = {
         {
@@ -317,8 +318,10 @@ linuxdvb_adapter_add ( const char *path )
     linuxdvb_frontend_create(feconf, la, i, fe_path, dmx_path, dvr_path, type, dfi.name);
 #if DVB_VER_ATLEAST(5,5)
     fetypes[type] = 1;
+    tvhinfo("linuxdvb", "master type: %i", type);
     for (j = 0; j < cmd.u.buffer.len; j++) {
       delsys = cmd.u.buffer.data[j];
+      tvhinfo("linuxdvb", "delsys %i = %i", j, delsys);

       if ((delsys = linuxdvb2tvh_delsys(delsys)) == DVB_SYS_NONE)
         continue;
@@ -327,6 +330,8 @@ linuxdvb_adapter_add ( const char *path )
       if ((type = dvb_delsys2type(delsys)) == DVB_TYPE_NONE)
         continue;

+      tvhinfo("linuxdvb", "next type %i", type);
+
       /* Couldn't find */
       if (fetypes[type])
         continue;
#9

Updated by B C over 9 years ago

2015-03-19 11:43:34.619 [ INFO] linuxdvb: get property for /dev/dvb/adapter4/frontend0 retval 0 len 1
2015-03-19 11:43:34.621 [ INFO] linuxdvb: adapter added /dev/dvb/adapter4
2015-03-19 11:43:34.625 [ INFO] linuxdvb: master type: 1
2015-03-19 11:43:34.625 [ INFO] linuxdvb: delsys 0 = 3
2015-03-19 11:43:34.625 [ INFO] linuxdvb: next type 1
2015-03-19 11:43:35.214 [ INFO] linuxdvb: get property for /dev/dvb/adapter4/frontend1 retval -1 len 1
2015-03-19 11:43:35.219 [ INFO] linuxdvb: master type: 1

#10

Updated by Jaroslav Kysela over 9 years ago

Could you try the attached patch ? I think that I found the culprit.

#11

Updated by B C over 9 years ago

looking good now, mn88473 is detected as DVB-C #1 and DVB-T #1, beside Realtek beeing DVB-T #0. I can select a DVB-C Network now. For other tests I will have to wait till the evening as its buggy driver once again faild to upload the firmware, so I will have to physically reattach it as unbinding just resulted in a kernel error

I will update ASAP
As alway, thank you for your great support here.

#12

Updated by B C over 9 years ago

and voila, tuning is working as well, so this seems to be fixed, great, thanks

#13

Updated by Merlin Steuer over 9 years ago

I cannot compile TVHeadend 3.9.2525~g96898a6:

CC              src/input/mpegts/linuxdvb/linuxdvb_adapter.o
src/input/mpegts/linuxdvb/linuxdvb_adapter.c: In function ‘linuxdvb_get_systems’:
src/input/mpegts/linuxdvb/linuxdvb_adapter.c:188:12: error: ‘DTV_ENUM_DELSYS’ undeclared (first use in this function)
src/input/mpegts/linuxdvb/linuxdvb_adapter.c:188:12: note: each undeclared identifier is reported only once for each function it appears in
src/input/mpegts/linuxdvb/linuxdvb_adapter.c: At top level:
src/input/mpegts/linuxdvb/linuxdvb_adapter.c:185:1: error: ‘linuxdvb_get_systems’ defined but not used [-Werror=unused-function]
cc1: all warnings being treated as errors
Makefile:414: recipe for target '/home/pi/tvheadend/build.linux/src/input/mpegts/linuxdvb/linuxdvb_adapter.o' failed
make: *** [/home/pi/tvheadend/build.linux/src/input/mpegts/linuxdvb/linuxdvb_adapter.o] Error 1
#14

Updated by Jaroslav Kysela over 9 years ago

Merlin Steuer wrote:

I cannot compile TVHeadend 3.9.2525~g96898a6:

[...]

You don't have proper linuxdvb kernel headers. Use Linux DVB API 5.5 or later.

#15

Updated by Merlin Steuer over 9 years ago

How can I updates these on my Raspberry Pi Debian Wheezy, Kernel 3.18?

#16

Updated by Jaroslav Kysela over 9 years ago

  • Status changed from New to Fixed

Fixed in v3.9-2613-g93f3f6f .

Also available in: Atom PDF