static bool wait_for_backend(int fd, int timeout_ms)
{
struct timeval select_timeout = { 0, (timeout_ms % 1000) * 1000 /*usec*/};
fd_set fd_select_set;
FD_ZERO( &fd_select_set);
FD_SET (fd, &fd_select_set);
// Try to wait for some output like an event, unfortunately
// this fails on several DVB cards, so we have a timeout.
select(fd+1, &fd_select_set, NULL, NULL, &select_timeout);
// This is supposed to work on all cards, post 2.6.12...
fe_status_t status;
if (ioctl(fd, FE_READ_STATUS, &status) < 0)
{
VERBOSE(VB_IMPORTANT, QString("dvbchannel.cpp:wait_for_backend: "
"Failed to get status, error: %1")
.arg(strerror(errno)));
return false;
}
VERBOSE(VB_CHANNEL, QString("dvbchannel.cpp:wait_for_backend: Status: %1")
.arg(toString(status)));
return true;
}