@@ -156,6 +156,7 @@ private:
CameraSensorLegacy::CameraSensorLegacy(const MediaEntity *entity)
: entity_(entity), pad_(UINT_MAX), staticProps_(nullptr),
+ testPatternMode_(controls::draft::TestPatternModeOff),
bayerFormat_(nullptr), supportHFlips_(false), supportVFlips_(false),
flipsAlterBayerOrder_(false), properties_(properties::properties)
{
@@ -164,7 +164,9 @@ private:
*/
CameraSensorRaw::CameraSensorRaw(const MediaEntity *entity)
- : entity_(entity), staticProps_(nullptr), supportHFlips_(false),
+ : entity_(entity), staticProps_(nullptr),
+ testPatternMode_(controls::draft::TestPatternModeOff),
+ supportHFlips_(false),
supportVFlips_(false), flipsAlterBayerOrder_(false),
properties_(properties::properties)
{
testPatternMode_ is never initialized in CameraSensorLegacy and CameraSensorRaw. init() calls applyTestPatternMode(TestPatternModeOff), but that function returns early without updating testPatternMode_ when the sensor has no test pattern modes, which is the case for sensors missing from the camera sensor properties database. setTestPatternMode() then compares the requested mode with an uninitialized value. When the pipeline handler disables the test pattern before starting the camera, as the IPU3 pipeline handler does, the result depends on that value: the call either returns 0 or fails with -EINVAL, and Camera::start() fails intermittently. Initialize testPatternMode_ to TestPatternModeOff, which is the mode init() applies. The change and this description were drafted with an AI coding assistant (Claude Code, model Claude Opus 5.5). The author reviewed them and tested them on a Microsoft Surface Laptop 1. Fixes: 7ee7dc3369eb ("camera_sensor: Suppress error message if test patterns are unavailable") Signed-off-by: Afonso Figuinha <afonso.figuinha@gmail.com> --- src/libcamera/sensor/camera_sensor_legacy.cpp | 1 + src/libcamera/sensor/camera_sensor_raw.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)