Show a patch.

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

{
    "id": 25347,
    "url": "https://patchwork.libcamera.org/api/patches/25347/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25347/",
    "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": "<20251203-rzv2h-pre-v3-4-1493e0638626@ideasonboard.com>",
    "date": "2025-12-03T09:14:24",
    "name": "[v3,4/4] libcamera: V4L2Subdevice: Get device by regexp",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9852434e712ab8c5b34f8b6097cbef0fca57c5eb",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25347/mbox/",
    "series": [
        {
            "id": 5634,
            "url": "https://patchwork.libcamera.org/api/series/5634/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5634",
            "date": "2025-12-03T09:14:20",
            "name": "Use regular expressions for entity name matching",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5634/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25347/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25347/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F0ECFC32AF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Dec 2025 09:14:48 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1511A60F4A;\n\tWed,  3 Dec 2025 10:14:47 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AC6EC60D39\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Dec 2025 10:14:42 +0100 (CET)",
            "from [192.168.1.104] (net-93-65-100-155.cust.vodafonedsl.it\n\t[93.65.100.155])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F2EC71787;\n\tWed,  3 Dec 2025 10:12:27 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"X69rBGA+\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764753148;\n\tbh=hjahXNah1RbuUiN7aDtizRrX6Ko4xbWUknSuL9r6v+8=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=X69rBGA+WjyDyMzRgsncfA69F6ddE6XKC7Vve2XTjtA/yCdKnX7UhT1ivyitT2VmU\n\tVzOUR68lK64KdZyEjbvfW7O/V31TJpiQubQ6i93x4yUfe8KYXhF2Tq1VSebgbhnSek\n\tf9g0L/AIBijP9gt9DYCE7B5SNnn+HfrwHR6IUE44=",
        "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Date": "Wed, 03 Dec 2025 10:14:24 +0100",
        "Subject": "[PATCH v3 4/4] libcamera: V4L2Subdevice: Get device by regexp",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20251203-rzv2h-pre-v3-4-1493e0638626@ideasonboard.com>",
        "References": "<20251203-rzv2h-pre-v3-0-1493e0638626@ideasonboard.com>",
        "In-Reply-To": "<20251203-rzv2h-pre-v3-0-1493e0638626@ideasonboard.com>",
        "To": "Daniel Scally <dan.scally@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tStefan Klug <stefan.klug@ideasonboard.com>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=openpgp-sha256; l=3442;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=af7m13ES9de6oF4m50q/afkIeXZbh+NVBRixZ9gOgRE=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBpL/+ACEUPXWu3eN5Kk0rj7Kzi4bh3LUhhBXyjr\n\t8rLmGvias2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaS//gAAKCRByNAaPFqFW\n\tPKdoD/9j0IBsLPuGMzARAdbpzUapEyYt+ezgRqu0sL8CjSDcx8t6tH+OsyZCDKtmfxf/8FSwj5F\n\tA2EnZDnKfDsmfFKr+aTbF1Xwca96kVCEKDK6Do/6FeaW3RaY2tWPieIoCATTfEQWeejaIm1xrPv\n\twSnxJ0J7nOkXrcwKj9F9dEnp/orp0cYWxcfDpGdf139fRsfwpoqKPw8MhijEa3UWSkCi+1FaTtS\n\tjHNVBxIA/AqADq29kivVFZxlHJEgTJ7VLhNwXCvf3vJwC0rtAFKVriW2tqgHciGNbmgg7WbXlbc\n\t1wLwbVNN+VScJHtvUHc23mlxzlrLvbft2i3j+jsa4xIQhVzfArE6mXDmnz8z4NxrIuxpOCqL6lk\n\txoK6YtcNWZGoxfkTd8k9ofvNTPrZZ5efAkCZlDSDR8h8eopwb4CNrVvqvN8bmEK++1ZxPdGKhAu\n\tsRNFnwnbhQC+RH4lji5FTXXG/ZsOc9IaPPv1+zZa5AZ6+gd2SJUG3y/Cs6OMbCdyUQNQSyIuxWw\n\tTQg55/5/I0rhn1TdGuhQWAuCF5yw5xJSL3pxQZ2iPRuNucbHBeKi2OXltMaJQ1PvqVglaAuBOkL\n\tt/rLJkVmhH5g6WM7VBYaWmWO1XCnlP3bf4I6ifjPajfYvMQbblapqt2AzeyumqHVbX8eRChvQ0V\n\tTXsewSDtzpJI9sg==",
        "X-Developer-Key": "i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Daniel Scally <dan.scally@ideasonboard.com>\n\nSome kernel drivers give their entities names that will differ from\nimplementation to implementation; for example the drivers for the\nCamera Receiver Unit and CSI-2 receiver in the RZ/V2H(P) SoC give their\nentities names that include their memory address, in the format\n\"csi-16000400.csi2\". Passing that entity name to\nV4L2Subdevice::fromEntityName() is too inflexible given it would only\nthen work if that specific CSI-2 receiver were the one being used.\n\nAdd an overload for V4L2Subdevice::fromEntityName() to instead allow\nusers to pass a std::basic_regex, and use std::regex_search() instead\nof a direct string comparison to find a matching entity. Ths allows\nus to form regular expressions like \"csi-[0-9a-f]{8}.csi2\" to find\nthe entities.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_subdevice.h |  3 +++\n src/libcamera/v4l2_subdevice.cpp            | 19 ++++++++++++++++++-\n 2 files changed, 21 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex c1cde1df2e369101eee7ff351f14f81098ec597b..c37a82afa881db9566fa7a0bd8dbdfb0e9f029e8 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -18,6 +18,7 @@\n \n #include <libcamera/base/class.h>\n #include <libcamera/base/log.h>\n+#include <libcamera/base/regex.h>\n \n #include <libcamera/color_space.h>\n #include <libcamera/geometry.h>\n@@ -163,6 +164,8 @@ public:\n \n \tstatic std::unique_ptr<V4L2Subdevice>\n \tfromEntityName(const MediaDevice *media, const std::string &entity);\n+\tstatic std::unique_ptr<V4L2Subdevice>\n+\tfromEntityName(const MediaDevice *media, const std::regex &entity);\n \n protected:\n \tstd::string logPrefix() const override;\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex b75edffe762155e428e039b4884bed3d469ba751..199424600f582b918e7daa5b77fbec426c8b408c 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -1748,7 +1748,6 @@ const std::string &V4L2Subdevice::model()\n  * \\a media\n  * \\param[in] media The media device where the entity is registered\n  * \\param[in] entity The media entity name\n- *\n  * \\return A newly created V4L2Subdevice on success, nullptr otherwise\n  */\n std::unique_ptr<V4L2Subdevice>\n@@ -1762,6 +1761,24 @@ V4L2Subdevice::fromEntityName(const MediaDevice *media,\n \treturn std::make_unique<V4L2Subdevice>(mediaEntity);\n }\n \n+/**\n+ * \\brief Create a new video subdevice instance from an entity in media device\n+ * \\a media\n+ * \\param[in] media The media device where the entity is registered\n+ * \\param[in] entity A regex that will match the media entity's name\n+ * \\return A newly created V4L2Subdevice on success, nullptr otherwise\n+ */\n+std::unique_ptr<V4L2Subdevice>\n+V4L2Subdevice::fromEntityName(const MediaDevice *media,\n+\t\t\t      const std::regex &entity)\n+{\n+\tMediaEntity *mediaEntity = media->getEntityByName(entity);\n+\tif (!mediaEntity)\n+\t\treturn nullptr;\n+\n+\treturn std::make_unique<V4L2Subdevice>(mediaEntity);\n+}\n+\n std::string V4L2Subdevice::logPrefix() const\n {\n \treturn \"'\" + entity_->name() + \"'\";\n",
    "prefixes": [
        "v3",
        "4/4"
    ]
}