Skip to content

Commit

Permalink
[CI] use "Exclude first CA device" only pulse4k(mini) (#4065)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima73 authored and WanWizard committed Oct 24, 2024
1 parent 950fdfd commit 26f2c70
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
18 changes: 12 additions & 6 deletions lib/dvb_ci/descrambler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ int descrambler_set_key(int& desc_fd, eDVBCISlot *slot, int parity, unsigned cha
return 0;
}

int descrambler_set_pid(int desc_fd, int index, int enable, int pid)
int descrambler_set_pid(int desc_fd, eDVBCISlot *slot, int enable, int pid)
{
struct ca_pid p;
unsigned int flags = 0x80;

if (desc_fd < 0)
return -1;

if (index)
if (slot->getSlotID())
flags |= 0x40;

if (enable)
Expand All @@ -150,9 +150,15 @@ int descrambler_set_pid(int desc_fd, int index, int enable, int pid)
p.pid = pid;
p.index = flags;

if (ioctl(desc_fd, CA_SET_PID, &p) == -1) {
eWarning("[CI%d descrambler] set pid failed", index);
return -1;
if (ioctl(desc_fd, CA_SET_PID, &p) == -1)
{
if (slot->getIsCA0Excluded())
return 0;
else
{
eWarning("[CI%d descrambler] set pid failed", slot->getSlotID());
return -1;
}
}

return 0;
Expand All @@ -164,7 +170,7 @@ int descrambler_init(int slot, uint8_t ca_demux_id)

std::string filename = "/dev/dvb/adapter0/ca" + std::to_string(ca_demux_id);

desc_fd = open(filename.c_str(), O_RDWR);
desc_fd = open(filename.c_str(), O_RDWR | O_NONBLOCK | O_CLOEXEC);
if (desc_fd == -1) {
eWarning("[CI%d descrambler] can not open %s", slot, filename.c_str());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/dvb_ci/descrambler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
int descrambler_init(int slot, uint8_t ca_demux_id);
void descrambler_deinit(int desc_fd);
int descrambler_set_key(int& desc_fd, eDVBCISlot *slot, int parity, unsigned char *data);
int descrambler_set_pid(int desc_fd, int index, int enable, int pid);
int descrambler_set_pid(int desc_fd, eDVBCISlot *slot, int enable, int pid);

#endif
4 changes: 2 additions & 2 deletions lib/dvb_ci/dvbci_ccmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void eDVBCICcSession::addProgram(uint16_t program_number, std::vector<uint16_t>&
eDebugNoNewLine("\n");

for (std::vector<uint16_t>::iterator it = pids.begin(); it != pids.end(); ++it)
descrambler_set_pid(m_descrambler_fd, m_slot->getSlotID(), 1, *it);
descrambler_set_pid(m_descrambler_fd, m_slot, 1, *it);

}

Expand All @@ -145,7 +145,7 @@ void eDVBCICcSession::removeProgram(uint16_t program_number, std::vector<uint16_
eDebugNoNewLine("\n");

for (std::vector<uint16_t>::iterator it = pids.begin(); it != pids.end(); ++it)
descrambler_set_pid(m_descrambler_fd, m_slot->getSlotID(), 0, *it);
descrambler_set_pid(m_descrambler_fd, m_slot, 0, *it);

// removing program means probably decoding on this slot is ending. So mark this slot as not descrambling
eDVBCI_UI::getInstance()->setDecodingState(m_slot->getSlotID(), 0);
Expand Down
1 change: 1 addition & 0 deletions lib/python/Components/SystemInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def setBoxInfoItems():
model = BoxInfo.getItem("machine")
BoxInfo.setItem("InDebugMode", eGetEnigmaDebugLvl() >= 4)
BoxInfo.setItem("CommonInterface", model in ("h9combo", "h9combose", "h10", "pulse4kmini") and 1 or eDVBCIInterfaces.getInstance().getNumOfSlots())
BoxInfo.setItem("CiAlternativeCaHandling", model in ("pulse4k", "pulse4kmini"))
BoxInfo.setItem("CommonInterfaceCIDelay", fileCheck("/proc/stb/tsmux/rmx_delay"))
for cislot in range(0, BoxInfo.getItem("CommonInterface")):
BoxInfo.setItem("CI%dSupportsHighBitrates" % cislot, fileCheck("/proc/stb/tsmux/ci%d_tsclk" % cislot))
Expand Down
3 changes: 2 additions & 1 deletion lib/python/Screens/Ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ def appendEntries(self, slot, state):
self.list.append((_("Show CI messages"), config.ci[slot].show_ci_messages, 3, slot))
self.list.append((_("Disable operator profiles"), config.ci[slot].disable_operator_profile, 3, slot))
self.list.append((_("Multiple service support"), config.ci[slot].canDescrambleMultipleServices, 3, slot))
self.list.append((_("Exclude first CA device"), config.ci[slot].exclude_ca0_device, 3, slot))
if BoxInfo.getItem("CiAlternativeCaHandling"):
self.list.append((_("Exclude first CA device"), config.ci[slot].exclude_ca0_device, 3, slot))
if BoxInfo.getItem("CI%dSupportsHighBitrates" % slot):
self.list.append((_("High bitrate support"), config.ci[slot].highBitrate, 3, slot))
if BoxInfo.getItem("CI%dRelevantPidsRoutingSupport" % slot):
Expand Down

0 comments on commit 26f2c70

Please sign in to comment.