[{"id":24917,"web_url":"https://patchwork.libcamera.org/comment/24917/","msgid":"<YxNcbAJJFBgupk9N@pendragon.ideasonboard.com>","date":"2022-09-03T13:53:48","subject":"Re: [libcamera-devel] [PATCH] CameraSensor: Don't fail to add\n\tcamera with faulty lens","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Sat, Sep 03, 2022 at 12:48:03PM +0100, Kieran Bingham via libcamera-devel wrote:\n> If the CameraSensor fails to identify the VCM specified, it could still\n> be possible to continue to operate the sensor. Autofocus support will be\n> disabled, but this would be no different to operating a camera with a\n> fixed focus. While of course the fixed focus position may not be\n> suitable, it would provide a better user experience to be able to\n> continue to operate the camera, while still reporting that the lens is\n> disabled.\n> \n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=146\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n> \n> The Surface devices now have a VCM registered, but they don't\n> successfully identify the device. While that should also be fixed,\n> failing to operate a camera because the VCM isn't operating seems to be\n> a bad user experience.\n\nI think that's reasonable, while there's clearly a problem on the kernel\nside, this degraded mode is implemented without much overhead here, so\nI'm fine with it.\n\n>  src/libcamera/camera_sensor.cpp | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index d055c16a4885..dcee7b9a0210 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -467,8 +467,8 @@ int CameraSensor::discoverAncillaryDevices()\n>  \t\t\tret = focusLens_->init();\n>  \t\t\tif (ret) {\n>  \t\t\t\tLOG(CameraSensor, Error)\n> -\t\t\t\t\t<< \"CameraLens initialisation failed\";\n> -\t\t\t\treturn ret;\n> +\t\t\t\t\t<< \"CameraLens initialisation failed: Lens disabled\";\n\nI'd reset focusLens_ here to avoid exposin a non-working CameraLens\nthrough focusLens().\n\n> +\t\t\t\tbreak;\n\nAnd you can drop the break, there's one just after. The message could\nalso be shortened slightly, up to you.\n\n\t\t\tret = focusLens_->init();\n\t\t\tif (ret) {\n\t\t\t\tLOG(CameraSensor, Error)\n\t\t\t\t\t<< \"Lens initialisation failed, lens disabled\";\n\t\t\t\tfocusLens_.reset();\n\t\t\t}\n\t\t\tbreak;\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t\t\t}\n>  \t\t\tbreak;\n>","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 109BBC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  3 Sep 2022 13:54:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 521B761FBB;\n\tSat,  3 Sep 2022 15:54:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 03C0361FBB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  3 Sep 2022 15:54:01 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4FB094A8;\n\tSat,  3 Sep 2022 15:54:01 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662213243;\n\tbh=MB26s2Ot7aqHIBdr5xbLS9zU1eC2Bk0DZTPWKUuhkRk=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=TxbsnApybrVHGtWy0WCvSORucUqT4BLSVQ4OLLnI/Ku+0yZDylFJaEuGTH5IxWYYl\n\t1cWBIWFyfUkwupLNOd1GDrpUpERrGg+1CXb7biWsfAcmCOLfTKid8gbejGUn8qoGMT\n\tCadeV+D/Qb9ODJAuMOlckn+cnW4qd63zvDqZI153aeIMefZdUbCFvPKSTfxnTEBApr\n\tIfFnpcpdLJ6Ze589NsBN0FcMvSurlX0JPje245Njj6J31cToeO0OaMEJQxgfLMC3In\n\t9QbKzHG8NTGY7SiIKKROWChWKwDofjYBI5hCCr7ijpJ39UNvMkwIA1xNXXzoZJlJ4/\n\tfPTgAy0SaGcfw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662213241;\n\tbh=MB26s2Ot7aqHIBdr5xbLS9zU1eC2Bk0DZTPWKUuhkRk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uDHXuTVHtI1vPIZ4+YKWklkyaodJyIlX9Hu8eCZrSfks+e1zgfEl2z6YhYcz+jHnO\n\thNvb5lyGV13mcN0yLhMCwFzqsAWyh+c6VkgQvoP+QxzwvGgjJusFg57K59z54+sqth\n\tMAsS+3jrtMBIR2CXevTI9LLBiggwVNKPPnMRh1aY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uDHXuTVH\"; dkim-atps=neutral","Date":"Sat, 3 Sep 2022 16:53:48 +0300","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YxNcbAJJFBgupk9N@pendragon.ideasonboard.com>","References":"<20220903114803.951682-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220903114803.951682-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] CameraSensor: Don't fail to add\n\tcamera with faulty lens","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24928,"web_url":"https://patchwork.libcamera.org/comment/24928/","msgid":"<00d5f3fe-b0a9-1724-0b3a-78572634bb0f@ideasonboard.com>","date":"2022-09-05T06:16:51","subject":"Re: [libcamera-devel] [PATCH] CameraSensor: Don't fail to add\n\tcamera with faulty lens","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hello,\n\nOn 9/3/22 7:23 PM, Laurent Pinchart via libcamera-devel wrote:\n> Hi Kieran,\n>\n> Thank you for the patch.\n>\n> On Sat, Sep 03, 2022 at 12:48:03PM +0100, Kieran Bingham via libcamera-devel wrote:\n>> If the CameraSensor fails to identify the VCM specified, it could still\n>> be possible to continue to operate the sensor. Autofocus support will be\n>> disabled, but this would be no different to operating a camera with a\n>> fixed focus. While of course the fixed focus position may not be\n>> suitable, it would provide a better user experience to be able to\n>> continue to operate the camera, while still reporting that the lens is\n>> disabled.\n>>\n>> Bug: https://bugs.libcamera.org/show_bug.cgi?id=146\n>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> ---\n>>\n>> The Surface devices now have a VCM registered, but they don't\n>> successfully identify the device. While that should also be fixed,\n>> failing to operate a camera because the VCM isn't operating seems to be\n>> a bad user experience.\n> I think that's reasonable, while there's clearly a problem on the kernel\n> side, this degraded mode is implemented without much overhead here, so\n> I'm fine with it.\n>\n>>   src/libcamera/camera_sensor.cpp | 4 ++--\n>>   1 file changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n>> index d055c16a4885..dcee7b9a0210 100644\n>> --- a/src/libcamera/camera_sensor.cpp\n>> +++ b/src/libcamera/camera_sensor.cpp\n>> @@ -467,8 +467,8 @@ int CameraSensor::discoverAncillaryDevices()\n>>   \t\t\tret = focusLens_->init();\n>>   \t\t\tif (ret) {\n>>   \t\t\t\tLOG(CameraSensor, Error)\n>> -\t\t\t\t\t<< \"CameraLens initialisation failed\";\n>> -\t\t\t\treturn ret;\n>> +\t\t\t\t\t<< \"CameraLens initialisation failed: Lens disabled\";\n> I'd reset focusLens_ here to avoid exposin a non-working CameraLens\n> through focusLens().\n>\n>> +\t\t\t\tbreak;\n> And you can drop the break, there's one just after. The message could\n> also be shortened slightly, up to you.\n>\n> \t\t\tret = focusLens_->init();\n> \t\t\tif (ret) {\n> \t\t\t\tLOG(CameraSensor, Error)\n> \t\t\t\t\t<< \"Lens initialisation failed, lens disabled\";\n> \t\t\t\tfocusLens_.reset();\n> \t\t\t}\n> \t\t\tbreak;\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n>\n>>   \t\t\t}\n>>   \t\t\tbreak;\n>>","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 35A0CC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Sep 2022 06:16:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8077362050;\n\tMon,  5 Sep 2022 08:16:58 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C0526041F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Sep 2022 08:16:56 +0200 (CEST)","from [IPV6:2401:4900:1f3f:3b55:213a:3c32:c7d0:be1e] (unknown\n\t[IPv6:2401:4900:1f3f:3b55:213a:3c32:c7d0:be1e])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 755E44A8;\n\tMon,  5 Sep 2022 08:16:55 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662358618;\n\tbh=PnMx3yVvGOWEBBitC9GFNunc/2h9I8o05N3haHQKYCk=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=qcd7I3+5y6Kzl54VcmmuhCiGu6cc6AURVAcVONzNTNHkS9Jc3ZXoO3ClpKlKzdDNl\n\tXe4IjR7lGjeQykJ/YyUSGo/WHFpQSz3Kd45VOeFQdqVEPbN6h2agSLYICg3hCxbzwF\n\t7qjBx54w451Q4vT1IaCSdlLK9KIXGDyoS3i++chaYtSOgb5pyQQi/OMAetwklYaoS7\n\t2gajenvfWviAx4aiuJkJcZn5ajDeJFw57VPIbneNaSe3qGioBxmC8qk7RVhRiy5AvL\n\tMSXJYp1CW8L8+nhfgq9h61OR1BIdEwvxZnGQZuxZeE1PX5H11Jb00jJn1P50gQZEb+\n\t/u/3zMiH39m2Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662358616;\n\tbh=PnMx3yVvGOWEBBitC9GFNunc/2h9I8o05N3haHQKYCk=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=Z8hhn7ttpIXVAMbH+D+I1kKeZvv10S1vbV9+l+AOBoKZWeRspuOJHVWJUl5xOgUF1\n\tfHSs4JGbJYDzQ1bcCXOkyuKVF01pi5wcLQYz76JRchvP+WGV8G/kJXtm0zyV5NPeeu\n\tY94dT7IN3EYRiibLDBuZ3yirC6MEN32uOcgg9rYE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Z8hhn7tt\"; dkim-atps=neutral","Message-ID":"<00d5f3fe-b0a9-1724-0b3a-78572634bb0f@ideasonboard.com>","Date":"Mon, 5 Sep 2022 11:46:51 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.12.0","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20220903114803.951682-1-kieran.bingham@ideasonboard.com>\n\t<YxNcbAJJFBgupk9N@pendragon.ideasonboard.com>","In-Reply-To":"<YxNcbAJJFBgupk9N@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] CameraSensor: Don't fail to add\n\tcamera with faulty lens","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]