Change v4l2_wrapper set control to accept null.
User does not need to pass a result pointer if they
don't care about the result.
BUG: 30140438
Change-Id: Ia98870f24df82464a3f00aad63a599063b98f03a
diff --git a/modules/camera/3_4/v4l2_wrapper.cpp b/modules/camera/3_4/v4l2_wrapper.cpp
index bce3200..d331a77 100644
--- a/modules/camera/3_4/v4l2_wrapper.cpp
+++ b/modules/camera/3_4/v4l2_wrapper.cpp
@@ -231,12 +231,19 @@
int32_t* result) {
HAL_LOG_ENTER();
+ // TODO(b/29334616): When async, this may need to check if the stream
+ // is on, and if so, lock it off while setting format. Need to look
+ // into if V4L2 supports adjusting controls while the stream is on.
+
v4l2_control control{control_id, desired};
if (IoctlLocked(VIDIOC_S_CTRL, &control) < 0) {
HAL_LOGE("S_CTRL fails: %s", strerror(errno));
return -ENODEV;
}
- *result = control.value;
+ // If the caller wants to know the result, pass it back.
+ if (result != nullptr) {
+ *result = control.value;
+ }
return 0;
}