Show a patch.

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

{
    "id": 354,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/354/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/354/",
    "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": "<20190123150351.8307-3-niklas.soderlund@ragnatech.se>",
    "date": "2019-01-23T15:03:51",
    "name": "[libcamera-devel,2/2] libcamera: pipeline: uvcvideo: create a V4L2Device for the default video entity",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8eac895c353c7ea7c171d3bb8bfb37f281e942e3",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/354/mbox/",
    "series": [
        {
            "id": 124,
            "url": "https://patchwork.libcamera.org/api/1.1/series/124/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=124",
            "date": "2019-01-23T15:03:49",
            "name": "libcamera: pipeline: uvcvideo: attach to a V4L2Device",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/124/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/354/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/354/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 B964560B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 16:04:01 +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 10805d3c-1f20-11e9-911a-0050569116f7;\n\tWed, 23 Jan 2019 16:03:38 +0100 (CET)"
        ],
        "X-Halon-ID": "10805d3c-1f20-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": "Wed, 23 Jan 2019 16:03:51 +0100",
        "Message-Id": "<20190123150351.8307-3-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190123150351.8307-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190123150351.8307-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] libcamera: pipeline: uvcvideo: create\n\ta V4L2Device for the default video entity",
        "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": "Wed, 23 Jan 2019 15:04:02 -0000"
    },
    "content": "Add a V4L2Device for the default video entity in the media graph. The\nUVC pipeline needs to search for the entity marked with the\nMEDIA_ENT_FL_DEFAULT flag as the entity names in the media graph varies\ndepending on which device is used.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/uvcvideo.cpp | 26 +++++++++++++++++++++++++-\n 1 file changed, 25 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex b56ee9881239abdc..f853105f50a958a3 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -12,6 +12,7 @@\n #include \"log.h\"\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n+#include \"v4l2_device.h\"\n \n namespace libcamera {\n \n@@ -31,15 +32,21 @@ public:\n \n private:\n \tMediaDevice *dev_;\n+\tV4L2Device *v4l2dev_;\n };\n \n PipelineHandlerUVC::PipelineHandlerUVC()\n-\t: dev_(nullptr)\n+\t: dev_(nullptr), v4l2dev_(nullptr)\n {\n }\n \n PipelineHandlerUVC::~PipelineHandlerUVC()\n {\n+\tif (v4l2dev_) {\n+\t\tv4l2dev_->close();\n+\t\tdelete v4l2dev_;\n+\t}\n+\n \tif (dev_)\n \t\tdev_->release();\n }\n@@ -83,6 +90,23 @@ bool PipelineHandlerUVC::match(CameraManager *manager, DeviceEnumerator *enumera\n \n \tdev_->acquire();\n \n+\tfor (MediaEntity *entity : dev_->entities()) {\n+\t\tif (!(entity->flags() & MEDIA_ENT_FL_DEFAULT))\n+\t\t\tcontinue;\n+\n+\t\tv4l2dev_ = new V4L2Device(*entity);\n+\n+\t\tif (v4l2dev_->open())\n+\t\t\tdelete v4l2dev_;\n+\n+\t\tbreak;\n+\t}\n+\n+\tif (!v4l2dev_) {\n+\t\tdev_->release();\n+\t\treturn false;\n+\t}\n+\n \tstd::shared_ptr<Camera> camera = Camera::create(this, dev_->model());\n \tregisterCamera(manager, std::move(camera));\n \n",
    "prefixes": [
        "libcamera-devel",
        "2/2"
    ]
}