[{"id":2034,"web_url":"https://patchwork.libcamera.org/comment/2034/","msgid":"<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>","date":"2019-06-26T10:17:23","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 26/06/2019 11:13, Jacopo Mondi wrote:\n> When enumerating the available V4L2 controls at video device open\n> time set the V4L2_CTRL_FLAG_NEXT_CTRL flag when hitting an unsupported\n> control type not to loop forever.\n\n\"set the V4L2_CTRL_FLAG_NEXT_CTRL flag if an unsupported control type is\nencountered to prevent infinite loops.\"\n\n\n> While at it, downgrade the message reporting the control type in not\n\n\"reporting the unsupported control type to Debug\"\n\n\n> supported to Debug, as it is not an error worth being reported\n> unconditionally.\n> \n> Fixes: 030ce6491ed3 (\"libcamera: v4l2_device: List valid controls at open\")\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/libcamera/v4l2_device.cpp | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 84758a811c27..13d4bce5c013 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -341,8 +341,9 @@ void V4L2Device::listControls()\n>  \t\t\tbreak;\n>  \t\t/* \\todo Support compound controls. */\n>  \t\tdefault:\n> -\t\t\tLOG(V4L2, Error) << \"Control type '\" << info.type()\n> +\t\t\tLOG(V4L2, Debug) << \"Control type '\" << info.type()\n>  \t\t\t\t\t << \"' not supported\";\n> +\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n>  \t\t\tcontinue;\n>  \t\t}\n>  \n>","headers":{"Return-Path":"<kieran.bingham@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 537216157F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Jun 2019 12:17:27 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B9DF9510;\n\tWed, 26 Jun 2019 12:17:26 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561544246;\n\tbh=sYVJxw92Fz5eQ4/mbBYmi/xWQi+mfNFOvhTX37IqHR8=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=rI+xqKvLJq2WL+7c+TxLWMtAhl4idGzWYhianMTYmOvS1SrRN5P2L7U3scql/z9cf\n\tvO24ltipOvl1nbsZmwPk/sDFvO3D3wV4BH6e6rRFLQbTHYnRgfDtG9hyM64M0bTlAB\n\tPmAhgwbAWuNjibfsdODDKuWL5K+jEw69Bz2SIvQo=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20190626101308.19099-1-jacopo@jmondi.org>","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\tpotzWkXc1xmPzcQ1f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UEGAEKAA8CGwwFAlnDlGsFCQeA/gIACgkQoR5GchCkYf1yYRAAq+Yo\n\tnbf9DGdK1kTAm2RTFg+w9oOp2Xjqfhds2PAhFFvrHQg1XfQR/UF/SjeUmaOmLSczM0s6XMeO\n\tVcE77UFtJ/+hLo4PRFKm5X1Pcar6g5m4xGqa+Xfzi9tRkwC29KMCoQOag1BhHChgqYaUH3yo\n\tUzaPwT/fY75iVI+yD0ih/e6j8qYvP8pvGwMQfrmN9YB0zB39YzCSdaUaNrWGD3iCBxg6lwSO\n\tLKeRhxxfiXCIYEf3vwOsP3YMx2JkD5doseXmWBGW1U0T/oJF+DVfKB6mv5UfsTzpVhJRgee7\n\t4jkjqFq4qsUGxcvF2xtRkfHFpZDbRgRlVmiWkqDkT4qMA+4q1y/dWwshSKi/uwVZNycuLsz+\n\t+OD8xPNCsMTqeUkAKfbD8xW4LCay3r/dD2ckoxRxtMD9eOAyu5wYzo/ydIPTh1QEj9SYyvp8\n\tO0g6CpxEwyHUQtF5oh15O018z3ZLztFJKR3RD42VKVsrnNDKnoY0f4U0z7eJv2NeF8xHMuiU\n\tRCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA\n\tJxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>","Date":"Wed, 26 Jun 2019 11:17:23 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.7.0","MIME-Version":"1.0","In-Reply-To":"<20190626101308.19099-1-jacopo@jmondi.org>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","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, 26 Jun 2019 10:17:27 -0000"}},{"id":2038,"web_url":"https://patchwork.libcamera.org/comment/2038/","msgid":"<20190626134457.GA5015@pendragon.ideasonboard.com>","date":"2019-06-26T13:44:57","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Jun 26, 2019 at 11:17:23AM +0100, Kieran Bingham wrote:\n> On 26/06/2019 11:13, Jacopo Mondi wrote:\n> > When enumerating the available V4L2 controls at video device open\n\ns/video device/V4L2 device/\n\n> > time set the V4L2_CTRL_FLAG_NEXT_CTRL flag when hitting an unsupported\n> > control type not to loop forever.\n> \n> \"set the V4L2_CTRL_FLAG_NEXT_CTRL flag if an unsupported control type is\n> encountered to prevent infinite loops.\"\n> \n> > While at it, downgrade the message reporting the control type in not\n> \n> \"reporting the unsupported control type to Debug\"\n> \n> \n> > supported to Debug, as it is not an error worth being reported\n> > unconditionally.\n> > \n> > Fixes: 030ce6491ed3 (\"libcamera: v4l2_device: List valid controls at open\")\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > ---\n> >  src/libcamera/v4l2_device.cpp | 3 ++-\n> >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > index 84758a811c27..13d4bce5c013 100644\n> > --- a/src/libcamera/v4l2_device.cpp\n> > +++ b/src/libcamera/v4l2_device.cpp\n> > @@ -341,8 +341,9 @@ void V4L2Device::listControls()\n> >  \t\t\tbreak;\n> >  \t\t/* \\todo Support compound controls. */\n> >  \t\tdefault:\n> > -\t\t\tLOG(V4L2, Error) << \"Control type '\" << info.type()\n> > +\t\t\tLOG(V4L2, Debug) << \"Control type '\" << info.type()\n> >  \t\t\t\t\t << \"' not supported\";\n> > +\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> >  \t\t\tcontinue;\n> >  \t\t}\n> >  \n\nWould the following (untested) change be a better solution, to avoid\nor'ing V4L2_CTRL_FLAG_NEXT_CTRL in multiple places ?\n\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 84758a811c27..f74c5b2aff02 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -321,13 +321,15 @@ void V4L2Device::listControls()\n \tstruct v4l2_query_ext_ctrl ctrl = {};\n\n \t/* \\todo Add support for menu and compound controls. */\n-\tctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;\n-\twhile (ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl) == 0) {\n+\twhile (1) {\n+\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n+\t\tint ret = ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl);\n+\t\tif (ret < 0)\n+\t\t\tbreak;\n+\n \t\tif (ctrl.type == V4L2_CTRL_TYPE_CTRL_CLASS ||\n-\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED) {\n-\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n+\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED)\n \t\t\tcontinue;\n-\t\t}\n\n \t\tV4L2ControlInfo info(ctrl);\n \t\tswitch (info.type()) {\n@@ -347,7 +349,6 @@ void V4L2Device::listControls()\n \t\t}\n\n \t\tcontrols_.emplace(ctrl.id, info);\n-\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n \t}\n }","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 A6FA06157F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Jun 2019 15:47:25 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0D027510;\n\tWed, 26 Jun 2019 15:47:25 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561556845;\n\tbh=uiW4/NP3PfwcANI+SsAFjOzTOEs8q8M2HK4sPAWJUFk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QKKcwwtFrQGM5EwDIYiYpVN3PkV8yEGpfRC4+IeDGLjRUOnLl6Qbfc4Rg7miu4lyk\n\tDst98VTPPWCQLY4jfZT9b3gH2GDr4T1X8IY8b8o34scq5beErvx0VpLcahDm5AsXvj\n\tLy5Vslx4huZehF3j06YbOsmF240KQrXnbkB63ddY=","Date":"Wed, 26 Jun 2019 16:44:57 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","Message-ID":"<20190626134457.GA5015@pendragon.ideasonboard.com>","References":"<20190626101308.19099-1-jacopo@jmondi.org>\n\t<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","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, 26 Jun 2019 13:47:25 -0000"}},{"id":2044,"web_url":"https://patchwork.libcamera.org/comment/2044/","msgid":"<20190627075128.nzvmnpsbezn2jx74@uno.localdomain>","date":"2019-06-27T07:51:28","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Wed, Jun 26, 2019 at 04:44:57PM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, Jun 26, 2019 at 11:17:23AM +0100, Kieran Bingham wrote:\n> > On 26/06/2019 11:13, Jacopo Mondi wrote:\n> > > When enumerating the available V4L2 controls at video device open\n>\n> s/video device/V4L2 device/\n>\n> > > time set the V4L2_CTRL_FLAG_NEXT_CTRL flag when hitting an unsupported\n> > > control type not to loop forever.\n> >\n> > \"set the V4L2_CTRL_FLAG_NEXT_CTRL flag if an unsupported control type is\n> > encountered to prevent infinite loops.\"\n> >\n> > > While at it, downgrade the message reporting the control type in not\n> >\n> > \"reporting the unsupported control type to Debug\"\n> >\n> >\n> > > supported to Debug, as it is not an error worth being reported\n> > > unconditionally.\n> > >\n> > > Fixes: 030ce6491ed3 (\"libcamera: v4l2_device: List valid controls at open\")\n> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> > > ---\n> > >  src/libcamera/v4l2_device.cpp | 3 ++-\n> > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > >\n> > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > > index 84758a811c27..13d4bce5c013 100644\n> > > --- a/src/libcamera/v4l2_device.cpp\n> > > +++ b/src/libcamera/v4l2_device.cpp\n> > > @@ -341,8 +341,9 @@ void V4L2Device::listControls()\n> > >  \t\t\tbreak;\n> > >  \t\t/* \\todo Support compound controls. */\n> > >  \t\tdefault:\n> > > -\t\t\tLOG(V4L2, Error) << \"Control type '\" << info.type()\n> > > +\t\t\tLOG(V4L2, Debug) << \"Control type '\" << info.type()\n> > >  \t\t\t\t\t << \"' not supported\";\n> > > +\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > >  \t\t\tcontinue;\n> > >  \t\t}\n> > >\n>\n> Would the following (untested) change be a better solution, to avoid\n> or'ing V4L2_CTRL_FLAG_NEXT_CTRL in multiple places ?\n\nIt is. I'll apply and merge. I assume I can ad your tag.\n\nThanks\n  j\n\n>\n> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> index 84758a811c27..f74c5b2aff02 100644\n> --- a/src/libcamera/v4l2_device.cpp\n> +++ b/src/libcamera/v4l2_device.cpp\n> @@ -321,13 +321,15 @@ void V4L2Device::listControls()\n>  \tstruct v4l2_query_ext_ctrl ctrl = {};\n>\n>  \t/* \\todo Add support for menu and compound controls. */\n> -\tctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;\n> -\twhile (ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl) == 0) {\n> +\twhile (1) {\n> +\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> +\t\tint ret = ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl);\n> +\t\tif (ret < 0)\n> +\t\t\tbreak;\n> +\n>  \t\tif (ctrl.type == V4L2_CTRL_TYPE_CTRL_CLASS ||\n> -\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED) {\n> -\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> +\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED)\n>  \t\t\tcontinue;\n> -\t\t}\n>\n>  \t\tV4L2ControlInfo info(ctrl);\n>  \t\tswitch (info.type()) {\n> @@ -347,7 +349,6 @@ void V4L2Device::listControls()\n>  \t\t}\n>\n>  \t\tcontrols_.emplace(ctrl.id, info);\n> -\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n>  \t}\n>  }\n>\n>\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1BDFC60BC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Jun 2019 09:50:16 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 5B3D9FF803;\n\tThu, 27 Jun 2019 07:50:13 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Thu, 27 Jun 2019 09:51:28 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190627075128.nzvmnpsbezn2jx74@uno.localdomain>","References":"<20190626101308.19099-1-jacopo@jmondi.org>\n\t<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>\n\t<20190626134457.GA5015@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"drzm4jq4aama625m\"","Content-Disposition":"inline","In-Reply-To":"<20190626134457.GA5015@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","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":"Thu, 27 Jun 2019 07:50:16 -0000"}},{"id":2045,"web_url":"https://patchwork.libcamera.org/comment/2045/","msgid":"<20190627080818.GA5021@pendragon.ideasonboard.com>","date":"2019-06-27T08:08:18","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Thu, Jun 27, 2019 at 09:51:28AM +0200, Jacopo Mondi wrote:\n> On Wed, Jun 26, 2019 at 04:44:57PM +0300, Laurent Pinchart wrote:\n> > On Wed, Jun 26, 2019 at 11:17:23AM +0100, Kieran Bingham wrote:\n> > > On 26/06/2019 11:13, Jacopo Mondi wrote:\n> > > > When enumerating the available V4L2 controls at video device open\n> >\n> > s/video device/V4L2 device/\n> >\n> > > > time set the V4L2_CTRL_FLAG_NEXT_CTRL flag when hitting an unsupported\n> > > > control type not to loop forever.\n> > >\n> > > \"set the V4L2_CTRL_FLAG_NEXT_CTRL flag if an unsupported control type is\n> > > encountered to prevent infinite loops.\"\n> > >\n> > > > While at it, downgrade the message reporting the control type in not\n> > >\n> > > \"reporting the unsupported control type to Debug\"\n> > >\n> > >\n> > > > supported to Debug, as it is not an error worth being reported\n> > > > unconditionally.\n> > > >\n> > > > Fixes: 030ce6491ed3 (\"libcamera: v4l2_device: List valid controls at open\")\n> > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > >\n> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > >\n> > > > ---\n> > > >  src/libcamera/v4l2_device.cpp | 3 ++-\n> > > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > > >\n> > > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > > > index 84758a811c27..13d4bce5c013 100644\n> > > > --- a/src/libcamera/v4l2_device.cpp\n> > > > +++ b/src/libcamera/v4l2_device.cpp\n> > > > @@ -341,8 +341,9 @@ void V4L2Device::listControls()\n> > > >  \t\t\tbreak;\n> > > >  \t\t/* \\todo Support compound controls. */\n> > > >  \t\tdefault:\n> > > > -\t\t\tLOG(V4L2, Error) << \"Control type '\" << info.type()\n> > > > +\t\t\tLOG(V4L2, Debug) << \"Control type '\" << info.type()\n> > > >  \t\t\t\t\t << \"' not supported\";\n> > > > +\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > > >  \t\t\tcontinue;\n> > > >  \t\t}\n> > > >\n> >\n> > Would the following (untested) change be a better solution, to avoid\n> > or'ing V4L2_CTRL_FLAG_NEXT_CTRL in multiple places ?\n> \n> It is. I'll apply and merge. I assume I can ad your tag.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > index 84758a811c27..f74c5b2aff02 100644\n> > --- a/src/libcamera/v4l2_device.cpp\n> > +++ b/src/libcamera/v4l2_device.cpp\n> > @@ -321,13 +321,15 @@ void V4L2Device::listControls()\n> >  \tstruct v4l2_query_ext_ctrl ctrl = {};\n> >\n> >  \t/* \\todo Add support for menu and compound controls. */\n> > -\tctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;\n> > -\twhile (ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl) == 0) {\n> > +\twhile (1) {\n> > +\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > +\t\tint ret = ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl);\n> > +\t\tif (ret < 0)\n> > +\t\t\tbreak;\n> > +\n> >  \t\tif (ctrl.type == V4L2_CTRL_TYPE_CTRL_CLASS ||\n> > -\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED) {\n> > -\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > +\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED)\n> >  \t\t\tcontinue;\n> > -\t\t}\n> >\n> >  \t\tV4L2ControlInfo info(ctrl);\n> >  \t\tswitch (info.type()) {\n> > @@ -347,7 +349,6 @@ void V4L2Device::listControls()\n> >  \t\t}\n> >\n> >  \t\tcontrols_.emplace(ctrl.id, info);\n> > -\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> >  \t}\n> >  }\n> >","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 242E060BC0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Jun 2019 10:08:38 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 85FC72AF;\n\tThu, 27 Jun 2019 10:08:37 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561622917;\n\tbh=s+tK9goCqGPQrO1DUJiCGSI7XcLOZqp35qe/y0EQ4Wg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rEA1igOu3E3c2+O862OoiyqE0ocYa6leotLWUNBzaC1XiXbBZudpj8C93LWt4/QC9\n\t8YUPkEx2LVaN/NCk9H7D7V4jcPoBfoPTIepAFmAD0h000SBTsngVqd3ja1abXyn4zJ\n\tOmOJVyxogxKFOU6Rx9XlN+WB4FMlVb40XtMHOMaE=","Date":"Thu, 27 Jun 2019 11:08:18 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190627080818.GA5021@pendragon.ideasonboard.com>","References":"<20190626101308.19099-1-jacopo@jmondi.org>\n\t<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>\n\t<20190626134457.GA5015@pendragon.ideasonboard.com>\n\t<20190627075128.nzvmnpsbezn2jx74@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190627075128.nzvmnpsbezn2jx74@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","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":"Thu, 27 Jun 2019 08:08:38 -0000"}},{"id":2046,"web_url":"https://patchwork.libcamera.org/comment/2046/","msgid":"<20190627081720.6h3rcittq452hrlh@uno.localdomain>","date":"2019-06-27T08:17:20","subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hello,\n\nOn Thu, Jun 27, 2019 at 11:08:18AM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> On Thu, Jun 27, 2019 at 09:51:28AM +0200, Jacopo Mondi wrote:\n> > On Wed, Jun 26, 2019 at 04:44:57PM +0300, Laurent Pinchart wrote:\n> > > On Wed, Jun 26, 2019 at 11:17:23AM +0100, Kieran Bingham wrote:\n> > > > On 26/06/2019 11:13, Jacopo Mondi wrote:\n> > > > > When enumerating the available V4L2 controls at video device open\n> > >\n> > > s/video device/V4L2 device/\n> > >\n> > > > > time set the V4L2_CTRL_FLAG_NEXT_CTRL flag when hitting an unsupported\n> > > > > control type not to loop forever.\n> > > >\n> > > > \"set the V4L2_CTRL_FLAG_NEXT_CTRL flag if an unsupported control type is\n> > > > encountered to prevent infinite loops.\"\n> > > >\n> > > > > While at it, downgrade the message reporting the control type in not\n> > > >\n> > > > \"reporting the unsupported control type to Debug\"\n> > > >\n> > > >\n> > > > > supported to Debug, as it is not an error worth being reported\n> > > > > unconditionally.\n> > > > >\n> > > > > Fixes: 030ce6491ed3 (\"libcamera: v4l2_device: List valid controls at open\")\n> > > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > >\n> > > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > >\n> > > > > ---\n> > > > >  src/libcamera/v4l2_device.cpp | 3 ++-\n> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)\n> > > > >\n> > > > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > > > > index 84758a811c27..13d4bce5c013 100644\n> > > > > --- a/src/libcamera/v4l2_device.cpp\n> > > > > +++ b/src/libcamera/v4l2_device.cpp\n> > > > > @@ -341,8 +341,9 @@ void V4L2Device::listControls()\n> > > > >  \t\t\tbreak;\n> > > > >  \t\t/* \\todo Support compound controls. */\n> > > > >  \t\tdefault:\n> > > > > -\t\t\tLOG(V4L2, Error) << \"Control type '\" << info.type()\n> > > > > +\t\t\tLOG(V4L2, Debug) << \"Control type '\" << info.type()\n> > > > >  \t\t\t\t\t << \"' not supported\";\n> > > > > +\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > > > >  \t\t\tcontinue;\n> > > > >  \t\t}\n> > > > >\n> > >\n> > > Would the following (untested) change be a better solution, to avoid\n> > > or'ing V4L2_CTRL_FLAG_NEXT_CTRL in multiple places ?\n> >\n> > It is. I'll apply and merge. I assume I can ad your tag.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n\nThanks, now pushed to master\n\n> > > diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\n> > > index 84758a811c27..f74c5b2aff02 100644\n> > > --- a/src/libcamera/v4l2_device.cpp\n> > > +++ b/src/libcamera/v4l2_device.cpp\n> > > @@ -321,13 +321,15 @@ void V4L2Device::listControls()\n> > >  \tstruct v4l2_query_ext_ctrl ctrl = {};\n> > >\n> > >  \t/* \\todo Add support for menu and compound controls. */\n> > > -\tctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;\n> > > -\twhile (ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl) == 0) {\n> > > +\twhile (1) {\n> > > +\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > > +\t\tint ret = ioctl(VIDIOC_QUERY_EXT_CTRL, &ctrl);\n> > > +\t\tif (ret < 0)\n> > > +\t\t\tbreak;\n> > > +\n> > >  \t\tif (ctrl.type == V4L2_CTRL_TYPE_CTRL_CLASS ||\n> > > -\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED) {\n> > > -\t\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > > +\t\t    ctrl.flags & V4L2_CTRL_FLAG_DISABLED)\n> > >  \t\t\tcontinue;\n> > > -\t\t}\n> > >\n> > >  \t\tV4L2ControlInfo info(ctrl);\n> > >  \t\tswitch (info.type()) {\n> > > @@ -347,7 +349,6 @@ void V4L2Device::listControls()\n> > >  \t\t}\n> > >\n> > >  \t\tcontrols_.emplace(ctrl.id, info);\n> > > -\t\tctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;\n> > >  \t}\n> > >  }\n> > >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1102560BC7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Jun 2019 10:16:07 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 6513E20000B;\n\tThu, 27 Jun 2019 08:16:06 +0000 (UTC)"],"Date":"Thu, 27 Jun 2019 10:17:20 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190627081720.6h3rcittq452hrlh@uno.localdomain>","References":"<20190626101308.19099-1-jacopo@jmondi.org>\n\t<81eec80b-8136-a0e8-214d-31c3d8a95b37@ideasonboard.com>\n\t<20190626134457.GA5015@pendragon.ideasonboard.com>\n\t<20190627075128.nzvmnpsbezn2jx74@uno.localdomain>\n\t<20190627080818.GA5021@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"6pbm62od5eya3esh\"","Content-Disposition":"inline","In-Reply-To":"<20190627080818.GA5021@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH] libcamera: v4l2_device: Fix control\n\tenumeration bug","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":"Thu, 27 Jun 2019 08:16:07 -0000"}}]