Opened 2 years ago

Closed 16 months ago

#13371 closed Bug Report - General (fixed)

HDHomeRun DVB-C device seen as DVB-T

Reported by: Klaas de Waal Owned by: Klaas de Waal
Priority: minor Milestone: 31.0
Component: MythTV - Channel Scanner Version: Master Head
Severity: medium Keywords: DVB DVB-C channelscan HDHomeRun HDHR3-4DC
Cc: Stuart Auchterlonie, gigem Ticket locked: no


The HDHomeRun HDHR3-4DC DVB-C network tuner is seen by MythTV as a DVB-T device.
This can be verified with a channel scan in mythtv-setup and selecting a "Full Scan (Tuned)"; it is then possible to fill in all the DVB-T tuning parameters instead of those for DVB-C.

The following code in cardutil.cpp is where it starts:

bool CardUtil::HDHRdoesDVB(const QString &device)
    (void) device;

    hdhomerun_device_t  *hdhr;
    hdhr = hdhomerun_device_create_from_str(device.toLatin1(), nullptr);
    if (!hdhr)
        return false;

    const char *model = hdhomerun_device_get_model_str(hdhr);
    if (model && strstr(model, "dvb"))
        return true;


    return false;

What happens here is that the firmware identification string is searched for the presence of "dvb" in the string. This is the case for the HDHR3-4DC with firmware "hdhomerun3_dvbc".

In scanwizardconfig.cpp, where HDHRDoesDVB() is called, it is then decided that this is a DVB-T device:

        case CardUtil::HDHOMERUN:
            if (CardUtil::HDHRdoesDVB(CardUtil::GetVideoDevice(cardid)))
                addSelection(tr("Full Scan"),
                             QString::number(FullScan_DVBT), true);
                addSelection(tr("Full Scan (Tuned)"),

Amazingly, the HDHR device does work most of the time because mythtv-setup generates tuning commands of the form "auto:<frequency", e.g. "auto:474000000", and this works often but not always. With experimenting I found that the HDHR has a parameter /sys/dvbc_modulation which contains the tuning parameters that it tries when it gets the "auto:<frequency>: command.
If parameter /sys/dvbc_modulation does contain the correct modulation parameters then all works OK but otherwise tuning fails. The value can be read and written with the hdhomerun_config utility which can be downloaded from
On my system it looks like this:

[klaas@modu ~]$ hdhomerun_config 1410F45C get /sys/dvbc_modulation
a8qam64-6875 a8qam256-6900 
[klaas@modu ~]$ 

I have described this in more detail in a comment in ticket #12792.

However, it would be much better if MythTV always works without other support applications and for this it needs to generate explicit tuning parameters such as "a8qam256-6900". The code for this is already present in hdhrchannel.cpp:

static QString format_dvbc(const DTVMultiplex &tuning, const QString &mod)
    const QChar b = tuning.bandwidth.toChar();

    if ((QChar('a') == b) || (mod == "auto"))
        return "auto"; // uses bandwidth from channel map
    else if ((QChar('a') != b) && (tuning.symbolrate > 0))
        return QString("a%1%2-%3")

    return QString("auto%1c").arg(b);

I have verified with a quick hack that if this routine generates a string with bandwidth/modulation/symbolrate such as "a8qam256-9600" that tuning does work correct.

A complete solution consists of the following parts:
(1) change tuner type to DVB-C for the HDHR DVB-C devices
(2) add selection item for channel bandwidth (auto, 8, 7, 6 MHz)
(3) store the bandwidth value in the database tables dtv_multiplex and channelscan_dtv_multiplex
There is no database schema change needed; there is already a "bandwidth" field which is currently always 'a'.

The code for this is currently somewhere halfway.

Attachments (2)

20190112-hdhr-dvbc.patch (3.6 KB) - added by Klaas de Waal 2 years ago.
Change tuner type to DVB-C for HDHomeRun DVB-C devices
20190112-hdhr-8mhz.patch (790 bytes) - added by Klaas de Waal 2 years ago.
Always 8MHz bandwidth for HDHomeRun DVB-C devices

Download all attachments as: .zip

Change History (8)

comment:1 Changed 2 years ago by Klaas de Waal

Created a first patch that implements (1) above, change tuner type to DVB-C for the HDHomeRun DVB-C devices.

Created a second patch that modifies format_dvbc in hdhrchannel.cpp to generate a tuning string when modulation and symbol rate are specified but the bandwidth is not. In that case the bandwidth is set to 8MHz.

Some exploratory programming to implement (2) and (3), bandwidth selection, gives the insight that the "Full Scan (Tuned)" only specifies the parameters for the first transport; the NIT is then parsed and that gives the tuning parameters for all other transports in the cable system delivery descriptors. For DVB-C, the delivery descriptors do not include the bandwidth and hence the 'a' (auto) is used to tune the other transports. At this moment, replacing the 'a' with the selected bandwidth everywhere looks rather complicated and is maybe not the way forward.

A question is also how useful it is to support DVB-C channels that do not have 8MHz bandwidth. According to the Dutch Wikipedia all European countries use 8MHz DVB-C channels so the attached patches could be good enough.

Changed 2 years ago by Klaas de Waal

Attachment: 20190112-hdhr-dvbc.patch added

Change tuner type to DVB-C for HDHomeRun DVB-C devices

Changed 2 years ago by Klaas de Waal

Attachment: 20190112-hdhr-8mhz.patch added

Always 8MHz bandwidth for HDHomeRun DVB-C devices

comment:2 Changed 2 years ago by Klaas de Waal

Owner: set to Klaas de Waal
Status: newassigned

comment:3 Changed 2 years ago by Klaas de Waal

The patches 20190112-hdhr-8mhz.patch and 20190112-hdhr-dvbc.patch work perfect in an 8MHz DVB-C environment.
However, the DVB standards do also support other channel widths for DVB-C so supporting only 8Mhz for the HDHomerun devices in MythTV is not correct.

comment:4 Changed 16 months ago by Klaas de Waal

The patches described here have now been tested for a long time. Although the patches do limit the support for DVB-C to 8MHz bandwidth channels only this is still much better than having no support for DVB-C which is the current situation, so there will be no users affected by this. If the need ever arises to support DVB-C on HDHomeRun devices for other bandwidths then this can be implemented by a general setting for bandwidth.

comment:5 Changed 16 months ago by Klaas de Waal

Milestone: needs_triage31.0
Version: UnspecifiedMaster Head

comment:6 Changed 16 months ago by Klaas de Waal <klaas@…>

Resolution: fixed
Status: assignedclosed

In b6b39470e/mythtv:

HDHomeRun DVB_C support

Correctly identify HDHomeRun DVB-C devices.
Previously, all HDHomeRun DVB devices were seen as DVB-T/T2 devices
in mythtv-setup. This means that for a "Full Scan (Tuned)" the
DVB_T/T2 tuning parameter page was shown instead of
the DVB-C tuning parameter page.

Fixes #13371

Note: See TracTickets for help on using tickets.