[{"id":24948,"web_url":"https://patchwork.libcamera.org/comment/24948/","msgid":"<166245695106.4009730.10571428298069854743@Monstersaurus>","date":"2022-09-06T09:35:51","subject":"Re: [libcamera-devel] [PATCH 3/3] pipeline: uvcvideo: Fail match()\n\tif the camera has no supported format","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart via libcamera-devel (2022-09-03 19:10:37)\n> A UVC device could expose only formats that are not supported by\n> libcamera. The pipeline handler doesn't currently consider this as an\n> error, and happily creates a camera. The camera won't be usable, and\n> worse, generateConfiguration() and validate() will crash as those\n> functions assume that at least one format is supported.\n> \n> Fix this by failing match() if none of the formats exposed by the camera\n> are supported. Log an error message in that case to notify the user.\n\nThis seems quite reasonble to me. I suspect it's worth waiting for some\ntested by tags from Christian before merging, but with that:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=145\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 7 +++++++\n>  1 file changed, 7 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> index be0fbaea508a..a28195450634 100644\n> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> @@ -457,6 +457,13 @@ int UVCCameraData::init(MediaDevice *media)\n>                 }\n>         }\n>  \n> +       if (formats_.empty()) {\n> +               LOG(UVC, Error)\n> +                       << \"Camera \" << id_ << \" (\" << media->model()\n> +                       << \") doesn't expose any supported format\";\n> +               return -EINVAL;\n> +       }\n> +\n>         /* Populate the camera properties. */\n>         properties_.set(properties::Model, utils::toAscii(media->model()));\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\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 8F8E8C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Sep 2022 09:35:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DB54D6207E;\n\tTue,  6 Sep 2022 11:35:54 +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 D860B6203B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Sep 2022 11:35:53 +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 5711F25B;\n\tTue,  6 Sep 2022 11:35:53 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662456954;\n\tbh=LRs4gki5E/QTtEnQtEm20cxXQ4eViGHOWbYAhD2+Rzk=;\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=VXVH5+coVx/wAPTr/qBrYFtBWXvBbc70wksdP0RlnS9rmMsPWV9xCUDEf6HGSKkyt\n\tDBBFZ/RxwzRbOalD7e7d2vdaP9eTqPAST9uZxlbai5f8C2zTZPAWG8ODMGi3DQ4gBV\n\t0qZyvfc3s0uVIXAUK0w5YJX/OoTCnWujvJlX0Q0GytnAQCp7kwq1oFaeDGEA04eO/e\n\tkEmsZUBVQwOS5w35OG00eyKUKds2fm5bzGyfshw4CPSSPdsS5bG/ErXL6rm+/JoTtV\n\tHBBxPVur1VyFvnUO2E8R0vhqiD0mu20uPIqU/g+xSC09b6F+JWPRT78EFgjVKlD9la\n\ttcKCM7LCzcv0g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662456953;\n\tbh=LRs4gki5E/QTtEnQtEm20cxXQ4eViGHOWbYAhD2+Rzk=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=uuW0llOoqXPMHKkp9FcFebeWYsHYJ4Xpb/0apfrDNIS1d89wpL8sUHAw+rCCS68Zb\n\tOQ5hn68ATS5XQGrVdHsw5nUnxng8p2PYQk88HBOrPi88tospW9A+LSc7MwOWaI6RtC\n\tlWJY0pibf3WorcJ21fezngdfB9nzyd2QaWJR2qaA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uuW0llOo\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220903181037.1406-4-laurent.pinchart@ideasonboard.com>","References":"<20220903181037.1406-1-laurent.pinchart@ideasonboard.com>\n\t<20220903181037.1406-4-laurent.pinchart@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 06 Sep 2022 10:35:51 +0100","Message-ID":"<166245695106.4009730.10571428298069854743@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH 3/3] pipeline: uvcvideo: Fail match()\n\tif the camera has no supported format","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>"}},{"id":24949,"web_url":"https://patchwork.libcamera.org/comment/24949/","msgid":"<YxdRv1OAJk/exP41@pendragon.ideasonboard.com>","date":"2022-09-06T13:57:19","subject":"Re: [libcamera-devel] [PATCH 3/3] pipeline: uvcvideo: Fail match()\n\tif the camera has no supported format","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Sep 06, 2022 at 10:35:51AM +0100, Kieran Bingham wrote:\n> Quoting Laurent Pinchart via libcamera-devel (2022-09-03 19:10:37)\n> > A UVC device could expose only formats that are not supported by\n> > libcamera. The pipeline handler doesn't currently consider this as an\n> > error, and happily creates a camera. The camera won't be usable, and\n> > worse, generateConfiguration() and validate() will crash as those\n> > functions assume that at least one format is supported.\n> > \n> > Fix this by failing match() if none of the formats exposed by the camera\n> > are supported. Log an error message in that case to notify the user.\n> \n> This seems quite reasonble to me. I suspect it's worth waiting for some\n> tested by tags from Christian before merging, but with that:\n\nI would prefer that, although I've successfully tested the series with a\ncamera that produces the V4L2 GREY format. Disabling that format in\nlibcamera made the pipeline handler crash, this series fixed it. I'll\nwait one more day and merge.\n\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > Bug: https://bugs.libcamera.org/show_bug.cgi?id=145\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 7 +++++++\n> >  1 file changed, 7 insertions(+)\n> > \n> > diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > index be0fbaea508a..a28195450634 100644\n> > --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp\n> > @@ -457,6 +457,13 @@ int UVCCameraData::init(MediaDevice *media)\n> >                 }\n> >         }\n> >  \n> > +       if (formats_.empty()) {\n> > +               LOG(UVC, Error)\n> > +                       << \"Camera \" << id_ << \" (\" << media->model()\n> > +                       << \") doesn't expose any supported format\";\n> > +               return -EINVAL;\n> > +       }\n> > +\n> >         /* Populate the camera properties. */\n> >         properties_.set(properties::Model, utils::toAscii(media->model()));\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 8716DC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Sep 2022 13:57:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E0C876206A;\n\tTue,  6 Sep 2022 15:57:36 +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 29EB86041F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Sep 2022 15:57:35 +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 8459725B;\n\tTue,  6 Sep 2022 15:57:34 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662472656;\n\tbh=CaiZslsgwwgYJ0MaB5dgtLRLyHSXcjWc76p04RxpdMY=;\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=n37MCvEfJ4bJBddDyZg13xvlPuJek0t9wpNrOuWKvsKw+8BfeJqSVTjC2UFN6lfP8\n\tPNqziw/OVuAtRqj+N6t0jk/bE1rTIfGrejriDrwVTLKq9PGGwrUTzYwRkZ7ejhoolk\n\tRgEWsy41wc8Hf0EmGPhHljPfoGINaVyvidQowA5yyYbz72tws2ThGiFNyAG7l+qZDN\n\tGO0yHTzvrQKd2f+5tm9419pyXWQlg1LVVeVH3aZbnVcumEA/DIIbuB1bThePmKNBhy\n\tnPeXhxvBLMR28oGfKJ3B5rUs9nQFhtn8X5DliGSSf8yrrX2zm5/2JMEFU6s2qVcybY\n\tedMPoRjFMU6zw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662472654;\n\tbh=CaiZslsgwwgYJ0MaB5dgtLRLyHSXcjWc76p04RxpdMY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oOwDlAvOX9pGXSWwc8WddIcMhXEf4rzR18gv7PUsk9ZOGFOC0JUNo1i12GVKWwUD0\n\tUesLilVLbjoEBBz/S0o2WnwH0w9rr4EEnSkuBcOJ0Zu9MNzwbNRQoeOxKAMnniovaZ\n\ttYB7aAh12170vtdfOSaU76voLvoeB9r5pccBO1fk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"oOwDlAvO\"; dkim-atps=neutral","Date":"Tue, 6 Sep 2022 16:57:19 +0300","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YxdRv1OAJk/exP41@pendragon.ideasonboard.com>","References":"<20220903181037.1406-1-laurent.pinchart@ideasonboard.com>\n\t<20220903181037.1406-4-laurent.pinchart@ideasonboard.com>\n\t<166245695106.4009730.10571428298069854743@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<166245695106.4009730.10571428298069854743@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH 3/3] pipeline: uvcvideo: Fail match()\n\tif the camera has no supported format","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>"}}]