Show a patch.

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

{
    "id": 2482,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2482/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2482/",
    "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": "<20200102000306.633-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-01-02T00:03:06",
    "name": "[libcamera-devel] libcamera: pipeline: uvcvideo: Fix crash when default entity is not found",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ab8939ed1c9b984931d8a7a3562a294c7136de38",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2482/mbox/",
    "series": [
        {
            "id": 596,
            "url": "https://patchwork.libcamera.org/api/1.1/series/596/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=596",
            "date": "2020-01-02T00:03:06",
            "name": "[libcamera-devel] libcamera: pipeline: uvcvideo: Fix crash when default entity is not found",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/596/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2482/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2482/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F3B860467\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jan 2020 01:03:19 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 18F20516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Jan 2020 01:03:19 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1577923399;\n\tbh=FUxKMBA5/jyqMZ6vz1tALeTShye0Jx9bBDQuNkJ9hz0=;\n\th=From:To:Subject:Date:From;\n\tb=Ur6B6wuodbM8BuU7tV9oVCzhRWtPEGZgLYi5qQ6dQR5SOebeTlIvEMXJ+I1X888K8\n\tzExax4kQrl+UMujYaVsihwU618/PNVUSfk/rQCchI+zE+dtUcwPErSnM8A9jYDTjZ6\n\tOd/cgRFiwPF3/6wjnZ9CekRQz7pFmtLvhk3Bmn9U=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  2 Jan 2020 02:03:06 +0200",
        "Message-Id": "<20200102000306.633-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] libcamera: pipeline: uvcvideo: Fix crash\n\twhen default entity is not found",
        "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, 02 Jan 2020 00:03:19 -0000"
    },
    "content": "Commit e441f2c7f46d (\"libcamera: pipeline: uvcvideo: Add controls\nsupport\") broke handling of UVC devices without a default entity by\nturning the error check into an always false check. Fix it.\n\nFixes: e441f2c7f46d (\"libcamera: pipeline: uvcvideo: Add controls support\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/uvcvideo.cpp | 18 +++++++++---------\n 1 file changed, 9 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 3043366bee38..8d7f7ea79410 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -296,19 +296,19 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n \tstd::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this);\n \n \t/* Locate and initialise the camera data with the default video node. */\n-\tfor (MediaEntity *entity : media->entities()) {\n-\t\tif (entity->flags() & MEDIA_ENT_FL_DEFAULT) {\n-\t\t\tif (data->init(entity))\n-\t\t\t\treturn false;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\tif (!data) {\n+\tconst std::vector<MediaEntity *> &entities = media->entities();\n+\tauto entity = std::find_if(entities.begin(), entities.end(),\n+\t\t\t\t   [](MediaEntity *entity) {\n+\t\t\t\t\treturn entity->flags() & MEDIA_ENT_FL_DEFAULT;\n+\t\t\t\t   });\n+\tif (entity == entities.end()) {\n \t\tLOG(UVC, Error) << \"Could not find a default video device\";\n \t\treturn false;\n \t}\n \n+\tif (data->init(*entity))\n+\t\treturn false;\n+\n \t/* Create and register the camera. */\n \tstd::set<Stream *> streams{ &data->stream_ };\n \tstd::shared_ptr<Camera> camera = Camera::create(this, media->model(), streams);\n",
    "prefixes": [
        "libcamera-devel"
    ]
}