Skip to content

Commit

Permalink
DVB tuner delivery system read from device
Browse files Browse the repository at this point in the history
The delivery system, which is used to determine
the tuner type, is now read back from the tuner after the
tuner has been configured with the value in the database
table capturecard/inputname.

If the database does not have a valid value then
the tuner is not configured and the tuner type is
determined from the delivery system that is currently
configured in the tuner, either by power-on default
or by the dvb-fe-tool.

Previously, only the delivery system value from the
database was used to determine the tuner type.
This failed if there was no delivery system
configured in the database for that tuner.

Fixes #13434
  • Loading branch information
kmdewaal committed Mar 25, 2019
1 parent d81335e commit 93b6c5a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
32 changes: 26 additions & 6 deletions mythtv/libs/libmythtv/cardutil.cpp
Expand Up @@ -800,6 +800,16 @@ DTVModulationSystem CardUtil::ProbeDeliverySystem(const QString &device)
return delsys;
}

delsys = ProbeDeliverySystem(fd_frontend);
close(fd_frontend);
return delsys;
}

// Get the currently configured delivery system from the device
DTVModulationSystem CardUtil::ProbeDeliverySystem(int fd_frontend)
{
DTVModulationSystem delsys;

#ifdef USING_DVB
struct dtv_property prop;
struct dtv_properties cmd;
Expand All @@ -814,22 +824,29 @@ DTVModulationSystem CardUtil::ProbeDeliverySystem(const QString &device)
if (ret < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("FE_GET_PROPERTY ioctl failed (%1)")
.arg(device) + ENO);
QString("FE_GET_PROPERTY ioctl failed (fd:%1)")
.arg(fd_frontend) + ENO);
return delsys;
}

delsys.Parse(DTVModulationSystem::toString(prop.u.data));

LOG(VB_GENERAL, LOG_INFO, LOC + QString("(%1) delsys:%2 %3")
.arg(device).arg(delsys).arg(delsys.toString()));
LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("delsys:%1 %2")
.arg(delsys).arg(delsys.toString()));

#endif // USING_DVB

close(fd_frontend);
return delsys;
}

// Get the currently configured tuner type from the device
DTVTunerType CardUtil::ProbeTunerType(int fd_frontend)
{
DTVModulationSystem delsys = ProbeDeliverySystem(fd_frontend);
DTVTunerType tunertype = ConvertToTunerType(delsys);
return tunertype;
}

// Get the currently configured tuner type from the device
DTVTunerType CardUtil::ProbeTunerType(const QString &device)
{
Expand Down Expand Up @@ -927,7 +944,10 @@ int CardUtil::SetDeliverySystem(uint inputid, int fd)

#ifdef USING_DVB
DTVModulationSystem delsys = GetDeliverySystem(inputid);
ret = SetDeliverySystem(inputid, delsys, fd);
if (DTVModulationSystem::kModulationSystem_UNDEFINED != delsys)
{
ret = SetDeliverySystem(inputid, delsys, fd);
}
#endif // USING_DVB

return ret;
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/cardutil.h
Expand Up @@ -376,7 +376,9 @@ class MTV_PUBLIC CardUtil
static bool IsDVBInputType(const QString &inputType);
static QString ProbeDVBFrontendName(const QString &device);
static QStringList ProbeDeliverySystems(const QString &device);
static DTVModulationSystem ProbeDeliverySystem(int fd_frontend);
static DTVModulationSystem ProbeDeliverySystem(const QString &device);
static DTVTunerType ProbeTunerType(int fd_frontend);
static DTVTunerType ProbeTunerType(const QString &device);
static DTVTunerType ConvertToTunerType(DTVModulationSystem delsys);
static DTVTunerType GetTunerType(uint inputid);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/dvbchannel.cpp
Expand Up @@ -268,7 +268,7 @@ bool DVBChannel::Open(DVBChannel *who)
m_symbol_rate_maximum = info.symbol_rate_max;

CardUtil::SetDeliverySystem(m_inputid, m_fd_frontend);
m_tunerType = CardUtil::GetTunerType(m_inputid);
m_tunerType = CardUtil::ProbeTunerType(m_fd_frontend);

LOG(VB_RECORD, LOG_INFO, LOC +
QString("Frontend '%2' tunertype:%3 %4")
Expand Down

0 comments on commit 93b6c5a

Please sign in to comment.