Show a patch.

GET /api/patches/108/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 108,
    "url": "https://patchwork.libcamera.org/api/patches/108/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/108/",
    "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": "<20181229033134.26927-1-niklas.soderlund@ragnatech.se>",
    "date": "2018-12-29T03:31:34",
    "name": "[libcamera-devel] cam-ctl: add utility to control cameras",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "d49f48e3b977a15a30f13e58641a95f78f84dd7d",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/108/mbox/",
    "series": [
        {
            "id": 42,
            "url": "https://patchwork.libcamera.org/api/series/42/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=42",
            "date": "2018-12-29T03:31:34",
            "name": "[libcamera-devel] cam-ctl: add utility to control cameras",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/42/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/108/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/108/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CBAF260B31\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Dec 2018 04:31:42 +0100 (CET)",
            "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 37df51c5-0b1a-11e9-911a-0050569116f7;\n\tSat, 29 Dec 2018 04:31:30 +0100 (CET)"
        ],
        "X-Halon-ID": "37df51c5-0b1a-11e9-911a-0050569116f7",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 29 Dec 2018 04:31:34 +0100",
        "Message-Id": "<20181229033134.26927-1-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] cam-ctl: add utility to control cameras",
        "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": "Sat, 29 Dec 2018 03:31:43 -0000"
    },
    "content": "Provide a utility to interact with cameras. This initial state is\nlimited and only supports listing cameras in the system and selecting a\ncamera to interact with.\n\nThere is not much a interacting possible yet with a camera so the tool\nsimply exercise the API to get and put a camera.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/cam-ctl/main.cpp    | 98 +++++++++++++++++++++++++++++++++++++++++\n src/cam-ctl/meson.build |  7 +++\n src/meson.build         |  1 +\n 3 files changed, 106 insertions(+)\n create mode 100644 src/cam-ctl/main.cpp\n create mode 100644 src/cam-ctl/meson.build\n\n---\n\nHi,\n\nI'm not sure this is ready to be merged but I thought it good to share \nit on the ML to avoid redoing the work as more pieces come together.",
    "diff": "diff --git a/src/cam-ctl/main.cpp b/src/cam-ctl/main.cpp\nnew file mode 100644\nindex 0000000000000000..0bf76cef3efc8741\n--- /dev/null\n+++ b/src/cam-ctl/main.cpp\n@@ -0,0 +1,98 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2018, Google Inc.\n+ *\n+ * main.cpp - cam-ctl a tool to interact with the library\n+ */\n+\n+#include <getopt.h>\n+#include <iostream>\n+#include <stdio.h>\n+#include <stdlib.h>\n+\n+#include <libcamera/libcamera.h>\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+enum Option {\n+\tOptCamera = 1,\n+\tOptList,\n+\tOptLast,\n+};\n+\n+static struct option long_options[] = {\n+\t{ \"camera\", required_argument, 0, 'c' },\n+\t{ \"list\", no_argument, 0, 'l' },\n+};\n+\n+char options[OptLast];\n+\n+void usage()\n+{\n+\tcout << \"Options:\" << endl;\n+\tcout << \"  --camera <camera>\" << endl;\n+\tcout << \"  --list\" << endl;\n+}\n+\n+int main(int argc, char **argv)\n+{\n+\tCameraManager *cm;\n+\tstring camera;\n+\n+\tif (argc == 1) {\n+\t\tusage();\n+\t\treturn 0;\n+\t}\n+\n+\twhile (1) {\n+\t\tint c, option_index = 0;\n+\n+\t\tc = getopt_long (argc, argv, \"c:l\", long_options, &option_index);\n+\n+\t\tif (c == -1)\n+\t\t\tbreak;\n+\n+\t\tswitch (c) {\n+\t\tcase 'c':\n+\t\t\toptions[OptCamera] = 1;\n+\t\t\tcamera = optarg;\n+\t\t\tbreak;\n+\t\tcase 'l':\n+\t\t\toptions[OptList] = 1;\n+\t\t\tbreak;\n+\t\tcase '?':\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tabort();\n+\t\t}\n+\t}\n+\n+\tcm = new CameraManager();\n+\tif (!cm)\n+\t\treturn -ENOMEM;\n+\n+\tcm->start();\n+\n+\tif (options[OptList]) {\n+\t\tfor (auto name : cm->list())\n+\t\t\tcout << \"- \" << name << endl;\n+\t}\n+\n+\tif (options[OptCamera]) {\n+\t\tCamera *cam = cm->get(camera);\n+\n+\t\tif (cam) {\n+\t\t\tcout << \"Using camera: \" << cam->name() << endl;\n+\t\t\tcam->put();\n+\t\t} else {\n+\t\t\tcout << \"Can't find camera '\" << camera << \"'\" << endl;\n+\t\t}\n+\t}\n+\n+\tcm->stop();\n+\n+\tdelete cm;\n+\n+\treturn 0;\n+}\ndiff --git a/src/cam-ctl/meson.build b/src/cam-ctl/meson.build\nnew file mode 100644\nindex 0000000000000000..7c27a19dae98fe96\n--- /dev/null\n+++ b/src/cam-ctl/meson.build\n@@ -0,0 +1,7 @@\n+cam_ctl_sources = files([\n+    'main.cpp',\n+])\n+\n+cam_ctl = executable('cam-ctl', cam_ctl_sources,\n+                       link_with : libcamera,\n+                       include_directories : libcamera_includes)\ndiff --git a/src/meson.build b/src/meson.build\nindex 4ce9668caa7b8997..86e5290e5e66eb68 100644\n--- a/src/meson.build\n+++ b/src/meson.build\n@@ -1 +1,2 @@\n subdir('libcamera')\n+subdir('cam-ctl')\n",
    "prefixes": [
        "libcamera-devel"
    ]
}