Show a patch.

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

{
    "id": 736,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/736/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/736/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190314155106.30106-2-jacopo@jmondi.org>",
    "date": "2019-03-14T15:51:03",
    "name": "[libcamera-devel,v3,1/4] libcamera: formats: Add toString() methods",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "1b18481f0a9176cbe6c9b0ec62713ae4e94dece6",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/736/mbox/",
    "series": [
        {
            "id": 207,
            "url": "https://patchwork.libcamera.org/api/1.1/series/207/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=207",
            "date": "2019-03-14T15:51:02",
            "name": "libcamera: ipu3: Pre-ImgU support",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/207/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/736/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/736/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B0A20600CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Mar 2019 16:50:37 +0100 (CET)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 48F3E100005;\n\tThu, 14 Mar 2019 15:50:37 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 14 Mar 2019 16:51:03 +0100",
        "Message-Id": "<20190314155106.30106-2-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190314155106.30106-1-jacopo@jmondi.org>",
        "References": "<20190314155106.30106-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 1/4] libcamera: formats: Add toString()\n\tmethods",
        "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": "Thu, 14 Mar 2019 15:50:37 -0000"
    },
    "content": "Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice\nformat.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\n---\nv2->v3:\n- remove planes and mbus code hex code length\n- TODO: clarify the format formatting\n\n---\n src/libcamera/include/v4l2_device.h    |  2 ++\n src/libcamera/include/v4l2_subdevice.h |  2 ++\n src/libcamera/v4l2_device.cpp          | 18 ++++++++++++++++++\n src/libcamera/v4l2_subdevice.cpp       | 18 ++++++++++++++++++\n 4 files changed, 40 insertions(+)\n\n--\n2.21.0",
    "diff": "diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\nindex 5c379fac66dc..258deee8d461 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -100,6 +100,8 @@ public:\n \t\tuint32_t bpl;\n \t} planes[3];\n \tunsigned int planesCount;\n+\n+\tconst std::string toString() const;\n };\n\n class V4L2Device : protected Loggable\ndiff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex 1cc0fab73103..700e66bcddac 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -21,6 +21,8 @@ struct V4L2SubdeviceFormat {\n \tuint32_t mbus_code;\n \tuint32_t width;\n \tuint32_t height;\n+\n+\tconst std::string toString() const;\n };\n\n class V4L2Subdevice : protected Loggable\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex a88a5f5ff036..127140b24314 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -6,6 +6,8 @@\n  */\n\n #include <fcntl.h>\n+#include <iomanip>\n+#include <sstream>\n #include <string.h>\n #include <sys/ioctl.h>\n #include <sys/mman.h>\n@@ -223,6 +225,22 @@ LOG_DEFINE_CATEGORY(V4L2)\n  * \\brief The number of valid data planes\n  */\n\n+/**\n+ * \\brief Assemble and return a string describing the format\n+ *\n+ * \\return A string describing the V4L2DeviceFormat\n+ */\n+const std::string V4L2DeviceFormat::toString() const\n+{\n+\tstd::stringstream ss;\n+\n+\tss.fill(0);\n+\tss << width << \"x\" << height << \"- 0x\" << std::hex\n+\t   << std::setw(8) << fourcc;\n+\n+\treturn ss.str();\n+}\n+\n /**\n  * \\class V4L2Device\n  * \\brief V4L2Device object and API\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 5f58904bf9e6..eb60fe42bb4e 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -6,6 +6,8 @@\n  */\n\n #include <fcntl.h>\n+#include <iomanip>\n+#include <sstream>\n #include <string.h>\n #include <sys/ioctl.h>\n #include <unistd.h>\n@@ -69,6 +71,22 @@ LOG_DEFINE_CATEGORY(V4L2Subdev)\n  * \\brief The image height in pixels\n  */\n\n+/**\n+ * \\brief Assemble and return a string describing the format\n+ *\n+ * \\return A string describing the V4L2SubdeviceFormat\n+ */\n+const std::string V4L2SubdeviceFormat::toString() const\n+{\n+\tstd::stringstream ss;\n+\n+\tss.fill(0);\n+\tss << width << \"x\" << height << \" - 0x\" << std::hex << std::setw(4)\n+\t   << mbus_code;\n+\n+\treturn ss.str();\n+}\n+\n /**\n  * \\class V4L2Subdevice\n  * \\brief A V4L2 subdevice as exposed by the Linux kernel\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "1/4"
    ]
}