summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
*