Show a patch.

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

{
    "id": 2081,
    "url": "https://patchwork.libcamera.org/api/patches/2081/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2081/",
    "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": "<20191003152037.74617-6-jacopo@jmondi.org>",
    "date": "2019-10-03T15:20:37",
    "name": "[libcamera-devel,5/5] ipa: vimc: Add support for test back channel",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6d3ef4a9fe5164d562a06b098b5e887f63eb6589",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2081/mbox/",
    "series": [
        {
            "id": 515,
            "url": "https://patchwork.libcamera.org/api/series/515/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=515",
            "date": "2019-10-03T15:20:32",
            "name": "test: Add IPA interface test support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/515/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2081/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2081/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C197561915\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 17:19:06 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 5C52AC0004;\n\tThu,  3 Oct 2019 15:19:06 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  3 Oct 2019 17:20:37 +0200",
        "Message-Id": "<20191003152037.74617-6-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191003152037.74617-1-jacopo@jmondi.org>",
        "References": "<20191003152037.74617-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 5/5] ipa: vimc: Add support for test back\n\tchannel",
        "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>",
        "X-List-Received-Date": "Thu, 03 Oct 2019 15:19:07 -0000"
    },
    "content": "Add support to the dummy VIMC IPA for communication with the IPA\ninterface test unit.\n\nUse the test channel, if available, to send a confirmation code when\nthe init() operation is called.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/ipa/ipa_vimc.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 54 insertions(+)",
    "diff": "diff --git a/src/ipa/ipa_vimc.cpp b/src/ipa/ipa_vimc.cpp\nindex abc06e7f5fd5..781f5796b082 100644\n--- a/src/ipa/ipa_vimc.cpp\n+++ b/src/ipa/ipa_vimc.cpp\n@@ -7,20 +7,74 @@\n \n #include <iostream>\n \n+#include <fcntl.h>\n+#include <string.h>\n+#include <sys/stat.h>\n+#include <unistd.h>\n+\n #include <ipa/ipa_interface.h>\n #include <ipa/ipa_module_info.h>\n \n namespace libcamera {\n \n+/* Keep these in sync with the IPA Interface test unit. */\n+static const char *vimcFifoPath = \"/tmp/vimc_ipa_fifo\";\n+#define IPA_INIT_CODE 0x01\n+\n class IPAVimc : public IPAInterface\n {\n public:\n+\tIPAVimc();\n+\t~IPAVimc();\n+\n \tint init();\n+\n+private:\n+\tunsigned int fd_;\n };\n \n+IPAVimc::IPAVimc()\n+\t: fd_(0)\n+{\n+\t/* Set up the test unit back-channel, if available. */\n+\tstruct stat fifoStat;\n+\tint ret = stat(vimcFifoPath, &fifoStat);\n+\tif (ret)\n+\t\treturn;\n+\n+\tret = ::open(vimcFifoPath, O_WRONLY);\n+\tif (ret < 0) {\n+\t\tstd::cerr << \"Failed to open vimc IPA test fifo at: \"\n+\t\t\t  << vimcFifoPath << \": \" << strerror(errno)\n+\t\t\t  << std::endl;\n+\t\treturn;\n+\t}\n+\tfd_ = ret;\n+}\n+\n+IPAVimc::~IPAVimc()\n+{\n+\tif (fd_)\n+\t\t::close(fd_);\n+}\n+\n int IPAVimc::init()\n {\n \tstd::cout << \"initializing vimc IPA!\" << std::endl;\n+\n+\tif (!fd_)\n+\t\treturn 0;\n+\n+\tint8_t data = IPA_INIT_CODE;\n+\tint ret = ::write(fd_, &data, 1);\n+\tif (ret < 0) {\n+\t\tret = -errno;\n+\t\tstd::cerr << \"Failed to write to vimc IPA test fifo at: \"\n+\t\t\t  << vimcFifoPath << \": \" << strerror(-ret)\n+\t\t\t  << std::endl;\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "5/5"
    ]
}