[{"id":2666,"web_url":"https://patchwork.libcamera.org/comment/2666/","msgid":"<20190917060703.GD1161@localhost.localdomain>","date":"2019-09-17T06:07:03","subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the patch.\n\nOn Sun, Sep 15, 2019 at 11:23:18PM +0300, Laurent Pinchart wrote:\n> When enumerating IPAs, the system IPA directory and all the directories\n> listed in the LIBCAMERA_IPA_MODULE_PATH environment variable are listed\n> in turn. Failing to list any of those directories results in an error\n> message being printed for every failure. This is particularly common\n> when developing libcamera, as IPAs may not have been installed locally.\n> \n> To avoid unnecessarily worrying error messages, rework the enumeration\n> procedure to only print a message when no IPA can be found at all.\n> Individual missing directories are not considered as an issue anymore.\n> The message is also downgraded from an error to a warning as the\n> situation may still be normal.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/ipa_manager.cpp | 24 ++++++++++++++++++------\n>  1 file changed, 18 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> index 0a908eae6261..f3e08375820c 100644\n> --- a/src/libcamera/ipa_manager.cpp\n> +++ b/src/libcamera/ipa_manager.cpp\n> @@ -94,11 +94,19 @@ LOG_DEFINE_CATEGORY(IPAManager)\n>  \n>  IPAManager::IPAManager()\n>  {\n> -\taddDir(IPA_MODULE_DIR);\n> +\tunsigned int ipaCount = 0;\n> +\tint ret;\n> +\n> +\tret = addDir(IPA_MODULE_DIR);\n> +\tif (ret > 0)\n> +\t\tipaCount += ret;\n>  \tconst char *modulePaths = utils::secure_getenv(\"LIBCAMERA_IPA_MODULE_PATH\");\n> -\tif (!modulePaths)\n> +\tif (!modulePaths) {\n> +\t\tLOG(IPAManager, Warning)\n> +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"'\";\n\nWe need to check ipaCount here, since we could have loaded some IPAs\nfrom the global dir, and just not have the environment variable\nspecified.\n\n>  \t\treturn;\n> +\t}\n>  \n>  \twhile (1) {\n>  \t\tconst char *delim = strchrnul(modulePaths, ':');\n> @@ -106,7 +114,9 @@ IPAManager::IPAManager()\n>  \n>  \t\tif (count) {\n>  \t\t\tstd::string path(modulePaths, count);\n> -\t\t\taddDir(path.c_str());\n> +\t\t\tret = addDir(path.c_str());\n> +\t\t\tif (ret > 0)\n> +\t\t\t\tipaCount += ret;\n>  \t\t}\n>  \n>  \t\tif (*delim == '\\0')\n> @@ -114,6 +124,11 @@ IPAManager::IPAManager()\n>  \n>  \t\tmodulePaths += count + 1;\n>  \t}\n> +\n> +\tif (!ipaCount)\n> +\t\tLOG(IPAManager, Warning)\n> +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"' and '\"\n> +\t\t\t<< modulePaths << \"'\";\n\nI presume you're fine with modulePaths being printed as-is, as a\ncolon-separated list of directories.\n\n>  }\n>  \n>  IPAManager::~IPAManager()\n> @@ -155,9 +170,6 @@ int IPAManager::addDir(const char *libDir)\n>  \tdir = opendir(libDir);\n>  \tif (!dir) {\n>  \t\tint ret = -errno;\n> -\t\tLOG(IPAManager, Error)\n> -\t\t\t<< \"Invalid path \" << libDir << \" for IPA modules: \"\n> -\t\t\t<< strerror(-ret);\n>  \t\treturn ret;\n\nCould this be shortened to\nreturn -errno; ?\n\n>  \t}\n\nWith these changes,\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n\nPaul","headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8FA0660BD9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Sep 2019 08:07:10 +0200 (CEST)","from localhost.localdomain (unknown [96.44.9.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D2384528;\n\tTue, 17 Sep 2019 08:07:09 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1568700430;\n\tbh=iQFseaz7PYe/pQHg0n39evIH3an+wiPuZYWu5ibHXVw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=r9ZVrDa8awKjnM7EtJlKUCKz9qJwwfdGncKdN1CvRNxQ5+b243ugGhtvOALJ9dnJr\n\t7uDPAZkaTi6jmuwvHsKyUdKLjLAWoTV/zk9izrW7U3ic09tfpPsT7972AcHhJeA9VD\n\ttp5+qOz42xhGLzebt4Ab0xOSAK0YEcezD5LsXpaY=","Date":"Tue, 17 Sep 2019 02:07:03 -0400","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190917060703.GD1161@localhost.localdomain>","References":"<20190915202318.5825-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20190915202318.5825-1-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Tue, 17 Sep 2019 06:07:10 -0000"}},{"id":2670,"web_url":"https://patchwork.libcamera.org/comment/2670/","msgid":"<20190918131427.GE6306@pendragon.ideasonboard.com>","date":"2019-09-18T13:14:27","subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nOn Tue, Sep 17, 2019 at 02:07:03AM -0400, Paul Elder wrote:\n> On Sun, Sep 15, 2019 at 11:23:18PM +0300, Laurent Pinchart wrote:\n> > When enumerating IPAs, the system IPA directory and all the directories\n> > listed in the LIBCAMERA_IPA_MODULE_PATH environment variable are listed\n> > in turn. Failing to list any of those directories results in an error\n> > message being printed for every failure. This is particularly common\n> > when developing libcamera, as IPAs may not have been installed locally.\n> > \n> > To avoid unnecessarily worrying error messages, rework the enumeration\n> > procedure to only print a message when no IPA can be found at all.\n> > Individual missing directories are not considered as an issue anymore.\n> > The message is also downgraded from an error to a warning as the\n> > situation may still be normal.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/libcamera/ipa_manager.cpp | 24 ++++++++++++++++++------\n> >  1 file changed, 18 insertions(+), 6 deletions(-)\n> > \n> > diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> > index 0a908eae6261..f3e08375820c 100644\n> > --- a/src/libcamera/ipa_manager.cpp\n> > +++ b/src/libcamera/ipa_manager.cpp\n> > @@ -94,11 +94,19 @@ LOG_DEFINE_CATEGORY(IPAManager)\n> >  \n> >  IPAManager::IPAManager()\n> >  {\n> > -\taddDir(IPA_MODULE_DIR);\n> > +\tunsigned int ipaCount = 0;\n> > +\tint ret;\n> > +\n> > +\tret = addDir(IPA_MODULE_DIR);\n> > +\tif (ret > 0)\n> > +\t\tipaCount += ret;\n> >  \tconst char *modulePaths = utils::secure_getenv(\"LIBCAMERA_IPA_MODULE_PATH\");\n> > -\tif (!modulePaths)\n> > +\tif (!modulePaths) {\n> > +\t\tLOG(IPAManager, Warning)\n> > +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"'\";\n> \n> We need to check ipaCount here, since we could have loaded some IPAs\n> from the global dir, and just not have the environment variable\n> specified.\n\nOops, indeed. I'll fix this.\n\n> >  \t\treturn;\n> > +\t}\n> >  \n> >  \twhile (1) {\n> >  \t\tconst char *delim = strchrnul(modulePaths, ':');\n> > @@ -106,7 +114,9 @@ IPAManager::IPAManager()\n> >  \n> >  \t\tif (count) {\n> >  \t\t\tstd::string path(modulePaths, count);\n> > -\t\t\taddDir(path.c_str());\n> > +\t\t\tret = addDir(path.c_str());\n> > +\t\t\tif (ret > 0)\n> > +\t\t\t\tipaCount += ret;\n> >  \t\t}\n> >  \n> >  \t\tif (*delim == '\\0')\n> > @@ -114,6 +124,11 @@ IPAManager::IPAManager()\n> >  \n> >  \t\tmodulePaths += count + 1;\n> >  \t}\n> > +\n> > +\tif (!ipaCount)\n> > +\t\tLOG(IPAManager, Warning)\n> > +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"' and '\"\n> > +\t\t\t<< modulePaths << \"'\";\n> \n> I presume you're fine with modulePaths being printed as-is, as a\n> colon-separated list of directories.\n\nI think it's good enough for now, yes.\n\n> >  }\n> >  \n> >  IPAManager::~IPAManager()\n> > @@ -155,9 +170,6 @@ int IPAManager::addDir(const char *libDir)\n> >  \tdir = opendir(libDir);\n> >  \tif (!dir) {\n> >  \t\tint ret = -errno;\n> > -\t\tLOG(IPAManager, Error)\n> > -\t\t\t<< \"Invalid path \" << libDir << \" for IPA modules: \"\n> > -\t\t\t<< strerror(-ret);\n> >  \t\treturn ret;\n> \n> Could this be shortened to\n> return -errno; ?\n\nUnfortunately not, as LOG() could result in errno being modified. That's\nwhy we have these constructs through the code where we store -errno in\nret.\n\n> >  \t}\n> \n> With these changes,\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 CB5FA60BB0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Sep 2019 15:14:37 +0200 (CEST)","from pendragon.ideasonboard.com (126.92.103.87.rev.vodafone.pt\n\t[87.103.92.126])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 168E0325;\n\tWed, 18 Sep 2019 15:14:36 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1568812477;\n\tbh=sw+ts4mfwb7WYpozxbrd/CnTHXGrxxsG2rT8SgyI+20=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tbtWuw4PXiYZ3RQzWwYmdgktpkV/ZQN/L01C8O/h6PTLQM4L+UG95hYKmBAtdAIrI\n\tTQYv6D4QlBeoY6a/fK0TxqnoTskccyMQn3KGPlbF4c7aj4C7rQXUH7pdcXMpq6q2KB\n\t6Fmx5viUVL9oxVcElBkN4alWtwd7csYTcQ52mKWQ=","Date":"Wed, 18 Sep 2019 16:14:27 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190918131427.GE6306@pendragon.ideasonboard.com>","References":"<20190915202318.5825-1-laurent.pinchart@ideasonboard.com>\n\t<20190917060703.GD1161@localhost.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190917060703.GD1161@localhost.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Wed, 18 Sep 2019 13:14:38 -0000"}},{"id":2671,"web_url":"https://patchwork.libcamera.org/comment/2671/","msgid":"<daa5c370-71a7-67ea-01a8-302731cfc3b9@ideasonboard.com>","date":"2019-09-18T13:31:58","subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 18/09/2019 14:14, Laurent Pinchart wrote:\n> Hi Paul,\n> \n> On Tue, Sep 17, 2019 at 02:07:03AM -0400, Paul Elder wrote:\n>> On Sun, Sep 15, 2019 at 11:23:18PM +0300, Laurent Pinchart wrote:\n>>> When enumerating IPAs, the system IPA directory and all the directories\n>>> listed in the LIBCAMERA_IPA_MODULE_PATH environment variable are listed\n>>> in turn. Failing to list any of those directories results in an error\n>>> message being printed for every failure. This is particularly common\n>>> when developing libcamera, as IPAs may not have been installed locally.\n>>>\n>>> To avoid unnecessarily worrying error messages, rework the enumeration\n>>> procedure to only print a message when no IPA can be found at all.\n>>> Individual missing directories are not considered as an issue anymore.\n>>> The message is also downgraded from an error to a warning as the\n>>> situation may still be normal.\n>>>\n>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>> ---\n>>>  src/libcamera/ipa_manager.cpp | 24 ++++++++++++++++++------\n>>>  1 file changed, 18 insertions(+), 6 deletions(-)\n>>>\n>>> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n>>> index 0a908eae6261..f3e08375820c 100644\n>>> --- a/src/libcamera/ipa_manager.cpp\n>>> +++ b/src/libcamera/ipa_manager.cpp\n>>> @@ -94,11 +94,19 @@ LOG_DEFINE_CATEGORY(IPAManager)\n>>>  \n>>>  IPAManager::IPAManager()\n>>>  {\n>>> -\taddDir(IPA_MODULE_DIR);\n>>> +\tunsigned int ipaCount = 0;\n>>> +\tint ret;\n>>> +\n>>> +\tret = addDir(IPA_MODULE_DIR);\n>>> +\tif (ret > 0)\n>>> +\t\tipaCount += ret;\n>>>  \tconst char *modulePaths = utils::secure_getenv(\"LIBCAMERA_IPA_MODULE_PATH\");\n>>> -\tif (!modulePaths)\n>>> +\tif (!modulePaths) {\n>>> +\t\tLOG(IPAManager, Warning)\n>>> +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"'\";\n>>\n>> We need to check ipaCount here, since we could have loaded some IPAs\n>> from the global dir, and just not have the environment variable\n>> specified.\n> \n> Oops, indeed. I'll fix this.\n> \n>>>  \t\treturn;\n>>> +\t}\n>>>  \n>>>  \twhile (1) {\n>>>  \t\tconst char *delim = strchrnul(modulePaths, ':');\n>>> @@ -106,7 +114,9 @@ IPAManager::IPAManager()\n>>>  \n>>>  \t\tif (count) {\n>>>  \t\t\tstd::string path(modulePaths, count);\n>>> -\t\t\taddDir(path.c_str());\n>>> +\t\t\tret = addDir(path.c_str());\n>>> +\t\t\tif (ret > 0)\n>>> +\t\t\t\tipaCount += ret;\n>>>  \t\t}\n>>>  \n>>>  \t\tif (*delim == '\\0')\n>>> @@ -114,6 +124,11 @@ IPAManager::IPAManager()\n>>>  \n>>>  \t\tmodulePaths += count + 1;\n>>>  \t}\n>>> +\n>>> +\tif (!ipaCount)\n>>> +\t\tLOG(IPAManager, Warning)\n>>> +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"' and '\"\n>>> +\t\t\t<< modulePaths << \"'\";\n>>\n>> I presume you're fine with modulePaths being printed as-is, as a\n>> colon-separated list of directories.\n> \n> I think it's good enough for now, yes.\n> \n>>>  }\n>>>  \n>>>  IPAManager::~IPAManager()\n>>> @@ -155,9 +170,6 @@ int IPAManager::addDir(const char *libDir)\n>>>  \tdir = opendir(libDir);\n>>>  \tif (!dir) {\n>>>  \t\tint ret = -errno;\n>>> -\t\tLOG(IPAManager, Error)\n>>> -\t\t\t<< \"Invalid path \" << libDir << \" for IPA modules: \"\n>>> -\t\t\t<< strerror(-ret);\n>>>  \t\treturn ret;\n>>\n>> Could this be shortened to\n>> return -errno; ?\n> \n> Unfortunately not, as LOG() could result in errno being modified. That's\n> why we have these constructs through the code where we store -errno in\n> ret.\n\nYou mean the LOG() which you have removed right ;-)\n\n> \n>>>  \t}\n>>\n>> With these changes,\n>> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["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 44F6F60BB0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Sep 2019 15:32:11 +0200 (CEST)","from [172.17.19.91] (unknown [188.39.89.194])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 81564325;\n\tWed, 18 Sep 2019 15:32:10 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1568813530;\n\tbh=PVNqWz5xYkPaX/TQfklNssL0DtH8uejzL/MQns5ZdiA=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=bufIzbMi+zxJXf1aKSsUDbysSxdihgSyyXH6kdBPUDO7R+n+WOGEhLqaufBOxrqoF\n\tcQmAMvu/qSgDQrphx/ZiZCgFmHD8Yqm6jyVgrAMw/Sy+wpsd6KW+VGe+VEIcU7BFX7\n\tnbDHjEDQxVr2hnlXglGb5FZp6YoImg2dZQEB7qWE=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20190915202318.5825-1-laurent.pinchart@ideasonboard.com>\n\t<20190917060703.GD1161@localhost.localdomain>\n\t<20190918131427.GE6306@pendragon.ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8\n\tRXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko\n\tlPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55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qa/lR+xPOlWElGB57viOSOoWriqxQbFy8XbG1GR8cWlkNtGBGVWaJaSoORP\n\tiowD7irXL91bCyFIqL+7BVk3Jy4uzP744PzE80KwxOp5SQAp9sPzFbgsJrLev90PZySjFHG0\n\twP144DK7nBjOj/J0g9OHVASP1JjK+nw7SDoKnETDIdRC0XmiHXk7TXzPdkvO0UkpHdEPjZUp\n\tWyuc0MqehjR/hTTPt4m/Y14XzEcy6JREIjOrFfUZVho2QpOdv9CNryGdieRTNjUtz463CIaZ\n\tdPBiw9mOMBoNffkn9FIoCjLnAaj9gUAnEHWBZOEviQ5NuyqpeP0YtzI4iaRbSUkYZHej99X3\n\tVmHrdLlMqd/ZgYYbPGSL4AN3FVACb5CxuxEHwo029VcE5U3CSjzqtCoX12tm7A==","Organization":"Ideas on Board","Message-ID":"<daa5c370-71a7-67ea-01a8-302731cfc3b9@ideasonboard.com>","Date":"Wed, 18 Sep 2019 14:31:58 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.8.0","MIME-Version":"1.0","In-Reply-To":"<20190918131427.GE6306@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Wed, 18 Sep 2019 13:32:11 -0000"}},{"id":2672,"web_url":"https://patchwork.libcamera.org/comment/2672/","msgid":"<20190918164557.GB4734@pendragon.ideasonboard.com>","date":"2019-09-18T16:45:57","subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Wed, Sep 18, 2019 at 02:31:58PM +0100, Kieran Bingham wrote:\n> On 18/09/2019 14:14, Laurent Pinchart wrote:\n> > On Tue, Sep 17, 2019 at 02:07:03AM -0400, Paul Elder wrote:\n> >> On Sun, Sep 15, 2019 at 11:23:18PM +0300, Laurent Pinchart wrote:\n> >>> When enumerating IPAs, the system IPA directory and all the directories\n> >>> listed in the LIBCAMERA_IPA_MODULE_PATH environment variable are listed\n> >>> in turn. Failing to list any of those directories results in an error\n> >>> message being printed for every failure. This is particularly common\n> >>> when developing libcamera, as IPAs may not have been installed locally.\n> >>>\n> >>> To avoid unnecessarily worrying error messages, rework the enumeration\n> >>> procedure to only print a message when no IPA can be found at all.\n> >>> Individual missing directories are not considered as an issue anymore.\n> >>> The message is also downgraded from an error to a warning as the\n> >>> situation may still be normal.\n> >>>\n> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >>> ---\n> >>>  src/libcamera/ipa_manager.cpp | 24 ++++++++++++++++++------\n> >>>  1 file changed, 18 insertions(+), 6 deletions(-)\n> >>>\n> >>> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> >>> index 0a908eae6261..f3e08375820c 100644\n> >>> --- a/src/libcamera/ipa_manager.cpp\n> >>> +++ b/src/libcamera/ipa_manager.cpp\n> >>> @@ -94,11 +94,19 @@ LOG_DEFINE_CATEGORY(IPAManager)\n> >>>  \n> >>>  IPAManager::IPAManager()\n> >>>  {\n> >>> -\taddDir(IPA_MODULE_DIR);\n> >>> +\tunsigned int ipaCount = 0;\n> >>> +\tint ret;\n> >>> +\n> >>> +\tret = addDir(IPA_MODULE_DIR);\n> >>> +\tif (ret > 0)\n> >>> +\t\tipaCount += ret;\n> >>>  \tconst char *modulePaths = utils::secure_getenv(\"LIBCAMERA_IPA_MODULE_PATH\");\n> >>> -\tif (!modulePaths)\n> >>> +\tif (!modulePaths) {\n> >>> +\t\tLOG(IPAManager, Warning)\n> >>> +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"'\";\n> >>\n> >> We need to check ipaCount here, since we could have loaded some IPAs\n> >> from the global dir, and just not have the environment variable\n> >> specified.\n> > \n> > Oops, indeed. I'll fix this.\n> > \n> >>>  \t\treturn;\n> >>> +\t}\n> >>>  \n> >>>  \twhile (1) {\n> >>>  \t\tconst char *delim = strchrnul(modulePaths, ':');\n> >>> @@ -106,7 +114,9 @@ IPAManager::IPAManager()\n> >>>  \n> >>>  \t\tif (count) {\n> >>>  \t\t\tstd::string path(modulePaths, count);\n> >>> -\t\t\taddDir(path.c_str());\n> >>> +\t\t\tret = addDir(path.c_str());\n> >>> +\t\t\tif (ret > 0)\n> >>> +\t\t\t\tipaCount += ret;\n> >>>  \t\t}\n> >>>  \n> >>>  \t\tif (*delim == '\\0')\n> >>> @@ -114,6 +124,11 @@ IPAManager::IPAManager()\n> >>>  \n> >>>  \t\tmodulePaths += count + 1;\n> >>>  \t}\n> >>> +\n> >>> +\tif (!ipaCount)\n> >>> +\t\tLOG(IPAManager, Warning)\n> >>> +\t\t\t<< \"No IPA found in '\" IPA_MODULE_DIR \"' and '\"\n> >>> +\t\t\t<< modulePaths << \"'\";\n> >>\n> >> I presume you're fine with modulePaths being printed as-is, as a\n> >> colon-separated list of directories.\n> > \n> > I think it's good enough for now, yes.\n> > \n> >>>  }\n> >>>  \n> >>>  IPAManager::~IPAManager()\n> >>> @@ -155,9 +170,6 @@ int IPAManager::addDir(const char *libDir)\n> >>>  \tdir = opendir(libDir);\n> >>>  \tif (!dir) {\n> >>>  \t\tint ret = -errno;\n> >>> -\t\tLOG(IPAManager, Error)\n> >>> -\t\t\t<< \"Invalid path \" << libDir << \" for IPA modules: \"\n> >>> -\t\t\t<< strerror(-ret);\n> >>>  \t\treturn ret;\n> >>\n> >> Could this be shortened to\n> >> return -errno; ?\n> > \n> > Unfortunately not, as LOG() could result in errno being modified. That's\n> > why we have these constructs through the code where we store -errno in\n> > ret.\n> \n> You mean the LOG() which you have removed right ;-)\n\nThis is embarassing... :-) I'll fix it when applying if there's no other\ncomment to v2, or in v3 otherwise.\n\n> >>>  \t}\n> >>\n> >> With these changes,\n> >> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DDC860BB6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Sep 2019 18:46:07 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [62.28.174.186])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6A607325;\n\tWed, 18 Sep 2019 18:46:06 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1568825166;\n\tbh=DQh5HD2ClJdAfYnPbG/xvHpySy60rcKqCnj1/HJxouk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=W1QJdvlRiUoK97qHK45F9O78+gf60Q5uOePXmgvxH46nGFbBXPKTvYAdchLa2UOBT\n\t0a63ECWSvgpRSgi8x2UqjR+5grqoSrkpb1GnXQVQSzV3koP5ac8rarbx/benkhgu99\n\t72v+xcXNBg/KxiwdunshyjPAk02INsVWI48STzXA=","Date":"Wed, 18 Sep 2019 19:45:57 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190918164557.GB4734@pendragon.ideasonboard.com>","References":"<20190915202318.5825-1-laurent.pinchart@ideasonboard.com>\n\t<20190917060703.GD1161@localhost.localdomain>\n\t<20190918131427.GE6306@pendragon.ideasonboard.com>\n\t<daa5c370-71a7-67ea-01a8-302731cfc3b9@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<daa5c370-71a7-67ea-01a8-302731cfc3b9@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: ipa_manager: Rework error\n\tmessages when enumerating IPAs","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Wed, 18 Sep 2019 16:46:07 -0000"}}]