From patchwork Sun Sep 25 12:23:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 17393 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 71FA6C0DA4 for ; Sun, 25 Sep 2022 12:23:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B340362243; Sun, 25 Sep 2022 14:23:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664108614; bh=If+Nqi59cSPImxpuSnRZm6kcCa8qXaqNgCzUQGJe24w=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=u+G2aCWJW7EImncwGXLWis3dZZ1aPu8mbC9jIAigeMkdRiLrhzLjKJinKUaiwt5qV IcA553XcFBfnbSkighIM9J9n/N2Jn0eIu8RI1ZNbZj2FcQKjPSsH1vUwa9guPpaA3M 25rUsXJ0v9sT7bWg1khK6fs/RzSOg7lepSSz+GDPtJ64QI25f31Qq/YxlctYWWwLd5 deMryfD+ESslF+eED1+wttW2ZmtNfQwmsZyrOHg7DKAGwLPMZaVlvgR/qbj2Qoqaxz 9qeoX1eHeUFv6H2HBeWjsrOUKKArYVWzhaich7tCkKvN3DHYTw0J8BuiGFSMrK37yZ qMPfImJwpp3Vg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B2C1A621BC for ; Sun, 25 Sep 2022 14:23:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="O1JXEtyg"; dkim-atps=neutral Received: from umang.jainideasonboard.com (unknown [IPv6:2405:205:1089:f265:b627:9c56:fa7a:38e1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D314C2B3; Sun, 25 Sep 2022 14:23:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664108613; bh=If+Nqi59cSPImxpuSnRZm6kcCa8qXaqNgCzUQGJe24w=; h=From:To:Cc:Subject:Date:From; b=O1JXEtyguu0vfC2X7fcURaEJxcP72m0s30TvOc/f06TG5+uqZJxVZW1RIf+JthEhn GnJhKIINZD+QPmd7W6A8eg7LXYOsZCiw71E5shqMQEkV15JC8lKoeQeGAhrW3Re7oi 9ax4qA2qYptvSOeneOwMsTKhCmBSDItrk+e+Vi7w= To: libcamera-devel@lists.libcamera.org Date: Sun, 25 Sep 2022 17:53:24 +0530 Message-Id: <20220925122324.260251-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: v4l2_device: Log control id instead of errorIdx X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" v4l2_ext_controls.errorIdx (in the case of single failing control for VIDIOC_*_EXT_CTRLS calls) represents the index of that control. Since it is a single control, we can print the control id rather than its index. This improves logging as the id can be easily co-related with the controls while reading the log. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/v4l2_device.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 83901763..c60f7c91 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -244,7 +244,8 @@ ControlList V4L2Device::getControls(const std::vector &ids) } /* A specific control failed. */ - LOG(V4L2, Error) << "Unable to read control " << errorIdx + const unsigned int id = v4l2Ctrls[errorIdx].id; + LOG(V4L2, Error) << "Unable to read control " << utils::hex(id) << ": " << strerror(-ret); v4l2Ctrls.resize(errorIdx); @@ -354,7 +355,8 @@ int V4L2Device::setControls(ControlList *ctrls) } /* A specific control failed. */ - LOG(V4L2, Error) << "Unable to set control " << errorIdx + const unsigned int id = v4l2Ctrls[errorIdx].id; + LOG(V4L2, Error) << "Unable to set control " << utils::hex(id) << ": " << strerror(-ret); v4l2Ctrls.resize(errorIdx);