[{"id":38082,"web_url":"https://patchwork.libcamera.org/comment/38082/","msgid":"<20260204193618.GC156228@killaraus>","date":"2026-02-04T19:36:18","subject":"Re: [RFC PATCH 1/1] camera_sensor: Ensure we try multiple camera\n\tsensor factories","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Isaac,\n\nThank you for the patch.\n\nOn Wed, Feb 04, 2026 at 03:40:15PM +0000, Isaac Scott wrote:\n> CameraSensorFactory::match() should iterate through all available\n> camera sensor factories and in an attempt to find a CameraSensor class\n> that is suitable. Currently, it is implemented in such a way that it\n> will only try the first one before failing.\n>\n> Remove the early return to ensure all CameraSensor factories are checked\n> before returning nullptr.\n> \n> Signed-off-by: Isaac Scott <isaac.scott@ideasonboard.com>\n> ---\n>  src/libcamera/sensor/camera_sensor.cpp | 4 +---\n>  1 file changed, 1 insertion(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/sensor/camera_sensor.cpp b/src/libcamera/sensor/camera_sensor.cpp\n> index 05390d1e1..42407b14b 100644\n> --- a/src/libcamera/sensor/camera_sensor.cpp\n> +++ b/src/libcamera/sensor/camera_sensor.cpp\n> @@ -479,12 +479,10 @@ std::unique_ptr<CameraSensor> CameraSensorFactoryBase::create(MediaEntity *entit\n>  \t\t\treturn std::get<std::unique_ptr<CameraSensor>>(std::move(result));\n>  \t\t}\n>  \n> -\t\tif (std::get<int>(result)) {\n> +\t\tif (std::get<int>(result))\n>  \t\t\tLOG(CameraSensor, Error)\n>  \t\t\t\t<< \"Failed to create sensor for '\"\n>  \t\t\t\t<< entity->name() << \": \" << std::get<int>(result);\n> -\t\t\treturn nullptr;\n> -\t\t}\n\nThis is intentional, please see the documentation of the match function,\nin the documentation of the REGISTER_CAMERA_SENSOR() macro. If a factory\ndetermines that it should handle a camera sensor but fails to do so,\nthen no other factory is tried. A factory that determines it should not\nhandle a camera sensor returns 0, and the next factory is then tried.\n\n>  \t}\n>  \n>  \treturn nullptr;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 49522C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Feb 2026 19:36:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 88C346203F;\n\tWed,  4 Feb 2026 20:36:22 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A8A4761FBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Feb 2026 20:36:20 +0100 (CET)","from killaraus.ideasonboard.com\n\t(2001-14ba-703d-e500--ff4.rev.dnainternet.fi\n\t[IPv6:2001:14ba:703d:e500::ff4])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 15EE9593;\n\tWed,  4 Feb 2026 20:35:38 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"B2V5s4O1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770233738;\n\tbh=8+x1YQIgNWX69Dtm2ldRIFyNfnSQi/uxo1R7BJSpBeU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=B2V5s4O12HxzwdGqjusogNrHJQn1h12Y3Z9mzJuv0XzbF7wZCm6n0lOHZgKKJ4B/Q\n\tQbQffVPFVP9GV/axzL8B1BMQfyNYc0NwJlDmu0XSl4/+SgRXigF0KGXbXhs7f/+48b\n\tEkvjgfaklatDlnkBmuz/SVZ+rdCUlb0lSuaEMIZM=","Date":"Wed, 4 Feb 2026 21:36:18 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Isaac Scott <isaac.scott@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH 1/1] camera_sensor: Ensure we try multiple camera\n\tsensor factories","Message-ID":"<20260204193618.GC156228@killaraus>","References":"<20260204154015.3755120-1-isaac.scott@ideasonboard.com>\n\t<20260204154015.3755120-2-isaac.scott@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260204154015.3755120-2-isaac.scott@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]