All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media <linux-media@vger.kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Bjornar Salberg <bsalberg@cisco.com>
Subject: Re: [RFC] How to get current position/status of iris/focus/pan/tilt/zoom?
Date: Wed, 22 Jul 2015 10:51:18 +0200	[thread overview]
Message-ID: <55AF5986.5080106@xs4all.nl> (raw)
In-Reply-To: <20150722082147.GA12092@valkosipuli.retiisi.org.uk>

On 07/22/15 10:21, Sakari Ailus wrote:
> Hi Hans,
> 
> On Thu, Jul 02, 2015 at 02:00:23PM +0200, Hans Verkuil wrote:
>> When using V4L2_CID_IRIS/FOCUS/PAN/TILT/ZOOM_ABSOLUTE/RELATIVE, how do you know
>> when the new position has been reached? If this is controlled through a motor,
>> then it may take some time and ideally you would like to be able to get the
>> current absolute position (if the hardware knows) and whether the final position
>> has been reached or not.
> 
> On voice coil lenses it's also not possible to know when the position has
> been reached, however you can estimate when it has happened based on the
> intended movement and algorithm used to move the lens. This is far from
> trivial though.
> 
> For low-level lends drivers knowing where the lens is is not feasible IMO at
> the moment.
> 
>>
>> In addition, it should be possible to raise fault conditions.
> 
> Do you know of hardware that can do this? The only non-buffer related
> devices that can do this I'm aware of are flash controllers.

If a motor is involved to move things around, then that motor can cause
failures that you want to signal. For example if something is blocking the
motor from moving any further, overheating, whatever. I hate moving parts :-)

> I'd only define them if there's actual hardware that can actually raise
> these conditions.
> 
>>
>> The way the ABSOLUTE controls are defined is ambiguous since it doesn't say
>> anything about what it returns when you read it: is that the current absolute
>> position, or the last set absolute position? I suspect it is the second one.
> 
> I wonder if this has been really well thought out when the controls were
> defined. I share your assumption.
> 
>> If it is the second one, then I propose a V4L2_CID_IRIS_CURRENT control (and
>> ditto for the other variants) that is a read-only control returning the current
>> position with the same range and unit as the ABSOLUTE control.
> 
> This makes perfect sense if you have hardware that can tell the current
> position.
> 
> Only one of the RELATIVE and ABSOLUTE controls should be implemented. I
> guess no driver in mainline would implement both,

That makes sense.

> I've seen such outside
> mainline though. :-)
> 
>>
>> For the status/fault information I think the V4L2_CID_AUTO_FOCUS_STATUS comes
>> close, but it is too specific for auto focus. For manually positioning things
>> this might be more suitable:
>>
>> V4L2_CID_IRIS_STATUS	bitmask
>>
>> 	V4L2_IRIS_STATUS_MOVING (or perhaps _BUSY?)
>> 	V4L2_IRIS_STATUS_FAILED
>>
>> And ditto for the other variants.
> 
> If you have hardware that can give you the information, sure.
> 
>> Interaction between V4L2_CID_FOCUS_STATUS and AUTO_FOCUS_STATUS:
>>
>> If auto focus is enabled, then FOCUS_STATUS is always 0, if auto focus is
>> disabled, then AUTO_FOCUS_STATUS is always IDLE.
> 
> Looks good to me.
> 

Thanks!

	Hans

  reply	other threads:[~2015-07-22  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02 12:00 [RFC] How to get current position/status of iris/focus/pan/tilt/zoom? Hans Verkuil
2015-07-08  7:55 ` Hans Verkuil
2015-07-08 11:25 ` Laurent Pinchart
2015-07-14  7:51   ` Hans Verkuil
2015-07-22  8:21 ` Sakari Ailus
2015-07-22  8:51   ` Hans Verkuil [this message]
2015-07-22 21:27     ` Sakari Ailus

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=55AF5986.5080106@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=bsalberg@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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.