All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media <linux-media@vger.kernel.org>
Subject: Re: RFC tuner-core: how to set vt->type in g_tuner?
Date: Sat, 25 Jun 2011 11:17:18 -0300	[thread overview]
Message-ID: <4E05EDEE.1000201@redhat.com> (raw)
In-Reply-To: <201106251602.45572.hverkuil@xs4all.nl>

Em 25-06-2011 11:02, Hans Verkuil escreveu:
> Hi all,
> 
> The tuner-core.c implementation does this at the start of g_tuner:
> 
>         if (check_mode(t, vt->type) == -EINVAL)
>                 return 0;
>         vt->type = t->mode;
> 
> The idea is that the vt->type is set depending on whether the VIDIOC_G_TUNER
> ioctl is called from a radio device node or a video device node. If we have a
> tuner that can do both radio and TV, then the type is set to whatever the
> current tuner mode is.
> 
> This seems reasonable, but it will actually run into problems when g_tuner
> is called for audio demodulators like msp3400 or cx25840. These need to know
> the correct vt->type in order to fill in the right fields.
> 
> The problem here is that the tuner subdevices are not necessarily called first.
> In fact, the msp3400/cx25840 are actually called first by ivtv.
> 
> So the msp3400 will get called with type TV, and later the tuner may change that
> to type RADIO. This causes inconsistencies. This has actually been observed when
> testing with ivtv and a PVR-500.
> 
> There are two solutions:
> 
> 1) Audit the drivers and ensure that the tuner subdevices are registered first.
> 
> 2) Do not allow the tuner to switch the type.

(2) is the right thing to do. A VIDIOC_GET_foo should not change anything. They are
supposed to be read only access.

> 
> The problem with 1 is that this will be hard to enforce in the long term. Another
> problem with 1 is that I do think it is a bit unexpected from an application PoV
> that the type is suddenly inconsistent with the node the ioctl is called from.
> 
> The problem with 2 is that some sensible defaults need to be filled in if the
> a radio/TV tuner is called with vt->type set to a different mode than the current
> mode.
> 
> I do not think that is very hard though: afc/signal can be 0, ditto for rxsubchans.
> The audmode field should just report the value last set with s_tuner.
> 
> g_frequency has the same problem as g_tuner. I believe g_frequency shouldn't change
> the type either. Since it already has the last set frequency for tv or radio it can
> just report it.
> 
> I think the second solution is the easiest to implement and the most intuitive as
> well.
> 
> Comments?
> 
> 	Hans
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2011-06-25 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-25 14:02 RFC tuner-core: how to set vt->type in g_tuner? Hans Verkuil
2011-06-25 14:17 ` Mauro Carvalho Chehab [this message]
2011-06-25 14:47   ` Hans Verkuil

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=4E05EDEE.1000201@redhat.com \
    --to=mchehab@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --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.