History log of /drivers/media/video/uvc/uvc_ctrl.c
Revision Date Author Comments
d0d97488dd1e8131ac9d8f7d3487c355f4bf9d72 29-Nov-2011 Thomas Meyer <thomas@m3y3r.de> [media] uvcvideo: Use kcalloc instead of kzalloc to allocate array

The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.

The semantic patch that makes this change is available
in https://lkml.org/lkml/2011/11/25/107

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c4d99f89e20c87c8e2a992ce4cf9aa4325dc7fa7 30-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Ignore GET_RES error for XU controls

GET_RES request support is mandatory for extension units, but some
cameras still choke on it (one example is the Logitech QuickCam PTZ that
returns a single byte for the PTZ relative control instead of four).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
241fa6e42f5462a82f00ddf5169628a8c3976548 11-Oct-2011 Hans de Goede <hdegoede@redhat.com> [media] uvcvideo: GET_RES should only be checked for BITMAP type menu controls

Currently it is also being checked for non BITMAP type menu controls,
breaking the logitech LED control menu added by uvcdynctrl, as well as
potentially breaking the powerline frequency menu.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c0c5e71e46638e5264c193db8636132e036a4c56 01-Jun-2011 Stephan Lachowsky <stephan.lachowsky@maxim-ic.com> [media] uvcvideo: Fix control mapping for devices with multiple chains

The search for matching extension units fails to take account of the
current chain. In the case where you have two distinct video chains,
both containing an XU with the same GUID but different unit ids, you
will be unable to perform a mapping on the second chain because entity
on the first chain will always be found first

Fix this by only searching the current chain when performing a control
mapping. This is analogous to the search used by uvc_find_control(),
and is the correct behaviour.

Signed-off-by: Stephan Lachowsky <stephan.lachowsky@maxim-ic.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
60063497a95e716c9a689af3be2687d261f115b4 27-Jul-2011 Arun Sharma <asharma@fb.com> atomic: use <linux/atomic.h>

This allows us to move duplicated code in <asm/atomic.h>
(atomic_inc_not_zero() for now) to <linux/atomic.h>

Signed-off-by: Arun Sharma <asharma@fb.com>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f411f103822379bab356345430f097bdae3440e5 30-Apr-2011 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Return -ERANGE when userspace sets an unsupported menu entry

Instead of passing the value down to the device and getting an error
back (or worse, crashing the firmware), return -ERANGE when the
requested menu entry is not supported.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
fc2d573fb4e65393688d32bc128c70ddd8ecccc6 30-Apr-2011 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Don't report unsupported menu entries

Supported menu entries are reported by the device in response to the
GET_RES query. Use the information to return -EINVAL to userspace for
unsupported values when enumerating menu entries.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9eb30d2fa9a2018fbc7d12232d4646c52782d3a9 21-Nov-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Rename UVC_CONTROL_* flags to UVC_CTRL_FLAG_*

This makes the public driver API more uniform, in preparation of moving
uvcvideo.h to include/linux. Keep the old names for backward
compatibility with existing applications.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
fe78d187fe792fac5d190b19a2806c23df28891e 03-Oct-2010 Martin Rubli <martin_rubli@logitech.com> [media] uvcvideo: Add UVCIOC_CTRL_QUERY ioctl

This ioctl extends UVCIOC_CTRL_GET/SET by not only allowing to get/set
XU controls but to also send arbitrary UVC commands to XU controls,
namely GET_CUR, SET_CUR, GET_MIN, GET_MAX, GET_RES, GET_LEN, GET_INFO
and GET_DEF. This is required for applications to work with XU controls,
so that they can properly query the size and allocate the necessary
buffers.

Signed-off-by: Martin Rubli <martin_rubli@logitech.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
23d9f3ef23f0dc4bb20ccd5540b9a91ff08da08f 21-Nov-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Lock controls mutex when querying menus

uvc_find_control() must be called with the controls mutex locked. Fix
uvc_query_v4l2_menu() accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
27a61c13ec5d9c1da5286fd1697ab5930b916b4f 02-Oct-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Fix uvc_query_v4l2_ctrl() and uvc_xu_ctrl_query() locking

Take the ctrl_mutex mutex before touching control information in those
functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b5977a58c330ac6afdc64bab9b1dd674f11c0635 01-Oct-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Fix bogus XU controls information

XU control information is supposed to be entirely discoverable using
standard UVC queries. As some devices report bogus information (such as
reporting a read-only control as being read-write), add a fixup table
for XU controls.

This table can also be used to selectively disable requests supposed to
be supported by all XU controls (GET_MIN, GET_MAX, GET_DEF, GET_RES) but
not correctly (or at all) supported by the device.

