libcamera: media_device: Add disconnected signal

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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-01-24 01:04:09 +02:00
parent 4f043b05e7
commit 9d29af143b
2 changed files with 14 additions and 0 deletions

View file

@ -14,6 +14,8 @@
#include <linux/media.h>
#include <libcamera/signal.h>
#include "media_object.h"
namespace libcamera {
@ -48,6 +50,8 @@ public:
MediaLink *link(const MediaPad *source, const MediaPad *sink);
int disableLinks();
Signal<MediaDevice *> disconnected;
private:
std::string driver_;
std::string deviceNode_;

View file

@ -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