camera_sensor: Suppress error message if test patterns are unavailable

If a sensor driver does not support test patterns (e.g. IMX477),
libcamera throws an unnecessary error message during initialisation when
it sets the test pattern to off.

Fix this by moving the error message into setTestPatternMode() where the
pipeline handler explicitly requests to set a test pattern.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Naushir Patuck
2022-06-06 09:58:25 +01:00
committed by Laurent Pinchart
parent 161d24377c
commit 7ee7dc3369

View File

@@ -582,16 +582,19 @@ int CameraSensor::setTestPatternMode(controls::draft::TestPatternModeEnum mode)
if (testPatternMode_ == mode)
return 0;
if (testPatternModes_.empty()) {
LOG(CameraSensor, Error)
<< "Camera sensor does not support test pattern modes.";
return -EINVAL;
}
return applyTestPatternMode(mode);
}
int CameraSensor::applyTestPatternMode(controls::draft::TestPatternModeEnum mode)
{
if (testPatternModes_.empty()) {
LOG(CameraSensor, Error)
<< "Camera sensor does not support test pattern modes.";
if (testPatternModes_.empty())
return 0;
}
auto it = std::find(testPatternModes_.begin(), testPatternModes_.end(),
mode);