Show a patch.

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

{
    "id": 9156,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/9156/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9156/",
    "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": "<20200803211733.1037019-3-niklas.soderlund@ragnatech.se>",
    "date": "2020-08-03T21:17:26",
    "name": "[libcamera-devel,v6,2/9] libcamera: device_enumerator_udev: Add specialization for sysfs path",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4927eb4f768a5f99d0bad063658eae0c2a4f990e",
    "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/9156/mbox/",
    "series": [
        {
            "id": 1185,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1185/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1185",
            "date": "2020-08-03T21:17:24",
            "name": "libcamera: Generate unique and stable camera IDs",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/1185/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9156/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9156/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 5BC47BD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Aug 2020 21:18:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 10E6A61AC7;\n\tMon,  3 Aug 2020 23:18:04 +0200 (CEST)",
            "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 5E8BA60398\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Aug 2020 23:18:00 +0200 (CEST)",
            "from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de\n\t[84.172.82.168]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 9cd2dc61-d5ce-11ea-86ee-0050569116f7;\n\tMon, 03 Aug 2020 23:16:36 +0200 (CEST)"
        ],
        "X-Halon-ID": "9cd2dc61-d5ce-11ea-86ee-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": "Mon,  3 Aug 2020 23:17:26 +0200",
        "Message-Id": "<20200803211733.1037019-3-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.28.0",
        "In-Reply-To": "<20200803211733.1037019-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200803211733.1037019-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v6 2/9] libcamera: device_enumerator_udev:\n\tAdd specialization for sysfs path",
        "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>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "As udev may rename the V4L2 devices in /dev add a specialization that\nasks udev for the sysfs path instead of using the default method that\nmakes the assumption that V4L2 devices are never renamed.\n\nSuggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n .../internal/device_enumerator_udev.h         |  2 ++\n src/libcamera/device_enumerator_udev.cpp      | 24 +++++++++++++++++++\n 2 files changed, 26 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h\nindex 6f45be0c1c423d02..595b16acb89d98bb 100644\n--- a/include/libcamera/internal/device_enumerator_udev.h\n+++ b/include/libcamera/internal/device_enumerator_udev.h\n@@ -35,6 +35,8 @@ public:\n \tint init();\n \tint enumerate();\n \n+\tstd::string lookupSysfsPath(const std::string &deviceNode);\n+\n private:\n \tusing DependencyMap = std::map<dev_t, std::list<MediaEntity *>>;\n \ndiff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex 96689daa5dd113dc..2e43b84f62e0333d 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -14,6 +14,7 @@\n #include <map>\n #include <string.h>\n #include <sys/ioctl.h>\n+#include <sys/stat.h>\n #include <sys/sysmacros.h>\n #include <unistd.h>\n \n@@ -193,6 +194,29 @@ done:\n \treturn 0;\n }\n \n+std::string DeviceEnumeratorUdev::lookupSysfsPath(const std::string &deviceNode)\n+{\n+\tstruct stat st;\n+\tint ret = stat(deviceNode.c_str(), &st);\n+\tif (ret < 0) {\n+\t\tLOG(DeviceEnumerator, Error)\n+\t\t\t<< \"Unable to stat '\" << deviceNode << \"'\";\n+\t\treturn {};\n+\t}\n+\n+\tstruct udev_device *dev = udev_device_new_from_devnum(udev_, 'c',\n+\t\t\t\t\t\t\t      st.st_rdev);\n+\tif (!dev) {\n+\t\tLOG(DeviceEnumerator, Error)\n+\t\t\t<< \"Unable to make device from devnum \" << st.st_rdev;\n+\t\treturn {};\n+\t}\n+\n+\tstd::string path{ udev_device_get_syspath(dev) };\n+\tudev_device_unref(dev);\n+\treturn path;\n+}\n+\n int DeviceEnumeratorUdev::populateMediaDevice(MediaDevice *media, DependencyMap *deps)\n {\n \tstd::set<dev_t> children;\n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "2/9"
    ]
}