Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: cinergyT2: which kernel/usb module to use?



On Freitag, 26. November 2004 14:23, Klaus Schmidinger wrote:
> Holger Waechtler wrote:
> > Johannes Stezenbach wrote:
> > 
> >> My cinergyT2 works fine here (2.6.10-rc2 + current dvb-kernel CVS).
> >>
> >> There's a bug in the cinergyT2 frontend code when prevents it from
> >> working with VDR, though (no frontend events).
> >>  
> >>
> > 
> > the FE_GET_EVENT ioctl was simply not implemented (I already rendered it 
> > obsolete in my mind, since GET_STATUS and GET_FRONTEND provide the same 
> > functionality...).
> > please try again,
> > 
> > Holger
> 
> I was under the impression that FE_GET_EVENT was the correct way
> for an application to determine whether there is a transponder lock.
> If this isn't the case, what exactly _is_ the right way to do this?

Sorry when I stumble in a discussion where I have no deep knowledge.
But code like:

while (ioctl (something) == 0)
	;

is to my opinion boguous.

man ioctl:
RETURN VALUE
       Usually, on success zero is returned.  A  few  ioctls  use
       the  return value as an output parameter and return a non­
       negative value on success.  On error, -1 is returned,  and
       errno is set appropriately.

but a loop like:

bool cDvbTuner::GetFrontendEvent(dvb_frontend_event &Event, int TimeoutMs)
{
  if (TimeoutMs) {
     struct pollfd pfd;
     pfd.fd = fd_frontend;
     pfd.events = POLLIN | POLLPRI;
     do {
        int stat = poll(&pfd, 1, TimeoutMs);
        if (stat == 1)
           break;
        if (stat < 0) {
           if (errno == EINTR)
              continue;
           esyslog("ERROR: frontend %d poll failed: %m", cardIndex);
           }
        return false;
        } while (0);
     }
  do {
     int stat = ioctl(fd_frontend, FE_GET_EVENT, &Event);
     if (stat == 0)
        return true; //stefan lucke: ioctl is successful, so return ! the only way to break this loop.
     if (stat < 0) {
        if (errno == EINTR)
           continue;
        }
     } while (0);
  return false; // stefan lucke: this code is unreached !!
}


in combination with:

void cDvbTuner::Action(void)
{
  dvb_frontend_event event;
  active = true;
  while (active) {
        Lock();
        if (tunerStatus == tsSet) {
           while (GetFrontendEvent(event)) // stefan lucke: loop while successful ioctl ??
                 ; // discard stale events

is not clear. examples are taken from vdr-1.3.16 .

-- 
stefan lucke





Home | Main Index | Thread Index