@@ -583,6 +583,16 @@ ControlInfo V4L2Device::v4l2MenuControlInfo(const struct v4l2_query_ext_ctrl &ct
indices.push_back(index);
}
+ /*
+ * Some faulty UVC drivers are known to return an empty menu control.
+ * In that event, populate the indicies with the default value only.
+ */
+ if (indices.size() == 0) {
+ LOG(V4L2, Debug)
+ << "Menu control '" << ctrl.name << "' has no entries";
+ indices.push_back(static_cast<int32_t>(ctrl.default_value));
+ }
+
return ControlInfo(indices,
ControlValue(static_cast<int32_t>(ctrl.default_value)));
}
Some UVC cameras have been identified that can provide V4L2 menu controls without any menu items. This leads to a segfault where we try to construct a ControlInfo(Span<>,default) with an empty span. Returning ControlInfo(); instead results in a Fatal log error due to the control validation failing. Provide the default value as the only acceptable menu control item, and report the issue on the debug log. Bug: https://bugs.libcamera.org/show_bug.cgi?id=167 Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- src/libcamera/v4l2_device.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+)