[libcamera-devel] [PATCH] libcamera: v4l2_subdevice: Report subdev device node on logs

Kieran Bingham kieran.bingham at ideasonboard.com
Thu May 6 14:05:23 CEST 2021


The V4L2 Video device logs the deviceNode() as part of it's logging
prefix, but the Subdevices have not been updated in the same way.

There have been several occasions while debugging remotely, where users
would benefit from knowing which subdevice node is referenced by the
CameraSensor in the messages being printed, and adding it aligns the
output of the Video class with the Subdevice class.

This patch adds the /dev/v4l-subdev1 style string to the log message as
demonstrated here (from a fictitious additional log message):

[88:39:36.684494647] [969224]  INFO V4L2 v4l2_subdevice.cpp:436 /dev/v4l-subdev1: 'Sensor B': Setting Format
[88:36:13.308244848] [968664] DEBUG V4L2 v4l2_videodevice.cpp:1450 /dev/video6[22:cap]: Queueing buffer 0

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---

Yes, this makes the lines longer ;-( which makes me a little sad, but
aligns the two V4L2 types, and helps users find their device nodes when
needed/debugging...

 src/libcamera/v4l2_subdevice.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index 721ff5a92a2b..fd464b0481aa 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -461,7 +461,7 @@ V4L2Subdevice::fromEntityName(const MediaDevice *media,
 
 std::string V4L2Subdevice::logPrefix() const
 {
-	return "'" + entity_->name() + "'";
+	return deviceNode() + ": '" + entity_->name() + "'";
 }
 
 std::vector<unsigned int> V4L2Subdevice::enumPadCodes(unsigned int pad)
-- 
2.25.1



More information about the libcamera-devel mailing list