diff --git a/cscore/src/main/native/linux/UsbCameraProperty.cpp b/cscore/src/main/native/linux/UsbCameraProperty.cpp index 6976095e11..4f519767de 100644 --- a/cscore/src/main/native/linux/UsbCameraProperty.cpp +++ b/cscore/src/main/native/linux/UsbCameraProperty.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "UsbUtil.h" @@ -151,6 +152,9 @@ UsbCameraProperty::UsbCameraProperty(const struct v4l2_query_ext_ctrl& ctrl) propKind = CS_PROP_BOOLEAN; break; case V4L2_CTRL_TYPE_INTEGER_MENU: + propKind = CS_PROP_ENUM; + intMenu = true; + break; case V4L2_CTRL_TYPE_MENU: propKind = CS_PROP_ENUM; break; @@ -243,7 +247,12 @@ std::unique_ptr UsbCameraProperty::DeviceQuery(int fd, for (int i = prop->minimum; i <= prop->maximum; ++i) { qmenu.index = static_cast<__u32>(i); if (TryIoctl(fd, VIDIOC_QUERYMENU, &qmenu) != 0) continue; - prop->enumChoices[i] = reinterpret_cast(qmenu.name); + if (prop->intMenu) { + wpi::raw_string_ostream os(prop->enumChoices[i]); + os << qmenu.value; + } else { + prop->enumChoices[i] = reinterpret_cast(qmenu.name); + } } } diff --git a/cscore/src/main/native/linux/UsbCameraProperty.h b/cscore/src/main/native/linux/UsbCameraProperty.h index 446deab613..d3569cc117 100644 --- a/cscore/src/main/native/linux/UsbCameraProperty.h +++ b/cscore/src/main/native/linux/UsbCameraProperty.h @@ -71,6 +71,9 @@ class UsbCameraProperty : public PropertyImpl { unsigned id{0}; // implementation-level id int type{0}; // implementation type, not CS_PropertyKind! + + // If the enum property is integer rather than string + bool intMenu{false}; }; } // namespace cs