From patchwork Thu Jan 24 10:16:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 360 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B198260C78 for ; Thu, 24 Jan 2019 11:16:58 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4832E23A; Thu, 24 Jan 2019 11:16:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1548325018; bh=jiQk+fOuv06fpKtb2EcywkAZQi4ALqLUV3NMZst7JDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JR5YIoO4JRFlcblEcgxwEnKvE9zUhVO5vubEjvIZm3JUX7z9Nn1jvDb3NuRoOvXXx sD/R1ZVyi/2K6aQP/tDnS2aLpHI1x6I4SQxguptO0/st1jZlYUguRvyShgMs7WByRb gXy8LuCEOhCBTBDtAzJqFamHj0W0rp4zrzlheTJ8= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Thu, 24 Jan 2019 12:16:46 +0200 Message-Id: <20190124101651.9993-6-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 Subject: [libcamera-devel] [PATCH 05/10] libcamera: media_device: Add disconnected signal X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2019 10:16:58 -0000 The signal is emitted when the hardware device corresponding to the media device is unplugged. This will trigger the full unplug handling chain. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/include/media_device.h | 4 ++++ src/libcamera/media_device.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h index 8a7b9489faa9..27a2b46a4392 100644 --- a/src/libcamera/include/media_device.h +++ b/src/libcamera/include/media_device.h @@ -14,6 +14,8 @@ #include +#include + #include "media_object.h" namespace libcamera { @@ -48,6 +50,8 @@ public: MediaLink *link(const MediaPad *source, const MediaPad *sink); int disableLinks(); + Signal disconnected; + private: std::string driver_; std::string deviceNode_; diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 51e5088ebdd9..be81bd8c4c23 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -427,6 +427,16 @@ int MediaDevice::disableLinks() return 0; } +/** + * \var MediaDevice::disconnected + * \brief Signal emitted when the media device is disconnected from the system + * + * This signal is emitted when the device enumerator detects that the media + * device has been removed from the system. For hot-pluggable devices this is + * usually caused by physical device disconnection, but can also result from + * driver unloading for most devices. The media device is passed as a parameter. + */ + /** * \var MediaDevice::objects_ * \brief Global map of media objects (entities, pads, links) keyed by their