libcamera: utils: Add hex stream output helper
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user