On Sunday 09 May 2010 11:23:05 Hans Verkuil wrote: > What is VIDIOC_QUERYSTD supposed to do when there is no signal? > > The spec says this: > > "The hardware may be able to detect the current video standard automatically. > To do so, applications call VIDIOC_QUERYSTD with a pointer to a v4l2_std_id > type. The driver stores here a set of candidates, this can be a single flag > or a set of supported standards if for example the hardware can only > distinguish between 50 and 60 Hz systems. When detection is not possible or > fails, the set must contain all standards supported by the current video > input or output." > > The last sentence is the problem. There are several possibilities: > > 1) The hardware is physically unable to detect the current video std. In that > case this ioctl shouldn't be implemented at all. > > 2) While detecting the std an error occurs (e.g. i2c read error). In that case > the error should be returned. > > 3) There is no input signal. Does that constitute 'detection is not possible or > fails'? If so, then all supported standards should be returned. But that seems > very strange. After all, I did detect the standard: i.e. there is none, so I > would say that QUERYSTD should return V4L2_STD_UNKNOWN (0). > > A quick check of the current state of affairs when no signal is present reveals > that: > > - saa7115, ks0127, saa7191 return 0 with std set to V4L2_STD_ALL > - adv7180, vpx3220 return 0 with std set to V4L2_STD_UNKNOWN > - saa7110 returns 0 with std set to the current std > - bt819 and bttv do not handle this case at all, and just pick 50 Hz or 60 Hz > - tvp514x returns -EINVAL. > > Lovely... :-) > > It is clear that applications currently have no hope in hell to use the output > of querystd in a reliable manner. For all practical purposes the behavior of > querystd when no signal is present is undefined. > > I would propose to specify that if no signal is present then QUERYSTD should > return 0 with std V4L2_STD_UNKNOWN. I received no comments, so I will prepare patches to implement this proposal. Regards, Hans > It would also be consistent with QUERY_DV_PRESET where the preset DV_INVALID > is returned in that case. > > If we decide to change it, then it is trivial to fix all drivers that implement > querystd. > > Comments? > > Hans > > -- Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html