{"id":10532,"url":"https://patchwork.libcamera.org/api/patches/10532/?format=json","web_url":"https://patchwork.libcamera.org/patch/10532/","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":"<20201201174314.12774-3-email@uajain.com>","date":"2020-12-01T17:43:12","name":"[libcamera-devel,v2,2/4] simple-cam: Early return if no cameras are found on the system.","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"0744a6e76852840f6330e0a4fab2d1cc0ce119fc","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/10532/mbox/","series":[{"id":1498,"url":"https://patchwork.libcamera.org/api/series/1498/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1498","date":"2020-12-01T17:43:10","name":"simple-cam: Provide event-loop backed by libevent","version":2,"mbox":"https://patchwork.libcamera.org/series/1498/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10532/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10532/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 315F6BE177\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Dec 2020 17:43:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F300263501;\n\tTue,  1 Dec 2020 18:43:28 +0100 (CET)","from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B46D063507\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Dec 2020 18:43:26 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"Z0hx+GmP\"; dkim-atps=neutral","From":"Umang Jain <email@uajain.com>","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1606844606; bh=YAuSE3bVoLNbDSNWm9ijG9eds7l5IqipAYA/Mq5598E=;\n\th=From:To:Cc:Subject:In-Reply-To:References;\n\tb=Z0hx+GmP3FYr8pa3Z3IBJkgzZc+iuuurhBesf/hfFlpJ6Dd3kg7d+L3mUzyVpf6KT\n\tXAH32pJNk5J/FwIRjgC+0CYU+S/1xoRIModw8mEbOYcF9BqNxThL9x1fp87vZlUGj7\n\tjueVxyUrMN1MaQ/Jfa5x6VDG6bx2rTP84COhb6V5RKIqKxnRQsE14xjesK2YL8Fuyx\n\tTXlfXiZgftBD6sQbkDpnhEj63ec9kOlMX1Y9YkXWgFJndzYZA8Bl9Olh6xOahxN9IH\n\t+nZzcjrFsEmXG2TVxvPeQ5HV9gQrdzA1RBW5/p30fZwmth8plg8z3PWKssVDawf6Ic\n\tEdjwLvSfiIhDQ==","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  1 Dec 2020 23:13:12 +0530","Message-Id":"<20201201174314.12774-3-email@uajain.com>","In-Reply-To":"<20201201174314.12774-1-email@uajain.com>","References":"<20201201174314.12774-1-email@uajain.com>","Mime-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 2/4] simple-cam: Early return if no\n\tcameras are found on the system.","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=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Failing to do so, the codepath will segfault while trying to acquire\na non-existent camera.\n\nSigned-off-by: Umang Jain <email@uajain.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n simple-cam.cpp | 7 +++++++\n 1 file changed, 7 insertions(+)","diff":"diff --git a/simple-cam.cpp b/simple-cam.cpp\nindex e88fb85..f844ff4 100644\n--- a/simple-cam.cpp\n+++ b/simple-cam.cpp\n@@ -307,6 +307,13 @@ int main()\n \tfor (std::unique_ptr<Request> &request : requests)\n \t\tcamera->queueRequest(request.get());\n \n+\tif(!cm->cameras().size()) {\n+\t\tstd::cout << \"No cameras were identified on the system.\"\n+\t\t\t  << std::endl;\n+\t\tcm->stop();\n+\t\treturn EXIT_FAILURE;\n+\t}\n+\n \t/*\n \t * --------------------------------------------------------------------\n \t * Run an EventLoop\n","prefixes":["libcamera-devel","v2","2/4"]}