summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-04-24 19:52:16 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-04-27 01:20:37 +0300
commit1957aa641dc9bb635fbedf28c44215ddc496c006 (patch)
tree13c00e70a3747d9b927fc1318ab6dd416995eba3
parent9990b590d23566b533798909e1379f9743d1b97d (diff)
libcamera: pipeline: uvcvideo: Add support for AeEnable
UVC devices support auto-exposure, expose the feature through the AeEnable control. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/uvcvideo/uvcvideo.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index 7a703509..b040f246 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -252,6 +252,8 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,
cid = V4L2_CID_CONTRAST;
else if (id == controls::Saturation)
cid = V4L2_CID_SATURATION;
+ else if (id == controls::AeEnable)
+ cid = V4L2_CID_EXPOSURE_AUTO;
else if (id == controls::ManualExposure)
cid = V4L2_CID_EXPOSURE_ABSOLUTE;
else if (id == controls::ManualGain)
@@ -259,12 +261,21 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,
else
return -EINVAL;
- if (cid == V4L2_CID_EXPOSURE_ABSOLUTE)
- controls->set(V4L2_CID_EXPOSURE_AUTO, static_cast<int32_t>(1));
-
- int32_t ivalue = value.get<int32_t>();
+ switch (cid) {
+ case V4L2_CID_EXPOSURE_AUTO: {
+ int32_t ivalue = value.get<bool>()
+ ? V4L2_EXPOSURE_APERTURE_PRIORITY
+ : V4L2_EXPOSURE_MANUAL;
+ controls->set(V4L2_CID_EXPOSURE_AUTO, ivalue);
+ break;
+ }
- controls->set(cid, ivalue);
+ default: {
+ int32_t ivalue = value.get<int32_t>();
+ controls->set(cid, ivalue);
+ break;
+ }
+ }
return 0;
}
@@ -385,6 +396,7 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
ControlInfoMap::Map *ctrls)
{
const ControlId *id;
+ ControlInfo info;
/* Map the control ID. */
switch (cid) {
@@ -397,6 +409,9 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
case V4L2_CID_SATURATION:
id = &controls::Saturation;
break;
+ case V4L2_CID_EXPOSURE_AUTO:
+ id = &controls::AeEnable;
+ break;
case V4L2_CID_EXPOSURE_ABSOLUTE:
id = &controls::ManualExposure;
break;
@@ -407,7 +422,18 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
return;
}
- ctrls->emplace(id, v4l2Info);
+ /* Map the control info. */
+ switch (cid) {
+ case V4L2_CID_EXPOSURE_AUTO:
+ info = ControlInfo{ false, true, true };
+ break;
+
+ default:
+ info = v4l2Info;
+ break;
+ }
+
+ ctrls->emplace(id, info);
}
void UVCCameraData::bufferReady(FrameBuffer *buffer)