@@ -277,6 +277,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::AeFlickerMode)
+ cid = V4L2_CID_POWER_LINE_FREQUENCY;
else
return -EINVAL;
@@ -331,6 +333,30 @@ int PipelineHandlerUVC::processControl(ControlList *controls, unsigned int id,
break;
}
+ case V4L2_CID_POWER_LINE_FREQUENCY: {
+ enum v4l2_power_line_frequency mode;
+ switch (value.get<int32_t>()) {
+ default:
+ case controls::FlickerCustom:
+ LOG(UVC, Warning) << "Unsupported AeflickerMode";
+ [[fallthrough]];
+ case controls::FlickerOff:
+ mode = V4L2_CID_POWER_LINE_FREQUENCY_DISABLED;
+ break;
+ case controls::Flicker50Hz:
+ mode = V4L2_CID_POWER_LINE_FREQUENCY_50HZ;
+ break;
+ case controls::Flicker60Hz:
+ mode = V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
+ break;
+ case controls::FlickerAuto:
+ mode = V4L2_CID_POWER_LINE_FREQUENCY_AUTO;
+ break;
+ }
+ controls->set(cid, static_cast<int32_t>(mode));
+ break;
+ }
+
default: {
int32_t ivalue = value.get<int32_t>();
controls->set(cid, ivalue);
@@ -605,6 +631,9 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
case V4L2_CID_GAIN:
id = &controls::AnalogueGain;
break;
+ case V4L2_CID_POWER_LINE_FREQUENCY:
+ id = &controls::AeFlickerMode;
+ break;
default:
return;
}
@@ -689,6 +718,15 @@ void UVCCameraData::addControl(uint32_t cid, const ControlInfo &v4l2Info,
break;
}
+ case V4L2_CID_POWER_LINE_FREQUENCY: {
+ info = ControlInfo{
+ { static_cast<int>(controls::FlickerOff) },
+ { static_cast<int>(controls::FlickerAuto) },
+ { static_cast<int>(controls::FlickerOff) }
+ };
+ break;
+ }
+
default:
info = v4l2Info;
break;
Implement the mapping for AeFlickerMode support. Custom flicker modes are not supported by UVC devices. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- RFC: An untested implementation of the AeFlickerMode control in the UVC pipeline handler. Any particularly easy way to test this ? Perhaps we should be adding tests to lc-compliance for new control definitions? - Though I'm not sure how easily we can validate the operation of the control. But at least if it's present we can test that setting it doesn't crash the pipeline or cause errors for instance. src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+)