Show a patch.

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

{
    "id": 4067,
    "url": "https://patchwork.libcamera.org/api/patches/4067/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4067/",
    "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": "<20200616194523.23268-4-email@uajain.com>",
    "date": "2020-06-16T19:45:36",
    "name": "[libcamera-devel,v5,3/6] libcamera: device_enumerator: Emit a signal when new devices are added",
    "commit_ref": "dd21ededd0fe9dede5942b0b68c45d43f1d671bd",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "1dab71380f6cfeaa9981bf92ec66060b0bead51b",
    "submitter": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/people/1/?format=api",
        "name": "Umang Jain",
        "email": "email@uajain.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4067/mbox/",
    "series": [
        {
            "id": 1009,
            "url": "https://patchwork.libcamera.org/api/series/1009/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1009",
            "date": "2020-06-16T19:45:33",
            "name": "Introduce UVC hotplugging support",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/1009/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4067/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4067/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<bounces+15657259-5c31-libcamera-devel=lists.libcamera.org@em7280.uajain.com>",
        "Received": [
            "from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2FE32603C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Jun 2020 21:45:37 +0200 (CEST)",
            "by filterdrecv-p3mdw1-6f5df8956d-25bh4 with SMTP id\n\tfilterdrecv-p3mdw1-6f5df8956d-25bh4-19-5EE9215F-8E\n\t2020-06-16 19:45:35.945609367 +0000 UTC m=+1121503.543881372",
            "from mail.uajain.com (unknown)\n\tby ismtpd0006p1maa1.sendgrid.net (SG) with ESMTP\n\tid XTwDqPMGS7G7f7OK3HfI6Q Tue, 16 Jun 2020 19:45:35.587 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=uajain.com\n\theader.i=@uajain.com header.b=\"homrzrVG\"; \n\tdkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:\n\tcontent-transfer-encoding:content-type;\n\ts=s1; bh=HRIMNLA7LvCcjxKSj7EXJEBLwqsw622/8tZpTpXIiKM=;\n\tb=homrzrVG/mTYqN/OmKYyECq7uVt5vEiNFrn+W1sch0AZjSw2r+SKH45QvssyrFeA7TCq\n\tCsOzXN8fVnGhAwC45bIB/lWwAPubJvMSvRcxX3DRMTeEF99OMRAZOqSgjvtXfSrKNauEM+\n\trluRWLw/2STQ7IV5ueU7qQJ0+qYXnPD6s=",
        "From": "Umang Jain <email@uajain.com>",
        "Date": "Tue, 16 Jun 2020 19:45:36 +0000 (UTC)",
        "Message-Id": "<20200616194523.23268-4-email@uajain.com>",
        "In-Reply-To": "<20200616194523.23268-1-email@uajain.com>",
        "References": "<20200616194523.23268-1-email@uajain.com>",
        "Mime-Version": "1.0",
        "X-SG-EID": "1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPclKwCK9CCZVFbQyNjpl2ex/ZeUGECgJ3/kvYxMJpVbVxe/Y/bRHUQZ5dpXE55Cw1MNGLVQWvLoPv8rSaooLH+nGSNa6CPFgOK7Yjxd+EUHlr644WwKjA53nU4vA/woL4axWn10SvFqkEmXfz2XqV4gVeyU/sYXFE8anC/rJtZfRYPOS+ihC5P5NwkWV0LuZWctpXcKf4PkCsyKTp8QzMbEA==",
        "To": "laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com,\n\tlibcamera-devel@lists.libcamera.org",
        "Content-Transfer-Encoding": "7bit",
        "Content-Type": "text/plain; charset=us-ascii",
        "Subject": "[libcamera-devel] [PATCH v5 3/6] libcamera: device_enumerator: Emit\n\ta signal when new devices are added",
        "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": "Tue, 16 Jun 2020 19:45:38 -0000"
    },
    "content": "Emit a signal whenever new MediaDevices are added to the\nDeviceEnumerator. This will allow CameraManager to be notified\nabout the new devices and it can re-emumerate all the devices\ncurrently present on the system.\n\nDevice enumeration by the CameraManger is an expensive operation hence,\nwe want one signal emission per 'x' milliseconds to notify multiple\ndevices additions as a single batch, by the DeviceEnumerator.\nAdd a \\todo to investigate the support for that.\n\nSigned-off-by: Umang Jain <email@uajain.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/internal/device_enumerator.h |  4 ++++\n src/libcamera/camera_manager.cpp               |  4 ++--\n src/libcamera/device_enumerator.cpp            | 13 +++++++++++++\n 3 files changed, 19 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h\nindex 25a3630..a985040 100644\n--- a/include/libcamera/internal/device_enumerator.h\n+++ b/include/libcamera/internal/device_enumerator.h\n@@ -13,6 +13,8 @@\n \n #include <linux/media.h>\n \n+#include <libcamera/signal.h>\n+\n namespace libcamera {\n \n class MediaDevice;\n@@ -43,6 +45,8 @@ public:\n \n \tstd::shared_ptr<MediaDevice> search(const DeviceMatch &dm);\n \n+\tSignal<> devicesAdded;\n+\n protected:\n \tstd::unique_ptr<MediaDevice> createDevice(const std::string &deviceNode);\n \tvoid addDevice(std::unique_ptr<MediaDevice> &&media);\ndiff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex de6d5d8..3082797 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -155,12 +155,12 @@ void CameraManager::Private::createPipelineHandlers()\n \t\t}\n \t}\n \n-\t/* \\todo Register hot-plug callback here */\n+\tenumerator_->devicesAdded.connect(this, &Private::createPipelineHandlers);\n }\n \n void CameraManager::Private::cleanup()\n {\n-\t/* \\todo Unregister hot-plug callback here */\n+\tenumerator_->devicesAdded.disconnect(this, &Private::createPipelineHandlers);\n \n \t/*\n \t * Release all references to cameras to ensure they all get destroyed\ndiff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\nindex e21a2a7..647974b 100644\n--- a/src/libcamera/device_enumerator.cpp\n+++ b/src/libcamera/device_enumerator.cpp\n@@ -227,6 +227,16 @@ std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(const std::string &d\n \treturn media;\n }\n \n+/**\n+* \\var DeviceEnumerator::devicesAdded\n+* \\brief Notify of new media devices being found\n+*\n+* This signal is emitted when the device enumerator finds new media devices in\n+* the system. It may be emitted for every newly detected device, or once for\n+* multiple devices, at the discretion of the device enumerator. Not all device\n+* enumerator types may support dynamic detection of new devices.\n+*/\n+\n /**\n  * \\brief Add a media device to the enumerator\n  * \\param[in] media media device instance to add\n@@ -242,6 +252,9 @@ void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> &&media)\n \t\t<< \"Added device \" << media->deviceNode() << \": \" << media->driver();\n \n \tdevices_.push_back(std::move(media));\n+\n+\t/* \\todo To batch multiple additions, emit with a small delay here. */\n+\tdevicesAdded.emit();\n }\n \n /**\n",
    "prefixes": [
        "libcamera-devel",
        "v5",
        "3/6"
    ]
}