@@ -304,6 +304,8 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,
cid = V4L2_CID_EXPOSURE_ABSOLUTE;
else if (id == controls::AnalogueGain)
cid = V4L2_CID_GAIN;
+ else if (id == controls::Gamma)
+ cid = V4L2_CID_GAMMA;
else
return -EINVAL;
@@ -358,6 +360,10 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,
break;
}
+ case V4L2_CID_GAMMA:
+ controls->set(cid, static_cast<int32_t>(std::lround(value.get<float>() * 100)));
+ break;
+
default: {
int32_t ivalue = value.get<int32_t>();
controls->set(cid, ivalue);
@@ -655,6 +661,9 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
case V4L2_CID_GAIN:
id = &controls::AnalogueGain;
break;
+ case V4L2_CID_GAMMA:
+ id = &controls::Gamma;
+ break;
default:
return;
}
@@ -782,6 +791,15 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
break;
}
+ case V4L2_CID_GAMMA:
+ /* UVC gamma is in units of 1/100 gamma. */
+ info = ControlInfo{
+ { min / 100.0f },
+ { max / 100.0f },
+ { def / 100.0f }
+ };
+ break;
+
default:
info = v4l2Info;
break;
Commit 294ead848c3fa2 ("libcamera: Add gamma control id") introduced the "Gamma" control, so expose it for UVC cameras as well using the `V4L2_CID_GAMMA` control. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)