linux/drivers/media/video/bt8xx
Mike Isely 2de26c0a4a V4L/DVB (13170): bttv: Fix reversed polarity error when switching video standard
The bttv driver function which handles switching of the video standard
(set_tvnorm() in bttv-driver.c) includes a check which can optionally
also reset the cropping configuration to a default value.  It is
"optional" based on a comparison of the cropcap parameters of the
previous vs the newly requested video standard.  The comparison is
being done with a memcmp(), a function which only returns a true value
if the comparison actually fails.

This if-statement appears to have been written to assume wrong
memcmp() semantics.  That is, it was re-initializing the cropping
configuration only if the new video standard did NOT have different
cropcap values.  That doesn't make any sense.  One definitely should
reset things if the cropcap parameters are different - if there's any
comparison to made at all.

The effect of this problem was that a transition from, say, PAL to
NTSC would leave in place old cropping setup that made sense for the
PAL geometry but not for NTSC.  If the application doesn't care about
cropping it also won't try to reset the cropping configuration,
resulting in an improperly cropped video frame.  In the case I was
testing this actually caused black video frames to be displayed.

Another interesting effect of this bug is that if one does something
which does NOT change the video standard and this function is run,
then the cropping setup gets reset anyway - again because of the
backwards comparison.  It turns out that just running anything which
merely opens and closes the video device node (e.g. v4l-info) will
cause this to happen.  One can argue that simply opening the device
node and not doing anything to it should not mess with any of its
state - but because of this behavior, any TV app which does such
things (e.g. xawtv) probably therefore doesn't see the problem.

The solution is to fix the sense of the if-statement.  It's easy to
see how this mistake could have been made given how memcmp() works.
The patch is therefore removal of a single "!" character from the
if-statement in set_tvnorm in bttv-driver.c.

Signed-off-by: Mike Isely <isely@pobox.com>
CC: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-11-07 12:55:08 -02:00
..
bt848.h
bttv-audio-hook.c V4L/DVB (6507): bttv: whitespace cleanup 2008-01-25 19:01:53 -02:00
bttv-audio-hook.h V4L/DVB (6416): Split hooks on volume and audio mode and rework their handling 2008-01-25 19:00:59 -02:00
bttv-cards.c V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends 2009-09-19 00:19:24 -03:00
bttv-driver.c V4L/DVB (13170): bttv: Fix reversed polarity error when switching video standard 2009-11-07 12:55:08 -02:00
bttv-gpio.c V4L/DVB (9521): V4L: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-29 17:53:26 -02:00
bttv-i2c.c V4L/DVB (12343): Stop defining I2C adapter IDs nobody uses 2009-09-12 12:18:13 -03:00
bttv-if.c V4L/DVB (10568): bttv: dynamically allocate device data 2009-03-30 12:42:47 -03:00
bttv-input.c V4L/DVB (12595): common/ir: use a struct for keycode tables 2009-09-12 12:19:47 -03:00
bttv-risc.c V4L/DVB (10562): bttv: rework the way digital inputs are indicated 2009-03-30 12:42:47 -03:00
bttv-vbi.c V4L/DVB (10558): bttv: norm value should be unsigned 2009-03-30 12:42:46 -03:00
bttv.h V4L/DVB (12300): bttv: fix regression: tvaudio must be loaded before tuner 2009-07-24 14:03:31 -03:00
bttvp.h V4L/DVB (11377): v4l: increase version numbers of drivers converted to v4l2_subdev. 2009-04-06 21:44:26 -03:00
Kconfig V4L/DVB (11281): bttv: move saa6588 config to the helper chip config 2009-03-30 12:43:46 -03:00
Makefile V4L/DVB(7767): Move tuners to common/tuners 2008-04-29 18:41:37 -03:00