{"id":11930,"url":"https://patchwork.libcamera.org/api/patches/11930/?format=json","web_url":"https://patchwork.libcamera.org/patch/11930/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210414141014.523762-1-niklas.soderlund@ragnatech.se>","date":"2021-04-14T14:10:14","name":"[libcamera-devel] lc-compliance: simple_capture: Handle unsupported roles","commit_ref":"b2cc8a2f57333f8aa818a7eb519124ce4594b8a2","pull_url":null,"state":"accepted","archived":false,"hash":"c8e2215e0c295013bebc1ceda1059fe173328133","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11930/mbox/","series":[{"id":1928,"url":"https://patchwork.libcamera.org/api/series/1928/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1928","date":"2021-04-14T14:10:14","name":"[libcamera-devel] lc-compliance: simple_capture: Handle unsupported roles","version":1,"mbox":"https://patchwork.libcamera.org/series/1928/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11930/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11930/checks/","tags":{},"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 4E09DBD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 14 Apr 2021 14:10:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19C5968814;\n\tWed, 14 Apr 2021 16:10:26 +0200 (CEST)","from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AC94968803\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 14 Apr 2021 16:10:24 +0200 (CEST)","from bismarck.berto.se (p54ac5521.dip0.t-ipconnect.de\n\t[84.172.85.33])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 231913a0-9d2b-11eb-a9ab-0050569116f7;\n\tWed, 14 Apr 2021 16:10:23 +0200 (CEST)"],"X-Halon-ID":"231913a0-9d2b-11eb-a9ab-0050569116f7","Authorized-sender":"niklas.soderlund@fsdn.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 14 Apr 2021 16:10:14 +0200","Message-Id":"<20210414141014.523762-1-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.31.1","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] lc-compliance: simple_capture: Handle\n\tunsupported roles","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>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"It's valid for a camera to return a nullptr if the requested set of\nroles can not be satisfied. This is not correctly handled by\nlc-compliance which instead crashes, fix this.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/lc-compliance/simple_capture.cpp | 3 +++\n 1 file changed, 3 insertions(+)","diff":"diff --git a/src/lc-compliance/simple_capture.cpp b/src/lc-compliance/simple_capture.cpp\nindex 811a6220009654be..64e862a08e3a8221 100644\n--- a/src/lc-compliance/simple_capture.cpp\n+++ b/src/lc-compliance/simple_capture.cpp\n@@ -23,6 +23,9 @@ Results::Result SimpleCapture::configure(StreamRole role)\n {\n \tconfig_ = camera_->generateConfiguration({ role });\n \n+\tif (!config_)\n+\t\treturn { Results::Skip, \"Role not supported by camera\" };\n+\n \tif (config_->validate() != CameraConfiguration::Valid) {\n \t\tconfig_.reset();\n \t\treturn { Results::Fail, \"Configuration not valid\" };\n","prefixes":["libcamera-devel"]}