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

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to