@@ -823,19 +823,26 @@ void V4L2Device::updateControls(ControlList *ctrls,
ASSERT(iter != controls_.end());
switch (iter->first->type()) {
+ case ControlTypeByte:
+ value.set<uint8_t>(v4l2Ctrl.value);
+ break;
+ case ControlTypeUnsigned16:
+ value.set<uint16_t>(v4l2Ctrl.value);
+ break;
+ case ControlTypeInteger32:
+ value.set<int32_t>(v4l2Ctrl.value);
+ break;
+ case ControlTypeUnsigned32:
+ value.set<uint32_t>(v4l2Ctrl.value);
+ break;
case ControlTypeInteger64:
value.set<int64_t>(v4l2Ctrl.value64);
break;
-
default:
- /*
- * Note: this catches the ControlTypeInteger32 case.
- *
- * \todo To be changed when support for string controls
- * will be added.
- */
- value.set<int32_t>(v4l2Ctrl.value);
- break;
+ LOG(V4L2, Error)
+ << "Control " << utils::hex(id)
+ << " has unsupported type";
+ continue;
}
ctrls->set(id, value);
While `setControls()` uses the specific types, `updateControls()` converts everything to 32-bit integers (except 64-bit integers). This causes, for example, that a 16-bit unsigned integer is retrieved as `int32_t` even though there is a specific libcamera control type for it. What's even more surprising is that setting such a control requires a `ControlValue` with `uint16_t`, but when `setControls()` updates the list to contain the actually applied values, it will now have type `int32_t`. So make sure that `updateControls()` uses the appropriate type. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/libcamera/v4l2_device.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)