From patchwork Sun Jan 27 00:52:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 417 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6587260B1B for ; Sun, 27 Jan 2019 01:52:15 +0100 (CET) X-Halon-ID: c503f79b-21cd-11e9-9adf-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id c503f79b-21cd-11e9-9adf-005056917a89; Sun, 27 Jan 2019 01:52:09 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sun, 27 Jan 2019 01:52:06 +0100 Message-Id: <20190127005206.20901-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: uvcvideo: add warning if no default video device is found X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 00:52:15 -0000 If for any reason a default video device is not found in the media graph the creation of the UVC pipeline silently failed. This is not optimal when debugging problems with the pipeline, add a warning to notify the user of the issue. Signed-off-by: Niklas Söderlund --- src/libcamera/pipeline/uvcvideo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index c51e8bc1f2c2bf25..4ae179d24709c856 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -8,12 +8,15 @@ #include #include "device_enumerator.h" +#include "log.h" #include "media_device.h" #include "pipeline_handler.h" #include "v4l2_device.h" namespace libcamera { +LOG_DEFINE_CATEGORY(UVC) + class PipelineHandlerUVC : public PipelineHandler { public: @@ -60,6 +63,9 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) } if (!video_ || video_->open()) { + if (!video_) + LOG(UVC, Warning) << "Could not find a default video device"; + media_->release(); return false; }