Show a patch.

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

{
    "id": 2833,
    "url": "https://patchwork.libcamera.org/api/patches/2833/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2833/",
    "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": "<20200214123715.13026-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-02-14T12:37:15",
    "name": "[libcamera-devel] libcamera: device_enumerator: Don't stop if one device fails",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "248c9672dbaf4c2eecbc048ed6580849624f3116",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2833/mbox/",
    "series": [
        {
            "id": 674,
            "url": "https://patchwork.libcamera.org/api/series/674/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=674",
            "date": "2020-02-14T12:37:15",
            "name": "[libcamera-devel] libcamera: device_enumerator: Don't stop if one device fails",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/674/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2833/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2833/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 B3840607E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Feb 2020 13:37:35 +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 369D2504\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Feb 2020 13:37:35 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1581683855;\n\tbh=w45EtP4DPwzSPcx/KavL5KKeGPmnHtt572Z4NRB6KsI=;\n\th=From:To:Subject:Date:From;\n\tb=O7IL355D7PhGVWO3cdhvBhnQg2IY9/iBjiZCr1KcuiwvDgyZIyUvBJxN43J+GRTPD\n\t7JqEik9BeThh2VQJkZZtz2VRV9ef6phrYoy9U2D2QXN8sZNDexuxe59bG4sBbqPdTv\n\t4AWvMjQTdKIKWydnjoSWWYZks3uH0gpPehaC8XGc=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 14 Feb 2020 14:37:15 +0200",
        "Message-Id": "<20200214123715.13026-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: device_enumerator: Don't stop\n\tif one device fails",
        "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": "Fri, 14 Feb 2020 12:37:35 -0000"
    },
    "content": "If one device fails to enumerate, which isn't supposed to happen under\nnormal conditions, both the sysfs and the udev enumerators stop\nenumeration of further devices. This potentially prevents working\ndevices from being detected and handled. Fix it by skipping the faulty\ndevice.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/device_enumerator_sysfs.cpp | 15 +++++++--------\n src/libcamera/device_enumerator_udev.cpp  |  8 +++++---\n 2 files changed, 12 insertions(+), 11 deletions(-)",
    "diff": "diff --git a/src/libcamera/device_enumerator_sysfs.cpp b/src/libcamera/device_enumerator_sysfs.cpp\nindex ad26affb38a3..bde736226f95 100644\n--- a/src/libcamera/device_enumerator_sysfs.cpp\n+++ b/src/libcamera/device_enumerator_sysfs.cpp\n@@ -33,7 +33,6 @@ int DeviceEnumeratorSysfs::enumerate()\n {\n \tstruct dirent *ent;\n \tDIR *dir;\n-\tint ret = 0;\n \n \tstatic const char * const sysfs_dirs[] = {\n \t\t\"/sys/subsystem/media/devices\",\n@@ -74,14 +73,14 @@ int DeviceEnumeratorSysfs::enumerate()\n \t\t}\n \n \t\tstd::shared_ptr<MediaDevice> media = createDevice(devnode);\n-\t\tif (!media) {\n-\t\t\tret = -ENODEV;\n-\t\t\tbreak;\n-\t\t}\n+\t\tif (!media)\n+\t\t\tcontinue;\n \n \t\tif (populateMediaDevice(media) < 0) {\n-\t\t\tret = -ENODEV;\n-\t\t\tbreak;\n+\t\t\tLOG(DeviceEnumerator, Warning)\n+\t\t\t\t<< \"Failed to populate media device /dev/media\"\n+\t\t\t\t<< idx << \", skipping\";\n+\t\t\tcontinue;\n \t\t}\n \n \t\taddDevice(media);\n@@ -89,7 +88,7 @@ int DeviceEnumeratorSysfs::enumerate()\n \n \tclosedir(dir);\n \n-\treturn ret;\n+\treturn 0;\n }\n \n int DeviceEnumeratorSysfs::populateMediaDevice(const std::shared_ptr<MediaDevice> &media)\ndiff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex b2c5fd221dcd..3837aaf97e6a 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -145,10 +145,12 @@ int DeviceEnumeratorUdev::enumerate()\n \t\t\tgoto done;\n \t\t}\n \n-\t\tret = addUdevDevice(dev);\n+\t\tif (addUdevDevice(dev) < 0)\n+\t\t\tLOG(DeviceEnumerator, Warning)\n+\t\t\t\t<< \"Failed to add device for '\"\n+\t\t\t\t<< syspath << \"', skipping\";\n+\n \t\tudev_device_unref(dev);\n-\t\tif (ret < 0)\n-\t\t\tbreak;\n \t}\n \n done:\n",
    "prefixes": [
        "libcamera-devel"
    ]
}