The table currently disables GET_CUR on the Logitech motor control XU
pan/tilt controls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
52c58ad6f95ff60343bf0c517182d5f649ca0403 29-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Delay initialization of XU controls

XU controls initialization requires querying the device for control
information. As some buggy UVC devices will crash when queried
repeatedly in a tight loop, delay XU controls initialization until first
use.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
071c8bb827c80a68510a1cdb7e8bebbda1a494d6 29-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Embed uvc_control_info inside struct uvc_control

Now that control information structures are not shared between control
instances, embed a uvc_control_info instance inside the uvc_control
structure instead of storing a pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8fb91b33c6bfa3ac5e4ad76920b7bcd7bdbbb6d0 08-Sep-2010 Martin Rubli <martin_rubli@logitech.com> [media] uvcvideo: Remove sysadmin requirements for UVCIOC_CTRL_MAP

This patch removes the sysadmin requirements for UVCIOC_CTRL_MAP (and the stub
implementation of UVCIOC_CTRL_ADD). This requirement no longer makes sense with
the new XU control access mechanisms since XU controls can be accessed without
adding control mappings first.

A maximum number (currently 1024) of control mappings per device is enforced to
avoid excess memory consumption caused by careless user space applications.

Signed-off-by: Martin Rubli <martin_rubli@logitech.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ba2fa99668bb9bf03757a020f15bba295d5c0a3e 20-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Hardcode the index/selector relationship for XU controls

Devices advertise XU controls using a bitmask, in which each bit
corresponds to a control. The control selector, used to query the
control, isn't available in the USB descriptors.

All known UVC devices use control selectors equal to the control bit
index plus one. Hardcode that relationship in the driver, making the
UVCIOC_CTRL_ADD ioctl obsolete. All necessary information about XU
controls can be obtained by the driver at enumeration time.

The UVCIOC_CTRL_ADD ioctl is still supported for compatibility reasons,
but now always returns -EEXIST.

Finally, control mappings are now on a per-device basis and no longer
global.

As this changes the userspace interface, bump the driver version number
to 1.0.0 (it was about time).

Signed-off-by: Martin Rubli <martin_rubli@logitech.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
11fc5baf1dab2d30f03a391cabc5fd1808cfbe29 20-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Update e-mail address and copyright notices

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f9d81df9b8d77f238b3053eb645572ab6651cc8d 17-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Constify the uvc_entity_match_guid arguments

They're not modified by the function, make them const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
fa34168bd8979ef00dbc35dbca6d7564d4e42798 23-Jul-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Blacklist more controls for Hercules Dualpix Exchange

The Hercules Dualpix Exchange (06f8:3005) camera expose an absolute zoom
that is not implemented. Blacklist it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b30ece53946ad2b79304ee5cfdb18b361dc3a3fc 18-Jun-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Don't use stack-based buffers for USB transfers

Data buffers on the stack are not allowed for USB I/O. Use dynamically
allocated buffers instead when querying control length and control
capabilities.

The control capabilities are now also stored in the uvc_control
structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1b4e21c4f62eae6bdcb3e7bfdfc52171a24f3689 17-Jun-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Define control information bits using macros

Use the macros instead of hardcoding numerical constants for the
controls information bitfield.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
561474c2d2a1e212ea186e0b65cc69fb330e7bd5 18-Feb-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Support menu controls in the control mapping API

The UVCIOC_CTRL_MAP ioctl doesn't support menu entries for menu
controls. As the uvc_xu_control_mapping structure has no reserved
fields, this can't be fixed while keeping ABI compatibility.

Modify the UVCIOC_CTRL_MAP ioctl to add menu entries support, and define
UVCIOC_CTRL_MAP_OLD that supports the old ABI without any ability to add
menu controls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3653639e5daf2ac5f4763e4f1b6cb57538184be9 20-May-2010 Hans de Goede <hdegoede@redhat.com> V4L/DVB: uvcvideo: Make button controls work properly

According to the v4l2 spec, writing any value to a button control should
result in the action belonging to the button control being triggered.
UVC cams however want to see a 1 written, this patch fixes this by
overriding whatever value user space passed in with -1 (0xffffffff) when
the control is a button control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e56be916660da811fe4e830dfb958f13af361d59 20-May-2010 Martin Rubli <martin_rubli@logitech.com> V4L/DVB: uvcvideo: Add support for absolute pan/tilt controls

Signed-off-by: Martin Rubli <martin_rubli@logitech.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9c3b10b53875279306d8464fe9b24fa634329fc8 05-Jul-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Power line frequency control doesn't support GET_MIN/MAX/RES

Issuing a GET_MIN request on the power line frequency control times out
on at least the Apple iSight. As the UVC specification doesn't list
GET_MIN/MAX/RES as supported on that control, remove them from the
uvc_ctrls array.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cf7a50eeb6f462a0b7d1619fcb27a727a2981769 25-Apr-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Prevent division by 0 when control step value is 0

