Revert "[camera][imx355] Fix crash on boot"
This reverts commit 71090602cba58192a74131461cf7e970d0b3af0a.
Reason for revert: Landed in wrong repo.
Original change's description:
> [camera][imx355] Fix crash on boot
>
> This CL fixes a crash when booting a device that uses the imx355
> driver. The root cause was the ISP query of the number of
> available modes, which asked for more sensor modes than were available.
>
> The fix was to change the logic to return the smaller of the
> number of modes available and the number that was requested.
>
> This CL also removes some spurious driver logging during driver
> initialization.
>
> Tested on a luis platform board with the camera in both the
> muted and unmuted states at power on.
>
> Change-Id: I834875399b5fa0dd9ef9f9e08a03ff1a464aa2d9
> Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/419754
> Testability-Review: Nic Zoghb <nzo@google.com>
> Commit-Queue: John Sasinowski <jsasinowski@google.com>
> Reviewed-by: Ed James <edjames@google.com>
> Reviewed-by: Carl Norum <cjn@google.com>
TBR=cjn@google.com,edjames@google.com,nzo@google.com,jsasinowski@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I541d95f7a3e3ab425f8fd3eceef25125013bc0b6
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/422414
Reviewed-by: John Sasinowski <jsasinowski@google.com>
Reviewed-by: Nic Zoghb <nzo@google.com>
Commit-Queue: John Sasinowski <jsasinowski@google.com>
diff --git a/src/camera/drivers/sensors/imx355/imx355.cc b/src/camera/drivers/sensors/imx355/imx355.cc
index 4f3d0fd..e2c4e48 100644
--- a/src/camera/drivers/sensors/imx355/imx355.cc
+++ b/src/camera/drivers/sensors/imx355/imx355.cc
@@ -54,6 +54,8 @@
}
zx_status_t Imx355Device::InitPdev() {
+ printf("****\n****\n**** IMX355!\n****\n****\n");
+
std::lock_guard guard(lock_);
// I2c for communicating with the sensor.
diff --git a/src/camera/drivers/sensors/imx355/imx355_protocol.cc b/src/camera/drivers/sensors/imx355/imx355_protocol.cc
index dacf7b3..1760deb 100644
--- a/src/camera/drivers/sensors/imx355/imx355_protocol.cc
+++ b/src/camera/drivers/sensors/imx355/imx355_protocol.cc
@@ -54,15 +54,14 @@
size_t modes_count,
size_t* out_modes_actual) {
std::lock_guard guard(lock_);
-
- if (available_modes.size() < modes_count) {
- modes_count = available_modes.size();
+ if (modes_count > available_modes.size()) {
+ return ZX_ERR_INVALID_ARGS;
}
- for (size_t i = 0; i < modes_count; i++) {
+ for (size_t i = 0; i < available_modes.size(); i++) {
out_modes_list[i] = available_modes[i];
}
- *out_modes_actual = modes_count;
+ *out_modes_actual = available_modes.size();
return ZX_OK;
}