diff --git a/cscore/src/main/native/linux/UsbCameraImpl.cpp b/cscore/src/main/native/linux/UsbCameraImpl.cpp index cd3f2d1f0e..60421eb50d 100644 --- a/cscore/src/main/native/linux/UsbCameraImpl.cpp +++ b/cscore/src/main/native/linux/UsbCameraImpl.cpp @@ -140,6 +140,12 @@ int UsbCameraImpl::RawToPercentage(const UsbCameraProperty& rawProp, } return 100; } + // Arducam OV9281 exposure setting quirk + if (m_ov9281_exposure && rawProp.name == "raw_exposure_absolute" && + rawProp.minimum == 1 && rawProp.maximum == 5000) { + // real range is 1-75 + return 100.0 * (rawValue - 1) / (75 - 1); + } return 100.0 * (rawValue - rawProp.minimum) / (rawProp.maximum - rawProp.minimum); } @@ -159,6 +165,12 @@ int UsbCameraImpl::PercentageToRaw(const UsbCameraProperty& rawProp, } return quirkLifeCamHd3000[ndx]; } + // Arducam OV9281 exposure setting quirk + if (m_ov9281_exposure && rawProp.name == "raw_exposure_absolute" && + rawProp.minimum == 1 && rawProp.maximum == 5000) { + // real range is 1-75 + return 1 + (75 - 1) * (percentValue / 100.0); + } return rawProp.minimum + (rawProp.maximum - rawProp.minimum) * (percentValue / 100.0); } @@ -1384,6 +1396,7 @@ void UsbCameraImpl::SetQuirks() { std::string_view desc = GetDescription(descbuf); m_lifecam_exposure = wpi::ends_with(desc, "LifeCam HD-3000") || wpi::ends_with(desc, "LifeCam Cinema (TM)"); + m_ov9281_exposure = wpi::contains(desc, "OV9281"); m_picamera = wpi::ends_with(desc, "mmal service"); int deviceNum = GetDeviceNum(m_path.c_str()); diff --git a/cscore/src/main/native/linux/UsbCameraImpl.h b/cscore/src/main/native/linux/UsbCameraImpl.h index a03246653c..acf1bfcd45 100644 --- a/cscore/src/main/native/linux/UsbCameraImpl.h +++ b/cscore/src/main/native/linux/UsbCameraImpl.h @@ -161,6 +161,7 @@ class UsbCameraImpl : public SourceImpl { // Quirks bool m_lifecam_exposure{false}; // Microsoft LifeCam exposure bool m_ps3eyecam_exposure{false}; // PS3 Eyecam exposure + bool m_ov9281_exposure{false}; // Arducam OV9281 exposure bool m_picamera{false}; // Raspberry Pi camera //