The control step values reported by the device are used as a divisor
unchecked, which can result in a division by zero.

Check the step value and make it 1 when null.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a90ef69c1f67319ddbba0170767c660c7fb5d4c9 25-Apr-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Flag relative controls as write-only

The UVC relative controls (exposure time, iris, focus, zoom, pan/tilt)
are write-only (despite the UVC specification stating that the GET_CUR
request is mandatory). Mark the controls as such, and report the related
V4L2 controls V4L2_CTRL_FLAG_WRITE_ONLY.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
35a00c41ea8b280cb629503c735daf20cdf0f9f8 20-Jan-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Support iris absolute and relative controls

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
9405e3cbd5dd6767875c573574672cb85c4d7374 03-Feb-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Blacklist gain control for Asus EeePC T91 integrated webcam

The Asus EeePC T91 integrated webcam exposes a gain control in the
processing unit but stalls when the control is queried. Blacklist the
gain control for that camera.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e54532e591cd5b9ce77dbc8d9786ae9f600f101a 23-Jan-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Clamp control values to the minimum and maximum values

When setting a control, the V4L2 specification requires drivers to
either clamp the control value to the [minimum, maximum] range or return
the -ERANGE error.

Fix the driver to clamp control values to the valid range in
uvc_ctrl_set() and make sure the value differs from the minimum by an
integer multiple of step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Márton Németh <nm127@freemail.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
59529081e092506edb81a42d914e2d0522f65ca7 23-Jan-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Cache control min, max, res and def query results

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8a4e76c14cbe0609fdb5c558f867fe7c556bb1c7 21-Jan-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Return -ERANGE when setting a control to an out-of-range menu index

The V4L2 specification states that out of bounds control values must
either be clamped to the valid range or result in a -ERANGE error code.

Fix the driver to return -ERANGE instead of -EINVAL when setting a menu
control to an invalid value.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
36bd883ef98ac6003ab6ec7b91f66d3fb2159318 19-Jan-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Use %pUl printk format specifier to print GUIDs

Replace the UVC_GUID_FORMAT and UVC_GUID_ARGS macros with the new %pUl
printk format specifier.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
385097e08b9c24655626ed760bc67eb7e50115a0 10-Dec-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13826): uvcvideo: Fix controls blacklisting

The control blacklisting code erroneously used usb_match_id() by passing
a pointer to a usb_device_id structure instead of an array of such
structures.

Replace the usb_match_id() call by usb_match_id_one().

Thanks to Paulo Assis for diagnosing the bug and providing an initial
fix.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6241d8ca1dc27356180011dff4d93a3c5b3cbd76 25-Nov-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13503): uvcvideo: Merge iterms, oterms and units linked lists

All terminals and units are now added to a single linked list of
entities per chain. This makes terminals and units handling code more
generic.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f4eabafeb3ea41801260fba624cbf2da971d19f8 06-Aug-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13148): uvcvideo: Handle V4L2_CTRL_TYPE_BUTTON control type in VIDIOC_QUERYCTRL

Return minimum, maximum and step set to 0 without querying the hardware.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2e8961330ec4b558a0f4db18ab5fb566842f492b 04-Nov-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13311): uvcvideo: Fix compilation warning with 2.6.32 due to type mismatch with abs()

The abs() macro has changed in 2.6.32 and returns a long instead of an
int. Fix the driver to avoid compilation warnings.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8e113595edf0741b45ba10ba88cb5d077787c155 02-Jul-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (12379): uvcvideo: Multiple streaming interfaces support

Restructure the UVC descriptors parsing code to handle multiple streaming
interfaces. The driver now creates a uvc_video_chain instance for each chain
detected in the UVC control interface descriptors, and tries to register one
video device per streaming endpoint.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b482d9231a73478763e6b42fd88ea453731a67eb 26-Jun-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (12185): uvcvideo: Prefix all UVC constants with UVC_

In preparation to moving UVC constants to a public location, prefix all
constants with UVC_ to avoid namespace clashes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d732c44c1a4b54e3c59ad92069bc2fd848aca5f3 31-May-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (11944): uvcvideo: Add generic control blacklist.

Another device (5986:0241) has been reported to advertise a UVC control it
does not support. Rework the control blacklist to match devices by their
VID:PID instead of trying to be clever about which controls might not be
supported properly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d0ebf3073f8812464c9f6014d6cee09ab37c3fb5 08-Jan-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (10293): uvcvideo: replace strn{cpy,cat} with strl{cpy,cat}.

