[libcamera-devel] [PATCH] libcamera: Fix CameraSensor::getFormat() search order

Mickael Guene mickael.guene at st.com
Tue Jun 11 13:37:11 CEST 2019


 According to the documentation, CameraSensor::getFormat() should select Media
bus code from mbusCodes parameter list. It should select the first code from the
list that is supported by the sensor. Current implementation will wrongly select
Media bus code from mbusCodes_ order instead.
 This patch aims to fix this wrong behavior.

Signed-off-by: Mickael Guene <mickael.guene at st.com>
---

 src/libcamera/camera_sensor.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 2b9d8fa..cb6649e 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -191,8 +191,8 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu
 {
 	V4L2SubdeviceFormat format{};
 
-	for (unsigned int code : mbusCodes_) {
-		if (std::any_of(mbusCodes.begin(), mbusCodes.end(),
+	for (unsigned int code : mbusCodes) {
+		if (std::any_of(mbusCodes_.begin(), mbusCodes_.end(),
 				[code](unsigned int c) { return c == code; })) {
 			format.mbus_code = code;
 			break;
-- 
2.7.4



More information about the libcamera-devel mailing list