From f391048a7b987a149d0ba5421846b9b5ab916338 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 13 Oct 2019 22:22:04 +0300 Subject: libcamera: utils: Add hex stream output helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a utils::hex() function that simplifies writing hexadecimal values to an ostream. The function handles the '0x' prefix, the field width and the fill character automatically. Use it through the libcamera code base, and add a test. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libcamera/camera_sensor.cpp') diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 9e8b44a2..1b8e8c0e 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -14,6 +14,7 @@ #include #include "formats.h" +#include "utils.h" #include "v4l2_subdevice.h" /** @@ -79,9 +80,8 @@ int CameraSensor::init() if (entity_->function() != MEDIA_ENT_F_CAM_SENSOR) { LOG(CameraSensor, Error) - << "Invalid sensor function 0x" - << std::hex << std::setfill('0') << std::setw(8) - << entity_->function(); + << "Invalid sensor function " + << utils::hex(entity_->function()); return -EINVAL; } -- cgit v1.2.1