[{"id":23336,"web_url":"https://patchwork.libcamera.org/comment/23336/","msgid":"<Yp3E+R48J3Jpbc6Q@pendragon.ideasonboard.com>","date":"2022-06-06T09:12:25","subject":"Re: [libcamera-devel] [PATCH 1/1] camera_sensor: Suppress error\n\tmessage if test patterns are unavailable","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Mon, Jun 06, 2022 at 09:58:25AM +0100, Naushir Patuck via libcamera-devel wrote:\n> If a sensor driver does not support test patterns (e.g. IMX477), libcamera\n> throws an unnecessary error message during initialisation when it sets the test\n> pattern to off.\n> \n> Fix this by moving the error message into setTestPatternMode() where the\n> pipeline handler explicitly requests to set a test pattern.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/libcamera/camera_sensor.cpp | 11 +++++++----\n>  1 file changed, 7 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 4bb2066f0fd4..d055c16a4885 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -582,16 +582,19 @@ int CameraSensor::setTestPatternMode(controls::draft::TestPatternModeEnum mode)\n>  \tif (testPatternMode_ == mode)\n>  \t\treturn 0;\n>  \n> +\tif (testPatternModes_.empty()) {\n> +\t\tLOG(CameraSensor, Error)\n> +\t\t\t<< \"Camera sensor does not support test pattern modes.\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n>  \treturn applyTestPatternMode(mode);\n>  }\n>  \n>  int CameraSensor::applyTestPatternMode(controls::draft::TestPatternModeEnum mode)\n>  {\n> -\tif (testPatternModes_.empty()) {\n> -\t\tLOG(CameraSensor, Error)\n> -\t\t\t<< \"Camera sensor does not support test pattern modes.\";\n> +\tif (testPatternModes_.empty())\n>  \t\treturn 0;\n> -\t}\n>  \n>  \tauto it = std::find(testPatternModes_.begin(), testPatternModes_.end(),\n>  \t\t\t    mode);","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 B373EBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jun 2022 09:12:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6900065634;\n\tMon,  6 Jun 2022 11:12:31 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 13EFD65633\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jun 2022 11:12:30 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A897930A;\n\tMon,  6 Jun 2022 11:12:29 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654506751;\n\tbh=U2prCvu+wqBZLf5WEv/MBcL861IAWHn1DikyXiryRdk=;\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=uLKJ9Hbe41h2JxcevdPnMzL9ppZ/POy1EWMLcVVFVwO6gsV54DP3ImiWzpTCjnLjK\n\tAryizMXs1c9RhHKWvwCjOg7fjuauAf6Jzv8OPtR/3bb2Wt8kTNb9SeNto+z5Oy6hwd\n\tKpoylt4uafQ386Ey+9niBuH70wcpspAjseRxOtEnAv4UY+2gRzmdFoFbTXtpjQKOk9\n\t1sX0f51bZrfz57HLY9JepmQDz6woGSv5GilDVVDAxBWu2xOTWd0JLmrmpMEENNAu3j\n\tPN3rhEF4lwZkczr6J4wMzxH2BC2mWxWuQpQwL89VTM1rRr5WGnMnBGwwrIdmDM54q5\n\tlsiS/6qz0Gf6A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654506749;\n\tbh=U2prCvu+wqBZLf5WEv/MBcL861IAWHn1DikyXiryRdk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=NLg5kMKjLN0k0+hX3C0aseJhpdxUvDIwaZvfhjobYSw9f/wgQg80SB3hm4hergTGk\n\tzXH8Xl69MjI+Y314bS2kFb5a5UVpuJmpiYJ+R+eB0NQplM7aHBdWShghWKGOGtFedQ\n\tvgklgsjnQzoScCIiNNv/zm7R02v9SjYeu8eD/PJQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"NLg5kMKj\"; dkim-atps=neutral","Date":"Mon, 6 Jun 2022 12:12:25 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<Yp3E+R48J3Jpbc6Q@pendragon.ideasonboard.com>","References":"<20220606085825.1145654-1-naush@raspberrypi.com>\n\t<20220606085825.1145654-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220606085825.1145654-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 1/1] camera_sensor: Suppress error\n\tmessage if test patterns are unavailable","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@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23340,"web_url":"https://patchwork.libcamera.org/comment/23340/","msgid":"<165451677545.3884725.2361170394742051505@Monstersaurus>","date":"2022-06-06T11:59:35","subject":"Re: [libcamera-devel] [PATCH 1/1] camera_sensor: Suppress error\n\tmessage if test patterns are unavailable","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2022-06-06 09:58:25)\n> If a sensor driver does not support test patterns (e.g. IMX477), libcamera\n> throws an unnecessary error message during initialisation when it sets the test\n> pattern to off.\n> \n> Fix this by moving the error message into setTestPatternMode() where the\n> pipeline handler explicitly requests to set a test pattern.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/libcamera/camera_sensor.cpp | 11 +++++++----\n>  1 file changed, 7 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\n> index 4bb2066f0fd4..d055c16a4885 100644\n> --- a/src/libcamera/camera_sensor.cpp\n> +++ b/src/libcamera/camera_sensor.cpp\n> @@ -582,16 +582,19 @@ int CameraSensor::setTestPatternMode(controls::draft::TestPatternModeEnum mode)\n>         if (testPatternMode_ == mode)\n>                 return 0;\n>  \n> +       if (testPatternModes_.empty()) {\n> +               LOG(CameraSensor, Error)\n> +                       << \"Camera sensor does not support test pattern modes.\";\n> +               return -EINVAL;\n> +       }\n> +\n>         return applyTestPatternMode(mode);\n>  }\n>  \n>  int CameraSensor::applyTestPatternMode(controls::draft::TestPatternModeEnum mode)\n>  {\n> -       if (testPatternModes_.empty()) {\n> -               LOG(CameraSensor, Error)\n> -                       << \"Camera sensor does not support test pattern modes.\";\n> +       if (testPatternModes_.empty())\n>                 return 0;\n> -       }\n>  \n>         auto it = std::find(testPatternModes_.begin(), testPatternModes_.end(),\n>                             mode);\n> -- \n> 2.34.1\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 24A27BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jun 2022 11:59:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 58A9A6559A;\n\tMon,  6 Jun 2022 13:59:40 +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 61F08633A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jun 2022 13:59:38 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EAC9330A;\n\tMon,  6 Jun 2022 13:59:37 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1654516780;\n\tbh=nzeVfA2OiDx+Dg+nODWDYf6WER/bH3QQsDwcqvJ3trE=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=DOHYXOqGPZw8pxQ8FBdokAmCfiQhmOmZ0JVuhV96a8dAs1Rnd6zoNlZF47NIFMyVY\n\t+wdc+Hra2OHX7toPRtaBDW3xcDcajlBbSNvnr//SExjqzcOhO4o7vhZmrW0jwuuty/\n\tin0TK9lLVrJWiIu7BEKzONRIUAemE7GDQt7+5p3fFt9AMq3wq1S7ljhO/wWEREmXSn\n\t/uqO8OQxTvTYfAsFlR4x5mfb3jZi0BfwF7GTEBTWVLUjoWJrbcGpRoRUCHmJBwHD2T\n\tQShX3dv5DU+zM3gc/0dtUuIslL1gh3osbt/c5x90glYWxxrOG94bka2iIeFoMTx3OZ\n\tzagQ9RYukYsCQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1654516778;\n\tbh=nzeVfA2OiDx+Dg+nODWDYf6WER/bH3QQsDwcqvJ3trE=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=jV+GD/3wHFEwwatymXd1E7lkGUP2B+0fjq3xx3LDvkiKoOmNY2wPsgBL6xFqKyz1H\n\ttb8B+oYYR4UPLDhz8zsSclLOUC3GZfqtGiaTwD4+VZ4BR0CLARHLZODGrf06x82Wla\n\tGyedfqNf84NRctR4AnCIfF/f0yxf4kttx8nl6utA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"jV+GD/3w\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220606085825.1145654-2-naush@raspberrypi.com>","References":"<20220606085825.1145654-1-naush@raspberrypi.com>\n\t<20220606085825.1145654-2-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 06 Jun 2022 12:59:35 +0100","Message-ID":"<165451677545.3884725.2361170394742051505@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 1/1] camera_sensor: Suppress error\n\tmessage if test patterns are unavailable","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]