Skip to content

Commit

Permalink
Ci (#2985)
Browse files Browse the repository at this point in the history
[CI]
* move startup delay to eDVBCISlot constructor
* don't trigger setCIEnabled on start

Thanks @Dima73 for the hint.
  • Loading branch information
jbleyel authored Aug 3, 2023
1 parent da94ec8 commit 3efef2f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
14 changes: 11 additions & 3 deletions lib/dvb_ci/dvbci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1323,16 +1323,24 @@ void eDVBCISlot::data(int what)

DEFINE_REF(eDVBCISlot);

eDVBCISlot::eDVBCISlot(eMainloop *context, int nr)
eDVBCISlot::eDVBCISlot(eMainloop *context, int nr):
startup_timeout(eTimer::create(context))
{
char configStr[255];
slotid = nr;
m_context = context;
state = stateDisabled;
snprintf(configStr, 255, "config.ci.%d.enabled", slotid);
bool enabled = eConfigManager::getConfigBoolValue(configStr, true);
if (enabled)
openDevice();
int bootDelay = eConfigManager::getConfigIntValue("config.cimisc.bootDelay");
if (enabled) {
if (bootDelay) {
CONNECT(startup_timeout->timeout, eDVBCISlot::openDevice);
startup_timeout->start(1000 * bootDelay, true);
}
else
openDevice();
}
else
/* emit */ eDVBCI_UI::getInstance()->m_messagepump.send(eDVBCIInterfaces::Message(eDVBCIInterfaces::Message::slotStateChanged, getSlotID(), 3)); // state disabled
}
Expand Down
1 change: 1 addition & 0 deletions lib/dvb_ci/dvbci.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class eDVBCISlot: public iObject, public sigc::trackable
int slotid;
int fd;
ePtr<eSocketNotifier> notifier;
ePtr<eTimer> startup_timeout;
int state;
int m_ci_version;
std::map<uint16_t, uint8_t> running_services;
Expand Down
10 changes: 2 additions & 8 deletions lib/python/Screens/Ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ def setRelevantPidsRouting(configElement):


def InitCiConfig():
def delayTimerCallback():
for slot in range(SystemInfo["CommonInterface"]):
config.ci[slot].enabled.addNotifier(setCIEnabled)
config.ci = ConfigSubList()
config.cimisc = ConfigSubsection()
if SystemInfo["CommonInterface"]:
for slot in range(SystemInfo["CommonInterface"]):
config.ci.append(ConfigSubsection())
config.ci[slot].enabled = ConfigYesNo(default=True)
config.ci[slot].enabled.slotid = slot
config.ci[slot].enabled.addNotifier(setCIEnabled, initial_call=False)
config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices=[("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))], default="auto")
config.ci[slot].use_static_pin = ConfigYesNo(default=True)
config.ci[slot].static_pin = ConfigPIN(default=0)
Expand All @@ -68,11 +66,7 @@ def delayTimerCallback():
if SystemInfo["CommonInterfaceCIDelay"]:
config.cimisc.dvbCiDelay = ConfigSelection(default="256", choices=[("16", "16"), ("32", "32"), ("64", "64"), ("128", "128"), ("256", "256")])
config.cimisc.dvbCiDelay.addNotifier(setdvbCiDelay)
config.cimisc.bootDelay = ConfigSelection(default=10, choices=[(x, _("%d Seconds") % x) for x in range(16)])
if config.cimisc.bootDelay.value:
delayTimer = eTimer()
delayTimer.callback.append(delayTimerCallback)
delayTimer.start(config.cimisc.bootDelay.value * 1000, True)
config.cimisc.bootDelay = ConfigSelection(default=5, choices=[(x, _("%d Seconds") % x) for x in range(16)])


class MMIDialog(Screen):
Expand Down

0 comments on commit 3efef2f

Please sign in to comment.