Patch Detail
Show a patch.
GET /api/1.1/patches/361/?format=api
{ "id": 361, "url": "https://patchwork.libcamera.org/api/1.1/patches/361/?format=api", "web_url": "https://patchwork.libcamera.org/patch/361/", "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": "<20190124101651.9993-7-laurent.pinchart@ideasonboard.com>", "date": "2019-01-24T10:16:47", "name": "[libcamera-devel,06/10] libcamera: camera: Add disconnection notification", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "409684100c4356c2d2f1d6099c5779eb6af29dbb", "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/361/mbox/", "series": [ { "id": 125, "url": "https://patchwork.libcamera.org/api/1.1/series/125/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=125", "date": "2019-01-24T10:16:41", "name": "Hotplug support and object lifetime management", "version": 1, "mbox": "https://patchwork.libcamera.org/series/125/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/361/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/361/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 1434D60C78\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Jan 2019 11:16:59 +0100 (CET)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9F93E2F6;\n\tThu, 24 Jan 2019 11:16:58 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548325018;\n\tbh=dXJtiLCzeEV9BXGfV2fAU3jxX0gG+Iy4PAbEtXvexUA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=P8Nls5QbgheKbdTElALSRjRjGXnUzc8vUVyxLg6lq0I16yBj6yeI8X7PMNzRGAPpa\n\tvHbX82WpzHt4Q/CYPkwRSX5fMn0zP470JdqLDFSNhgopwgqIq2iaGCZfZkhaXibHzy\n\tw93JKBqYvlPC29Sv0vsUcPR0ZYKW5f29JnPjDPBY=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 24 Jan 2019 12:16:47 +0200", "Message-Id": "<20190124101651.9993-7-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.19.2", "In-Reply-To": "<20190124101651.9993-1-laurent.pinchart@ideasonboard.com>", "References": "<20190124101651.9993-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 06/10] libcamera: camera: Add\n\tdisconnection notification", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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, 24 Jan 2019 10:17:00 -0000" }, "content": "From: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nAs camera object have the potential to outlive the hardware they\nrepresent, there is a need to inform the camera that the underlying\ndevice has been disconnected, and in turn to notify applications.\n\nImplement a disconnection notification mechanism that can be used by\npipeline handlers to notify the camera of disconnection. The camera then\nblock all new API calls and emit the disconnected signal.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/camera.h | 7 +++++++\n src/libcamera/camera.cpp | 31 +++++++++++++++++++++++++++++++\n 2 files changed, 38 insertions(+)", "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex efafb9e28c56..a2ded62de948 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -10,6 +10,8 @@\n #include <memory>\n #include <string>\n \n+#include <libcamera/signal.h>\n+\n namespace libcamera {\n \n class PipelineHandler;\n@@ -25,10 +27,15 @@ public:\n \n \tconst std::string &name() const;\n \n+\tSignal<Camera *> disconnected;\n+\n private:\n \tCamera(PipelineHandler *pipe, const std::string &name);\n \t~Camera();\n \n+\tfriend class PipelineHandler;\n+\tvoid disconnect();\n+\n \tstd::shared_ptr<PipelineHandler> pipe_;\n \tstd::string name_;\n };\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 3a531c7e4d8f..9cec289282e4 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -34,6 +34,8 @@\n \n namespace libcamera {\n \n+LOG_DECLARE_CATEGORY(Camera)\n+\n /**\n * \\class Camera\n * \\brief Camera device\n@@ -87,6 +89,18 @@ const std::string &Camera::name() const\n \treturn name_;\n }\n \n+/**\n+ * \\var Camera::disconnected\n+ * \\brief Signal emitted when the camera is disconnected from the system\n+ *\n+ * This signal is emitted when libcamera detects that the cameera has been\n+ * removed from the system. For hot-pluggable devices this is usually caused by\n+ * physical device disconnection. The media device is passed as a parameter.\n+ *\n+ * As soon as this signal is emitted the camera instance will refuse all new\n+ * application API calls by returning errors immediately.\n+ */\n+\n Camera::Camera(PipelineHandler *pipe, const std::string &name)\n \t: pipe_(pipe->shared_from_this()), name_(name)\n {\n@@ -96,4 +110,21 @@ Camera::~Camera()\n {\n }\n \n+/**\n+ * \\brief Notify camera disconnection\n+ *\n+ * This method is used to notify the camera instance that the underlying\n+ * hardware has been unplugged. In response to the disconnection the camera\n+ * instance notifies the application by emitting the #disconnected signal, and\n+ * ensures that all new calls to the application-facing Camera API return an\n+ * error immediately.\n+ */\n+void Camera::disconnect()\n+{\n+\tLOG(Camera, Debug) << \"Disconnecting camera \" << name_;\n+\n+\t/** \\todo Block API calls when they will be implemented. */\n+\tdisconnected.emit(this);\n+}\n+\n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "06/10" ] }