History log of /drivers/media/usb/uvc/uvc_ctrl.c
Revision Date Author Comments
17e1319fd051f6f1d8b923ca3104c3391610ab32 13-Mar-2014 William Manley <will@williammanley.net> [media] uvcvideo: Work around buggy Logitech C920 firmware

The uvcvideo webcam driver exposes the v4l2 control "Exposure (Absolute)"
which allows the user to control the exposure time of the webcam,
essentially controlling the brightness of the received image. By default
the webcam automatically adjusts the exposure time automatically but the
if you set the control "Exposure, Auto"="Manual Mode" the user can fix
the exposure time.

Unfortunately it seems that the Logitech C920 has a firmware bug where
it will forget that it's in manual mode temporarily during initialisation.
This means that the camera doesn't respect the exposure time that the user
requested if they request it before starting to stream video. They end up
with a video stream which is either too bright or too dark and must reset
the controls after video starts streaming.

This patch introduces the quirk UVC_QUIRK_RESTORE_CTRLS_ON_INIT which
causes the cached controls to be re-uploaded to the camera immediately
after initialising the camera. This quirk is applied to the C920 to work
around this camera bug.

Signed-off-by: William Manley <will@williammanley.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
3ea375239ca06014b8b421ab1d73d6628d22036f 04-Sep-2014 Vincent Palatin <vpalatin@chromium.org> [media] v4l: uvcvideo: Add support for pan/tilt speed controls

Map V4L2_CID_TILT_SPEED and V4L2_CID_PAN_SPEED to the standard UVC
CT_PANTILT_RELATIVE_CONTROL terminal control request.

Tested by plugging a Logitech ConferenceCam C3000e USB camera
and controlling pan/tilt from the userspace using the VIDIOC_S_CTRL ioctl.
Verified that it can pan and tilt at the same time in both directions.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8ca5d2d8e58df7235b77ed435e63c484e123fede 27-Sep-2013 Chanho Min <chanho.min@lge.com> [media] uvcvideo: Fix data type for pan/tilt control

The pan/tilt absolute control value is signed value. If minimum value
is minus, It will be changed to plus by clamp_t() as commit 64ae9958a62.
([media] uvcvideo: Fix control value clamping for unsigned integer controls).
It leads to wrong setting of the control values. For example,
when min and max are -36000 and 36000, the setting value between of this range
is always 36000. So, its data type should be changed to signed.

Signed-off-by: Chanho Min <chanho.min@lge.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
b41869711586b047c18435ba84baf334918bae01 11-Jan-2013 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Return -EINVAL when setting a menu control to an invalid value

-ERANGE is the right error code when the value is outside of the menu
range, but -EINVAL must be reported for invalid values inside the range.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8c0d44e250735b09e255ce0483c47eb2f68d3fa7 14-Jan-2013 Ezequiel Garcia <elezegarcia@gmail.com> [media] uvcvideo: Replace memcpy with struct assignment

This kind of memcpy() is error-prone. Its replacement with a struct
assignment is prefered because it's type-safe and much easier to read.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9bf42300e672fb1b5587d1da5486f8b144e74598 28-Aug-2012 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Return -EACCES when trying to set a read-only control

Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
uvcvideo: Set error_idx properly for extended controls API failures")
also reverted part of commit 30ecb936cbcd83e3735625ac63e1b4466546f5fe
("uvcvideo: Return -EACCES when trying to access a read/write-only
control") by mistake. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9c016d61097cc39427a2f5025bdd97ac633d26a6 23-Dec-2012 Rafael J. Wysocki <rafael.j.wysocki@intel.com> Partly revert "[media] uvcvideo: Set error_idx properly for extended controls API failures"

Commit f0ed2ce840b3 ("[media] uvcvideo: Set error_idx properly for
extended controls API failures") causes user space to behave incorrectly
on one of my test machines (there is no sound under KDE 4.9.4 using
pulseaudio and there is a knotify4 process occupying one of the CPU
cores 100% of the time). Reverting that commit entirely fixes the
problem for me.

However, commit f0ed2ce840b3 appears to do more than it follows from its
changelog, because the changelog only says about the changes related to
ctrls->error_idx, while the commit additionally changes error codes
returned by various functions in uvc_ctrl.c and uvc_v4l2.c. It turns
out that the changes of the returned error codes confuse the user spce,
so it is sufficient to revert the part of commit f0ed2ce840b3 not
mentioned in its changelog to fix the problem.

[ 'ENOENT' is not a valid error return from an ioctl to begin with, and
I don't understand how anybody ever even thought it would be. - Linus ]

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
64ae9958a623708336ed67fe38c33571390aed1e 26-Sep-2012 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Fix control value clamping for unsigned integer controls

V4L2 integer controls are stored in signed 32-bit values. However, UVC
controls can be either signed or unsigned. Take the UVC control
signedness into account when clamping the control value to the min-max
range.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
30ecb936cbcd83e3735625ac63e1b4466546f5fe 28-Aug-2012 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Return -EACCES when trying to access a read/write-only control

The proper return code according to the V4L2 specification is -EACCES,
not -EINVAL.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f0ed2ce840b3a59b587e8aa398538141a86e9588 28-Aug-2012 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Set error_idx properly for extended controls API failures

When one of the requested controls doesn't exist the error_idx field
must reflect that situation. For G_EXT_CTRLS and S_EXT_CTRLS, error_idx
must be set to the control count. For TRY_EXT_CTRLS, it must be set to
the index of the unexisting control.
This issue was found by the v4l2-compliance tool.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
0c0d06cac63ee327ceaab4b5ffe2206574ab86bd 14-Aug-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] rename most media/video usb drivers to media/usb

Rename all USB drivers with their own directory under
drivers/media/video into drivers/media/usb and update the
building system.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>