mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Now using FE_READ_STATUS to read the current frontend status
This commit is contained in:
parent
a94f6a8443
commit
fa0af7065e
@ -520,8 +520,9 @@ Christian Rienecker <C.Rienecker@gmx.net>
|
|||||||
Joerg Riechardt <J.Riechardt@gmx.de>
|
Joerg Riechardt <J.Riechardt@gmx.de>
|
||||||
for filling in some missing teletext PIDs
|
for filling in some missing teletext PIDs
|
||||||
|
|
||||||
Holger Wächtler <holger@convergence.de>
|
Holger Wächtler <holger@qanu.de>
|
||||||
for some valuable advice during adapting to the NEWSTRUCT driver
|
for some valuable advice during adapting to the NEWSTRUCT driver
|
||||||
|
for suggesting to use FE_READ_STATUS to read the current frontend status
|
||||||
|
|
||||||
Jürgen Zimmermann <jnzimmer@informatik.uni-kl.de>
|
Jürgen Zimmermann <jnzimmer@informatik.uni-kl.de>
|
||||||
for adding some missing #includes to files in libdtv for gcc 3.2
|
for adding some missing #includes to files in libdtv for gcc 3.2
|
||||||
|
4
HISTORY
4
HISTORY
@ -3963,7 +3963,7 @@ Video Disk Recorder Revision History
|
|||||||
commands may now be executed at any time, and the message will be displayed
|
commands may now be executed at any time, and the message will be displayed
|
||||||
(no more "pending message").
|
(no more "pending message").
|
||||||
|
|
||||||
2006-01-03: Version 1.3.38
|
2006-01-04: Version 1.3.38
|
||||||
|
|
||||||
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
|
- Fixed handling second audio and Dolby Digital PIDs for encrypted channels
|
||||||
(was broken in version 1.3.37).
|
(was broken in version 1.3.37).
|
||||||
@ -4077,3 +4077,5 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed handling TS packets in cTS2PES (thanks to Reinhard Nissl).
|
- Fixed handling TS packets in cTS2PES (thanks to Reinhard Nissl).
|
||||||
- Added cTimer::SetPriority() to set a timer's priority (suggested by Kendy Kutzner).
|
- Added cTimer::SetPriority() to set a timer's priority (suggested by Kendy Kutzner).
|
||||||
- Added cMenuEditStrItem::InEditMode() (suggested by Christian Wieninger).
|
- Added cMenuEditStrItem::InEditMode() (suggested by Christian Wieninger).
|
||||||
|
- Now using FE_READ_STATUS to read the current frontend status (suggested by
|
||||||
|
Holger Wächtler).
|
||||||
|
42
dvbdevice.c
42
dvbdevice.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: dvbdevice.c 1.145 2006/01/03 10:42:47 kls Exp $
|
* $Id: dvbdevice.c 1.146 2006/01/04 11:47:36 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dvbdevice.h"
|
#include "dvbdevice.h"
|
||||||
@ -84,7 +84,7 @@ private:
|
|||||||
cMutex mutex;
|
cMutex mutex;
|
||||||
cCondVar locked;
|
cCondVar locked;
|
||||||
cCondVar newSet;
|
cCondVar newSet;
|
||||||
bool GetFrontendEvent(dvb_frontend_event &Event, int TimeoutMs = 0);
|
bool GetFrontendStatus(fe_status_t &Status, int TimeoutMs = 0);
|
||||||
bool SetFrontend(void);
|
bool SetFrontend(void);
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
public:
|
public:
|
||||||
@ -147,26 +147,20 @@ bool cDvbTuner::Locked(int TimeoutMs)
|
|||||||
return tunerStatus >= tsLocked;
|
return tunerStatus >= tsLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDvbTuner::GetFrontendEvent(dvb_frontend_event &Event, int TimeoutMs)
|
bool cDvbTuner::GetFrontendStatus(fe_status_t &Status, int TimeoutMs)
|
||||||
{
|
{
|
||||||
if (TimeoutMs) {
|
if (TimeoutMs) {
|
||||||
struct pollfd pfd;
|
cPoller Poller(fd_frontend);
|
||||||
pfd.fd = fd_frontend;
|
if (Poller.Poll(TimeoutMs)) {
|
||||||
pfd.events = POLLIN | POLLPRI;
|
// just to clear the event queue - we'll read the actual status below
|
||||||
do {
|
dvb_frontend_event Event;
|
||||||
int stat = poll(&pfd, 1, TimeoutMs);
|
CHECK(ioctl(fd_frontend, FE_GET_EVENT, &Event));
|
||||||
if (stat == 1)
|
|
||||||
break;
|
|
||||||
if (stat < 0) {
|
|
||||||
if (errno == EINTR)
|
|
||||||
continue;
|
|
||||||
esyslog("ERROR: frontend %d poll failed: %m", cardIndex);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
return false;
|
return false;
|
||||||
} while (0);
|
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
int stat = ioctl(fd_frontend, FE_GET_EVENT, &Event);
|
int stat = ioctl(fd_frontend, FE_READ_STATUS, &Status);
|
||||||
if (stat == 0)
|
if (stat == 0)
|
||||||
return true;
|
return true;
|
||||||
if (stat < 0) {
|
if (stat < 0) {
|
||||||
@ -304,17 +298,16 @@ void cDvbTuner::Action(void)
|
|||||||
{
|
{
|
||||||
cTimeMs Timer;
|
cTimeMs Timer;
|
||||||
bool LostLock = false;
|
bool LostLock = false;
|
||||||
dvb_frontend_event event;
|
fe_status_t Status = (fe_status_t)0;
|
||||||
while (Running()) {
|
while (Running()) {
|
||||||
bool hasEvent = GetFrontendEvent(event, 1);
|
fe_status_t NewStatus;
|
||||||
|
if (GetFrontendStatus(NewStatus, 10))
|
||||||
|
Status = NewStatus;
|
||||||
cMutexLock MutexLock(&mutex);
|
cMutexLock MutexLock(&mutex);
|
||||||
switch (tunerStatus) {
|
switch (tunerStatus) {
|
||||||
case tsIdle:
|
case tsIdle:
|
||||||
break;
|
break;
|
||||||
case tsSet:
|
case tsSet:
|
||||||
if (hasEvent)
|
|
||||||
continue;
|
|
||||||
tunerStatus = SetFrontend() ? tsTuned : tsIdle;
|
tunerStatus = SetFrontend() ? tsTuned : tsIdle;
|
||||||
Timer.Set(tuneTimeout);
|
Timer.Set(tuneTimeout);
|
||||||
continue;
|
continue;
|
||||||
@ -329,14 +322,14 @@ void cDvbTuner::Action(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case tsLocked:
|
case tsLocked:
|
||||||
if (hasEvent) {
|
if (Status & FE_REINIT) {
|
||||||
if (event.status & FE_REINIT) {
|
|
||||||
tunerStatus = tsSet;
|
tunerStatus = tsSet;
|
||||||
diseqcCommands = NULL;
|
diseqcCommands = NULL;
|
||||||
esyslog("ERROR: frontend %d was reinitialized", cardIndex);
|
esyslog("ERROR: frontend %d was reinitialized", cardIndex);
|
||||||
lastTimeoutReport = 0;
|
lastTimeoutReport = 0;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (event.status & FE_HAS_LOCK) {
|
else if (Status & FE_HAS_LOCK) {
|
||||||
if (LostLock) {
|
if (LostLock) {
|
||||||
esyslog("frontend %d regained lock", cardIndex);
|
esyslog("frontend %d regained lock", cardIndex);
|
||||||
LostLock = false;
|
LostLock = false;
|
||||||
@ -351,7 +344,6 @@ void cDvbTuner::Action(void)
|
|||||||
tunerStatus = tsTuned;
|
tunerStatus = tsTuned;
|
||||||
Timer.Set(lockTimeout);
|
Timer.Set(lockTimeout);
|
||||||
lastTimeoutReport = 0;
|
lastTimeoutReport = 0;
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user