All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Rankin <rankincj@yahoo.com>
To: linux-media@vger.kernel.org
Subject: Is DVB ioctl FE_SET_FRONTEND broken?
Date: Thu, 25 Aug 2011 16:27:29 -0700 (PDT)	[thread overview]
Message-ID: <1314314849.52943.YahooMailClassic@web121708.mail.ne1.yahoo.com> (raw)

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


             reply	other threads:[~2011-08-25 23:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 23:27 Chris Rankin [this message]
2011-08-25 23:43 ` Is DVB ioctl FE_SET_FRONTEND broken? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314314849.52943.YahooMailClassic@web121708.mail.ne1.yahoo.com \
    --to=rankincj@yahoo.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.