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:
@@ -549,8 +549,7 @@ const ControlValue &ControlList::get(unsigned int id) const
|
||||
const auto ctrl = idmap_->find(id);
|
||||
if (ctrl == idmap_->end()) {
|
||||
LOG(Controls, Error)
|
||||
<< std::hex << std::setfill('0')
|
||||
<< "Control 0x" << std::setw(8) << id
|
||||
<< "Control " << utils::hex(id)
|
||||
<< " is not supported";
|
||||
return zero;
|
||||
}
|
||||
@@ -579,8 +578,7 @@ void ControlList::set(unsigned int id, const ControlValue &value)
|
||||
const auto ctrl = idmap_->find(id);
|
||||
if (ctrl == idmap_->end()) {
|
||||
LOG(Controls, Error)
|
||||
<< std::hex << std::setfill('0')
|
||||
<< "Control 0x" << std::setw(8) << id
|
||||
<< "Control 0x" << utils::hex(id)
|
||||
<< " is not supported";
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user