From patchwork Mon Feb 17 23:48:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2846 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BD94860438 for ; Tue, 18 Feb 2020 00:48:45 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 42C941220; Tue, 18 Feb 2020 00:48:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1581983325; bh=SzCyLoPsyF6IG+LfUI08UblQFptGhyVVlIPnwm7fqa4=; h=From:To:Cc:Subject:Date:From; b=XPtVhtlMxNcby+gQyMaCRKv+c0++1k4wjHXsiBxSTxMD3ePRmzt/kw8l588OD/tUL ecC1NPS2Q1QXIQAthx/aEg/Dh5g/1AGAriE46U/SOasOOiLArBvTk5p7mqKGq/o1vr qvcUbGyZcANdQ/TbowkbDcfB+9wrujkb+xOorK8o= From: Kieran Bingham To: libcamera devel Date: Mon, 17 Feb 2020 23:48:41 +0000 Message-Id: <20200217234841.16390-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: media_device: Use Loggable interface X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Feb 2020 23:48:45 -0000 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 Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/include/media_device.h | 6 +++++- src/libcamera/media_device.cpp | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h index 7b88e2875d59..44a59e70139e 100644 --- a/src/libcamera/include/media_device.h +++ b/src/libcamera/include/media_device.h @@ -16,11 +16,12 @@ #include +#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 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 e1ae34f88455..fad475b9ac76 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -74,6 +74,11 @@ MediaDevice::~MediaDevice() clear(); } +std::string MediaDevice::logPrefix() const +{ + return deviceNode() + "[" + driver() + "]"; +} + /** * \brief Claim a device for exclusive use *