@@ -9,6 +9,7 @@
#include <string>
+#include "log.h"
#include "media_object.h"
namespace libcamera {
@@ -21,7 +22,7 @@ struct V4L2SubdeviceFormat {
uint32_t height;
};
-class V4L2Subdevice
+class V4L2Subdevice : protected Loggable
{
public:
explicit V4L2Subdevice(const MediaEntity *entity);
@@ -41,6 +42,9 @@ public:
int getFormat(unsigned int pad, V4L2SubdeviceFormat *format);
int setFormat(unsigned int pad, V4L2SubdeviceFormat *format);
+protected:
+ std::string logPrefix() const { return "'" + deviceName() + "'"; }
+
private:
int setSelection(unsigned int pad, unsigned int target,
Rectangle *rect);
@@ -196,7 +196,7 @@ int V4L2Subdevice::getFormat(unsigned int pad, V4L2SubdeviceFormat *format)
ret = -errno;
LOG(V4L2Subdev, Error)
<< "Unable to get format on pad " << pad
- << " of " << deviceNode() << ": " << strerror(-ret);
+ << ": " << strerror(-ret);
return ret;
}
@@ -231,7 +231,8 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)
if (ret) {
ret = -errno;
LOG(V4L2Subdev, Error)
- << "Unable to set format: " << strerror(-ret);
+ << "Unable to set format on pad " << pad
+ << ": " << strerror(-ret);
return ret;
}
@@ -262,8 +263,7 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,
ret = -errno;
LOG(V4L2Subdev, Error)
<< "Unable to set rectangle " << target << " on pad "
- << pad << " of " << deviceNode() << ": "
- << strerror(-ret);
+ << pad << ": " << strerror(-ret);
return ret;
}