All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Bernard GODARD <bernard.godard@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: PWC ioctl inappropriate for device (Regression)
Date: Mon, 11 Jun 2012 20:15:55 +0200	[thread overview]
Message-ID: <4FD635DB.2050705@redhat.com> (raw)
In-Reply-To: <CAFxvmmdUp8-JuPuL=wdZyPkUZ9NEPucwS6ZQf_M0CuWs_bZm+g@mail.gmail.com>

Hi,

On 06/11/2012 04:34 PM, Bernard GODARD wrote:
> Hi Hans,
>
> Thank you for your reply.
>
> I will try to do the fix in qastrocam-g2 myself as this program does
> not currently have a maintainer.

Thanks! Please let me know if you need any help.

If programs like qastrocam-g2 are going to depend on some of the
custom v4l2 ctrls pwc has (so controls not using a standard ctrl id),
then one of the first steps would be to make the ctrl ids for all the
custom controls available in a public header file.

Which means writing a (simple) kernel patch, currently
drivers/media/video/pwc/pwc-v4l.c in the kernel has:

#define PWC_CID_CUSTOM(ctrl) ((V4L2_CID_USER_BASE | 0xf000) + custom_ ## ctrl)

and:

enum { custom_autocontour, custom_contour, custom_noise_reduction,
         custom_awb_speed, custom_awb_delay,
         custom_save_user, custom_restore_user, custom_restore_factory };

And then in various places uses things like:

PWC_CID_CUSTOM(autocontour)

I think it would be best to make a new include/media/pwc.h file, which
then would contain things like:

PWC_CID_AUTOCONTOUR (V4L2_CID_USER_BASE | 0xf000)
PWC_CID_CONTOUR     (V4L2_CID_USER_BASE | 0xf001)

And then in drivers/media/video/pwc/pwc-v4l.c replace PWC_CID_CUSTOM(autocontour)
with PWC_CID_AUTOCONTOUR, etc. It would be good to keep the order the same, as
in the enum, this way your modified qastrocam-g2 will work with the current
kernel too, as the ids are then unchanged.

Another something to look at is the V4L2_CID_AUTO_WHITE_BALANCE control,
which uses a menu, rather then being the standard boolean. The very latest
kernel code has a new standardized ctrl for auto-whitebalance controls
which are a menu, see:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=e40a05736d4503950ec303610a51f838bd59cdc1

It would be nice if you could do a patch to move pwc over to this too. Note
that pwc will move over to this sooner or later (probably sooner, so if you
don't feel up to doing a patch for this yourself let me know and I'll do one),
as making qastrocam-g2 work only with the current V4L2_CID_AUTO_WHITE_BALANCE
and not with the future V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE control means
it will break again in the future :/

This does mean that if you want the modified qastrocam-g2 to work both with
current kernels and with newer kernels where pwc has moved over to
V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, you need to support both. You can simply
do a VIDIOC_QUERYCTRL on both to see which one is present to support both.

Regards,

Hans

      reply	other threads:[~2012-06-11 18:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-09 17:06 PWC ioctl inappropriate for device (Regression) Bernard GODARD
2012-06-09 21:08 ` Hans de Goede
2012-06-11 14:34   ` Bernard GODARD
2012-06-11 18:15     ` Hans de Goede [this message]

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=4FD635DB.2050705@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=bernard.godard@gmail.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.