summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2020-02-17 23:48:11 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-02-19 10:32:22 +0000
commitb0f1307fcfbb95519cdf19ac63dfd650d3fe5256 (patch)
tree6e4fd6b512e7bd793d049375be7187a5dc9ac0f9
parent90240a79506a3c400f3af4cb0b08746ae87c79e2 (diff)
libcamera: media_device: Use Loggable interface
Extend MediaDevice to inherit from the Loggable interface to support a logPrefix which presents the device node path, and the driver name. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/include/media_device.h6
-rw-r--r--src/libcamera/media_device.cpp5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h
index 7b88e287..44a59e70 100644
--- a/src/libcamera/include/media_device.h
+++ b/src/libcamera/include/media_device.h
@@ -16,11 +16,12 @@
#include <libcamera/signal.h>
+#include "log.h"
#include "media_object.h"
namespace libcamera {
-class MediaDevice
+class MediaDevice : protected Loggable
{
public:
MediaDevice(const std::string &deviceNode);
@@ -52,6 +53,9 @@ public:
Signal<MediaDevice *> disconnected;
+protected:
+ std::string logPrefix() const;
+
private:
std::string driver_;
std::string deviceNode_;
diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index 2c095566..0d6b5efd 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -75,6 +75,11 @@ MediaDevice::~MediaDevice()
clear();
}
+std::string MediaDevice::logPrefix() const
+{
+ return deviceNode() + "[" + driver() + "]";
+}
+
/**
* \brief Claim a device for exclusive use
*