strncpy is unsafe as it doesn't append a terminating NUL character when the
source string doesn't fit in the destination buffer. Replace it with strlcpy.
strncat is misused as its size argument refers to the source string, not the
destination buffer. Replace it with strlcat.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2c2d264bb951c1a846b86431d3e784edfb79ab39 03-Jan-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (10197): uvcvideo: Whitespace and comments cleanup, copyright updates.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
16e68d7cb8eb1c671867d2a0ecd4aa2e17124364 07-Jan-2009 Huang Weiyi <weiyi.huang@gmail.com> V4L/DVB (10193): removed unused #include <version.h>'s

Removed unused #include <version.h>'s in files below,
drivers/media/video/cs5345.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/saa717x.c
drivers/media/video/upd64031a.c
drivers/media/video/upd64083.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/uvc/uvc_driver.c
drivers/media/video/uvc/uvc_queue.c
drivers/media/video/uvc/uvc_video.c
drivers/media/video/uvc/uvc_status.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9768352ac1f9cc3aae675adb299452bd28a54734 16-Dec-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (9903): uvcvideo: V4L2 zoom controls support

Add support for absolute and continuous zoom controls (mapped to absolute
and relative UVC zoom controls).

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6df126f834c7f6972528cba43604ce0c97329886 16-Dec-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (9902): uvcvideo: V4L2 privacy control support

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2bdd29cf3d4d32e4371fbd6b27ea171f2c1f0836 06-Dec-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (9810): uvcvideo: Add a device quirk to prune bogus controls.

Bogus controls currently include processing unit auto controls for which no
corresponding manual control is available. Such auto controls make little
sense if any, and are known to crash at least the SiGma Micro webcam.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b1accfa15533fdd40280aae3102e9599e63a7c10 28-Sep-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (9036): uvcvideo: Fix control cache access when setting composite auto-update controls

Auto-update controls are never marked is loaded to prevent uvc_get_ctrl from
loading the control value from the cache. When setting a composite (mapped to
several V4L2 controls) auto-update UVC control, the driver updates the control
cache value before processing each V4L2 control, overwriting the previously
set V4L2 control.

This fixes the problem by marking all controls as loaded in uvc_set_ctrl
regardless of their type and resetting the loaded flag in uvc_commit_ctrl for
auto-update controls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5e26d50f4e6b9c42bbfbaa452722797ece929cda 22-Sep-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (9035): uvcvideo: Declare missing camera and processing unit controls.

This declares all missing UVC camera and processing unit controls. V4L2
mappings are not supported yet for those controls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
fe6c700ff34e68e1eb7991e9c5d18986d0005ac1 23-Sep-2008 Ralph Loader <suckfish@ihug.co.nz> V4L/DVB (9053): fix buffer overflow in uvc-video

There is a buffer overflow in drivers/media/video/uvc/uvc_ctrl.c:

INFO: 0xf2c5ce08-0xf2c5ce0b. First byte 0xa1 instead of 0xcc
INFO: Allocated in uvc_query_v4l2_ctrl+0x3c/0x239 [uvcvideo] age=13 cpu=1 pid=4975
...

A fixed size 8-byte buffer is allocated, and a variable size field is read
into it; there is no particular bound on the size of the field (it is
dependent on hardware and configuration) and it can overflow [also
verified by inserting printk's.]

The patch attempts to size the buffer to the correctly.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
04793dd041bbb88a39b768b714c725de2c339b51 31-Jul-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (8617): uvcvideo: don't use stack-based buffers for USB transfers.

Data buffers on the stack are not allowed for USB I/O. Use dynamically
allocated buffers instead.

Signed-off-by: Bruce Schmid <duck@freescale.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
54812c77bc830e2dbcb62b4c6d8a9c7f97cfdd1b 17-Jul-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (8498): uvcvideo: Return sensible min and max values when querying a boolean control.

Although the V4L2 spec states that the minimum and maximum fields may not be
valid for control types other than V4L2_CTRL_TYPE_INTEGER, it makes sense
to set the bounds to 0 and 1 for boolean controls instead of returning
uninitialized values.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
90ac5ea37f91e38d798c5e355232ce7f9c2a24d4 26-Jul-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (8497): uvcvideo: Make the auto-exposure menu control V4L2 compliant

V4L2 and UVC enumerate the auto-exposure settings in a different order. This
patch fixes the auto-exposure menu declaration to match the V4L2 spec.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
f87086e302300fdff1bd32049deb7a7f3e3de7da 18-Jul-2008 Hans Verkuil <hverkuil@xs4all.nl> v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10

Also remove some blank lines that were used to split compat code at -devel
tree.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
c0efd232929c2cd87238de2cccdaf4e845be5b0c 30-Jun-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (8145a): USB Video Class driver

This driver supports video input devices compliant with the USB Video Class
specification. This means lots of currently manufactured webcams, and probably
most of the future ones.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>