[kaffeine-devel] Quick & dirty patch to make DVDS with CAMCI support
Brought to you by:
hftom,
lasselindqvist
From: DrEagle <dr...@do...> - 2012-08-19 18:00:16
|
Hi, I have modify the git sources with a quick & dirty patch to help Kaffeine working a little better. With this small fix I get a reset for camci when it is frozen. The bad feature of this bug is that kaffeine hang without my DVBS detected. I have only tested this patch with a technotrend USB TT-3650-S2-CI. It may be helpfull but need some rework. Regards, --- diff --git a/src/dvb/dvbcam_linux.cpp b/src/dvb/dvbcam_linux.cpp index 59e220f..49f2125 100644 --- a/src/dvb/dvbcam_linux.cpp +++ b/src/dvb/dvbcam_linux.cpp @@ -636,26 +636,28 @@ void DvbLinuxCam::sendTransportLayerMessage(TransportLayerTag tag, char *data, c uint length = uint(end - data); Q_ASSERT(length < 0x10000); - if (length < 0x80) { - *(--data) = (length & 0xff); - } else { - *(--data) = (length & 0xff); - *(--data) = ((length >> 8) & 0xff); - *(--data) = quint8(0x82); - } +// if (slot>-1) { + if (length < 0x80) { + *(--data) = (length & 0xff); + } else { + *(--data) = (length & 0xff); + *(--data) = ((length >> 8) & 0xff); + *(--data) = quint8(0x82); + } - *(--data) = tag; - *(--data) = ConnectionId; - *(--data) = (slot & 0xff); - length = uint(end - data); + *(--data) = tag; + *(--data) = ConnectionId; + *(--data) = (slot & 0xff); + length = uint(end - data); - if (write(caFd, data, length) != length) { - Log("DvbLinuxCam::sendTransportLayerMessage: cannot send message of length") << - length; - } + if (write(caFd, data, length) != length) { + Log("DvbLinuxCam::sendTransportLayerMessage: cannot send message of length") << + length; + } - pendingCommands |= ExpectingReply; - pollTimer.start(400); + pendingCommands |= ExpectingReply; + pollTimer.start(400); +// } } void DvbLinuxCam::sendSessionLayerMessage(SessionLayerTag tag, char *data, char *end) diff --git a/src/dvb/dvbdevice.cpp b/src/dvb/dvbdevice.cpp index 054381c..7649a08 100644 --- a/src/dvb/dvbdevice.cpp +++ b/src/dvb/dvbdevice.cpp @@ -653,7 +653,7 @@ bool DvbDevice::acquire(const DvbConfigBase *config_) setDeviceState(DeviceIdle); return true; } - + return false; } diff --git a/src/dvb/dvbdevice_linux.cpp b/src/dvb/dvbdevice_linux.cpp index ec6d617..c061ec7 100644 --- a/src/dvb/dvbdevice_linux.cpp +++ b/src/dvb/dvbdevice_linux.cpp @@ -199,11 +199,13 @@ void DvbLinuxDevice::setDeviceEnabled(bool enabled_) bool DvbLinuxDevice::acquire() { - Q_ASSERT(enabled && (frontendFd < 0) && (dvrFd < 0)); +// Q_ASSERT(enabled && (frontendFd < 0) && (dvrFd < 0)); frontendFd = open(QFile::encodeName(frontendPath).constData(), O_RDWR | O_NONBLOCK); +// setDeviceEnabled(false); if (frontendFd < 0) { Log("DvbLinuxDevice::acquire: cannot open frontend") << frontendPath; +// setDeviceEnabled(false); return false; } @@ -213,9 +215,11 @@ bool DvbLinuxDevice::acquire() Log("DvbLinuxDevice::acquire: cannot open dvr") << dvrPath; close(frontendFd); frontendFd = -1; +// setDeviceEnabled(false); return false; } +// setDeviceEnabled(true); return true; } diff --git a/src/dvb/dvbliveview.cpp b/src/dvb/dvbliveview.cpp index 305d25c..b458c13 100644 --- a/src/dvb/dvbliveview.cpp +++ b/src/dvb/dvbliveview.cpp @@ -187,6 +187,7 @@ void DvbLiveView::playChannel(const DvbSharedChannel &channel_) { DvbDevice *newDevice = NULL; +reset: if ((channel.constData() != NULL) && (channel->source == channel_->source) && (channel->transponder.corresponds(channel_->transponder))) { newDevice = manager->requestDevice(channel->source, channel->transponder, @@ -210,13 +211,22 @@ void DvbLiveView::playChannel(const DvbSharedChannel &channel_) KMessageBox::sorry(manager->getParentWidget(), i18nc("@info", "All devices are used for recordings.")); } else { +/* KMessageBox::information(manager->getParentWidget(), i18nc("@info", "No device found.")); +*/ + osdWidget->showText(i18nc("message box", "No device found."), + 2500); + Log("DvbLiveView::playChannel : No device found."); + usleep(100000); + goto reset; } return; } + playbackStatusChanged(MediaWidget::Playing); + internal->channelName = channel->name; internal->resetPipe(); mediaWidget->play(internal); @@ -298,11 +308,11 @@ void DvbLiveView::pmtSectionChanged(const QByteArray &pmtSectionData) } updatePids(true); - +/* if (channel->isScrambled) { device->startDescrambling(internal->pmtSectionData, this); } - +*/ if (internal->timeShiftFile.isOpen()) { return; } @@ -368,9 +378,17 @@ void DvbLiveView::deviceStateChanged() break; case DvbDevice::DeviceIdle: + if (channel->isScrambled) { + device->startDescrambling(internal->pmtSectionData, this); + } + break; case DvbDevice::DeviceRotorMoving: case DvbDevice::DeviceTuning: + break; case DvbDevice::DeviceTuned: + if (channel->isScrambled) { + device->startDescrambling(internal->pmtSectionData, this); + } break; } } diff --git a/src/dvb/dvbmanager.cpp b/src/dvb/dvbmanager.cpp index 192d0f3..6dd3fdf 100644 --- a/src/dvb/dvbmanager.cpp +++ b/src/dvb/dvbmanager.cpp @@ -101,6 +101,7 @@ DvbDevice *DvbManager::requestDevice(const QString &source, const DvbTransponder DvbDevice *device = it.device; if (!device->acquire(config.constData())) { + break; continue; } @@ -161,6 +162,7 @@ DvbDevice *DvbManager::requestExclusiveDevice(const QString &source) DvbDevice *device = it.device; if (!device->acquire(config.constData())) { + break; continue; } |