[mythtv-users] Interpreting capturecard for HDHomeRun

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Mar 16 04:25:47 UTC 2020


On Sun, 15 Mar 2020 13:38:05 -0700, you wrote:

>Along the way to writing a program to update channels for the repack, I've
>run into the issue of figuring out the relation between entries in the
>capturecard table and spots on my HDHomeRun tuner.  Highlights:
>select cardid, parentid, videodevice, cardtype from capturecard;
> +--------+----------+-------------+-----------+
>| cardid | parentid | videodevice | cardtype  |
>+--------+----------+-------------+-----------+
>|      1 |        0 | 10424297    | HDHOMERUN |
>|      2 |        1 | 10424297    | HDHOMERUN |
>|      3 |        0 | 10424297    | HDHOMERUN |
>|      4 |        3 | 10424297    | HDHOMERUN |
>+--------+----------+-------------+-----------+
>
>My HDHR device has 2 tuners, know at /tuner0 and /tuner1 when using
>hdhomerun_config.
>I created double entries for capture cards so that I could record, e.g.,
>4.1 and 4.2 at the same time.
>These "extra" entries appear to be identified by having a non-zero parentid.
>
>I am looking for a mapping from cardid to /tuner0 or /tuner1.
>
>One could construct a rule that would give such a mapping but a) the rule
>is rather ad hoc and b) it would conclude that cardids 1 and 2 are tuner0.
>But perhaps sometimes they are tuner0 and sometimes 1.
>
>Any suggestions on how to proceed?
>
>Background: I want to find a free tuner on which I can do a channelscan
>with hdhomerun_config.

The tuner with the 0 parentid is the actual tuner.  Non-zero parentid
values are for multirec virtual tuners.  From the look of your
capturecard table, you have a dual tuner HDHR with both tuners on the
same network address, as the videodevice field is the same for both
physical tuners.  For cardtype='HDHOMERUN', it looks like the
videodevice filed is set the <device id> value used with
hdhomerun_config.

For my mother's dual tuner Hauppauge Nova TD-500, the two DVB-T tuners
each get different videodevice values:

MariaDB [mythconverg]> select cardid, parentid, videodevice, cardtype
from capturecard;
+--------+----------+--------------------------------------+----------+
| cardid | parentid | videodevice                          | cardtype |
+--------+----------+--------------------------------------+----------+
|      1 |        0 | /dev/dvb/adapter0/frontend0          | DVB      |
|      2 |        1 | /dev/dvb/adapter0/frontend0          | DVB      |
|      3 |        1 | /dev/dvb/adapter0/frontend0          | DVB      |
|      4 |        1 | /dev/dvb/adapter0/frontend0          | DVB      |
|      5 |        0 | /dev/dvb/adapter1/frontend0          | DVB      |
|      6 |        5 | /dev/dvb/adapter1/frontend0          | DVB      |
|      7 |        5 | /dev/dvb/adapter1/frontend0          | DVB      |
|      8 |        5 | /dev/dvb/adapter1/frontend0          | DVB      |
|     18 |        0 | /dev/dvb/adapter2/frontend0          | DVB      |
|     19 |       18 | /dev/dvb/adapter2/frontend0          | DVB      |
|     20 |       18 | /dev/dvb/adapter2/frontend0          | DVB      |
|     25 |        0 | NULL                                 | IMPORT   |
|     90 |        0 | http://satip.jsw.gen.nz/playlist.m3u | FREEBOX  |
|     91 |       90 | http://satip.jsw.gen.nz/playlist.m3u | FREEBOX  |
+--------+----------+--------------------------------------+----------+
14 rows in set (0.00 sec)

The dual tuners are adapter0 and adapter1 or adapter1 and adapter2 -
it can vary depending on the enumeration at boot time as the third
(USB) DVB-T tuner uses the same drivers as the dual tuner card and
there is no easy way to distinguish which is which.

So, yes, cardids 1 and 2 are your first HDHR tuner and cardids 3 and 4
are your second HDHR tuner.

If you want to find which tuners are in use, then you should use the
Services API.  Look up the settings table for the BackendServerIP or
BackendServerIP6 address for the backend you want to talk to, then
look up the BackendStatusPort value for the correct port.  Then use
this URL:

http://<BackendServerIP(6)>:<BackendStatusPort>/Dvr/GetEncoderList

Then you have to parse the XML for each tuner status.  See:

https://www.mythtv.org/wiki/DVR_Service#GetEncoderList


More information about the mythtv-users mailing list