All of lore.kernel.org
 help / color / mirror / Atom feed
* Is DVB ioctl FE_SET_FRONTEND broken?
@ 2011-08-25 23:27 Chris Rankin
  2011-08-25 23:43 ` Andreas Oberritter
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Rankin @ 2011-08-25 23:27 UTC (permalink / raw)
  To: linux-media

Hi,

As far as I understand it, the FE_SET_FRONTEND ioctl is supposed to tell a DVB device to tune itself, and will send a poll() event when it completes. The "frequency" parameter of this event will be the frequency of the newly tuned channel, or 0 if tuning failed.

http://www.linuxtv.org/docs/dvbapi/DVB_Frontend_API.html#SECTION00328000000000000000

I have now tested with 2 different DVB adapters, and I don't think the 3.0.x kernel still behaves like this. A study of the dvb-core/dvb_frontend.c file reveals the following code:

In the dvb_frontend_ioctl_legacy() function,

    switch(cmd) {

    ...

    case FE_SET_FRONTEND: {

        ...

        fepriv->state = FESTATE_RETUNE;

        /* Request the search algorithm to search */
        fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN;

        dvb_frontend_wakeup(fe);
        dvb_frontend_add_event(fe, 0);   // <--- HERE!!!!
        fepriv->status = 0;
        err = 0;
        break;
    }

So basically, the ioctl always sends an event immediately and does not wait for the tuning to happen first. Presumably, the device still tunes in the background and writes the frequency into the frontend's private structure so that a second FE_SET_FRONTEND ioctl succeeds. But this is not the documented behaviour.

The bug is visible when you try to use the device for the very first time. I tested by unloading / reloading the kernel modules, launching xine and then pressing its DVB button. This *always* fails the first time, for the reason described above, and works every time after that.

Cheers,
Chris


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-26 12:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-25 23:27 Is DVB ioctl FE_SET_FRONTEND broken? Chris Rankin
2011-08-25 23:43 ` Andreas Oberritter
2011-08-26  8:50   ` Chris Rankin
2011-08-26  9:49     ` Andreas Oberritter
2011-08-26 11:31       ` Chris Rankin
2011-08-26 12:13         ` Andreas Oberritter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.