[libcamera-devel] [PATCH v2 1/4] test: camera: buffer_import: Fix error messages

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Feb 24 20:35:58 CET 2020


The error message for when a device name can't be resolved to an video
device is wrong and applies to the next operation bellow it. Move it to
it's correct location and add a new error message to highlight the
resolution failure.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 test/camera/buffer_import.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
index ab6e74bd1671e6f5..6997ea78c9f608c9 100644
--- a/test/camera/buffer_import.cpp
+++ b/test/camera/buffer_import.cpp
@@ -74,13 +74,16 @@ public:
 
 		video_ = V4L2VideoDevice::fromEntityName(media_.get(), videoDeviceName);
 		if (!video_) {
+			std::cout << "Failed to get video device from entity "
+				  << videoDeviceName << std::endl;
+			return TestFail;
+		}
+
+		if (video_->open()) {
 			std::cout << "Unable to open " << videoDeviceName << std::endl;
 			return TestFail;
 		}
 
-		if (video_->open())
-			return TestFail;
-
 		/* Configure the format. */
 		V4L2DeviceFormat format;
 		if (video_->getFormat(&format)) {
-- 
2.25.0



More information about the libcamera-devel mailing list