Patch Detail
Show a patch.
GET /api/patches/10193/?format=api
{ "id": 10193, "url": "https://patchwork.libcamera.org/api/patches/10193/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10193/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201021210539.536155-1-kieran.bingham@ideasonboard.com>", "date": "2020-10-21T21:05:39", "name": "[libcamera-devel,v2] simple-cam: Use friendly camera names", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "6ad89dc70973d20410527e00169567a58635579e", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": { "id": 11, "url": "https://patchwork.libcamera.org/api/users/11/?format=api", "username": "kbingham", "first_name": "Kieran", "last_name": "Bingham", "email": "kieran.bingham@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/10193/mbox/", "series": [ { "id": 1402, "url": "https://patchwork.libcamera.org/api/series/1402/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1402", "date": "2020-10-21T21:05:39", "name": "[libcamera-devel,v2] simple-cam: Use friendly camera names", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1402/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10193/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10193/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 E0610BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Oct 2020 21:05:44 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6D59460530;\n\tWed, 21 Oct 2020 23:05:44 +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 D86EE60357\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Oct 2020 23:05:42 +0200 (CEST)", "from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5848EBB5;\n\tWed, 21 Oct 2020 23:05:42 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"uc16x8/O\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603314342;\n\tbh=DMgPPDOMCbMb8dYq5+8P9cvjhhHE5lRWc3KUpT+10UY=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=uc16x8/OqbObaynfnXGH8o/BGN/V+sYkKzovJa3aBuN5UkKesmZjK8NzFkeDQJ0OG\n\tf+ttryztek5y0FrJf7GAIV/9xxva/hobGwedxEbKYjXtCr3vf9KpPv/H2rEZJKdSJ2\n\t5hV/h+NOzlEISptWmkoo8U7bJK10emSFBL/U2SNM=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Wed, 21 Oct 2020 22:05:39 +0100", "Message-Id": "<20201021210539.536155-1-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2] simple-cam: Use friendly camera names", "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": "Take the example code for generating a camera name from 'cam' and use\nit when reporting cameras within the simple-cam application.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n simple-cam.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 44 insertions(+), 3 deletions(-)", "diff": "diff --git a/simple-cam.cpp b/simple-cam.cpp\nindex 727bb6d86480..e62eddf0c8c9 100644\n--- a/simple-cam.cpp\n+++ b/simple-cam.cpp\n@@ -60,6 +60,47 @@ static void requestComplete(Request *request)\n \tcamera->queueRequest(request);\n }\n \n+/*\n+ * ----------------------------------------------------------------------------\n+ * Camera Naming.\n+ *\n+ * Applications are responsible for deciding how to name cameras, and present\n+ * that information to the users. Every camera has a unique identifier, though\n+ * this string is not designed to be friendly for a human reader.\n+ *\n+ * To support human consumable names, libcamera provides camera properties\n+ * that allow an application to determine a naming scheme based on its needs.\n+ *\n+ * In this example, we focus on the location property, but also detail the\n+ * model string for external cameras, as this is more likely to be visible\n+ * information to the user of an externally connected device.\n+ *\n+ * The unique camera ID is appended for informative purposes.\n+ */\n+std::string cameraName(libcamera::Camera *camera)\n+{\n+\tconst ControlList &props = camera->properties();\n+\tstd::string name;\n+\n+\tswitch (props.get(properties::Location)) {\n+\tcase properties::CameraLocationFront:\n+\t\tname = \"Internal front camera\";\n+\t\tbreak;\n+\tcase properties::CameraLocationBack:\n+\t\tname = \"Internal back camera\";\n+\t\tbreak;\n+\tcase properties::CameraLocationExternal:\n+\t\tname = \"External camera\";\n+\t\tif (props.contains(properties::Model))\n+\t\t\tname += \" '\" + props.get(properties::Model) + \"'\";\n+\t\tbreak;\n+\t}\n+\n+\tname += \" (\" + camera->id() + \")\";\n+\n+\treturn name;\n+}\n+\n int main()\n {\n \t/*\n@@ -77,11 +118,11 @@ int main()\n \tcm->start();\n \n \t/*\n-\t * Just as a test, list all id's of the Camera registered in the\n-\t * system. They are indexed by name by the CameraManager.\n+\t * Just as a test, generate names of the Cameras registered in the\n+\t * system, and list them.\n \t */\n \tfor (auto const &camera : cm->cameras())\n-\t\tstd::cout << camera->id() << std::endl;\n+\t\tstd::cout << \" - \" << cameraName(camera.get()) << std::endl;\n \n \t/*\n \t * --------------------------------------------------------------------\n", "prefixes": [ "libcamera-devel", "v2" ] }