Patch Detail
Show a patch.
GET /api/patches/17828/?format=api
{ "id": 17828, "url": "https://patchwork.libcamera.org/api/patches/17828/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17828/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20221122083005.5239-1-jacopo@jmondi.org>", "date": "2022-11-22T08:30:05", "name": "[libcamera-devel] libcamera: camera_sensor: Print missing controls names", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "da92d8947e22aa25851d57b8b4ad96f56bf70dad", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17828/mbox/", "series": [ { "id": 3626, "url": "https://patchwork.libcamera.org/api/series/3626/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3626", "date": "2022-11-22T08:30:05", "name": "[libcamera-devel] libcamera: camera_sensor: Print missing controls names", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3626/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17828/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17828/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6D8D0BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Nov 2022 08:30:18 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B81EF6331A;\n\tTue, 22 Nov 2022 09:30:17 +0100 (CET)", "from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E27F9632EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Nov 2022 09:30:15 +0100 (CET)", "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 39609240006;\n\tTue, 22 Nov 2022 08:30:14 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669105817;\n\tbh=PAeZ7Yq3lE9hxPgsBvw9g/fzoun0uNpSukZ3A7/lQDo=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=0d6YrnzYZcTmeyYulVOgTYEQpssegVIOkGw2AcaKK8xY+NkvdGcl6nuLW88x3D50m\n\tHS43FNR53CwY5cWEUXqIQUonPP4DQLp4jh9Z4oG3wxYC4q8sCbQqxMQbh5RQzScQ1i\n\tX3vjGd44uxV0m8M/0mQZKp5opPkhQrFAJPLZcUQXJ/Wyp7low1tZrao4liGAYsrJET\n\tH5mPFWXhZUhOBbjhAvRbokI5fJJ9h9fwWTEjCSx6PUVc818tZwXJi3ZlH4jouj0547\n\tApPEVhTthVX4IIE43+DHIxgGkCBcbBitgR2NJAvgoT3XezpIyMJ6VKeqVaMxnW/faE\n\t1zZ2WrY3MrEmA==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 22 Nov 2022 09:30:05 +0100", "Message-Id": "<20221122083005.5239-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.38.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: camera_sensor: Print missing\n\tcontrols names", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Since the very beginning the camera sensor class has validated the\ncontrols available from the camera sensor driver, and complained\naccordingly when any of them was missing.\n\nThe complaint message reported however only the numerical identifier of\nthe V4L2 control, making debugging harder.\n\nAssociate to each control a human readable identifier and use it in\ndebug messages.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 38 ++++++++++++++++-----------------\n 1 file changed, 19 insertions(+), 19 deletions(-)", "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ea373458a164..0780ce5a7007 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -213,31 +213,31 @@ int CameraSensor::validateSensorDriver()\n \t * Optional controls are used to register optional sensor properties. If\n \t * not present, some values will be defaulted.\n \t */\n-\tstatic constexpr uint32_t optionalControls[] = {\n-\t\tV4L2_CID_CAMERA_SENSOR_ROTATION,\n+\tstatic const std::map<uint32_t, std::string> optionalControls = {\n+\t\t{ V4L2_CID_CAMERA_SENSOR_ROTATION, \"Rotation\" },\n \t};\n \n \tconst ControlIdMap &controls = subdev_->controls().idmap();\n-\tfor (uint32_t ctrl : optionalControls) {\n+\tfor (const auto &[ctrl, name] : optionalControls) {\n \t\tif (!controls.count(ctrl))\n \t\t\tLOG(CameraSensor, Debug)\n-\t\t\t\t<< \"Optional V4L2 control \" << utils::hex(ctrl)\n-\t\t\t\t<< \" not supported\";\n+\t\t\t\t<< \"Optional V4L2 control '\" << name\n+\t\t\t\t<< \"' not supported\";\n \t}\n \n \t/*\n \t * Recommended controls are similar to optional controls, but will\n \t * become mandatory in the near future. Be loud if they're missing.\n \t */\n-\tstatic constexpr uint32_t recommendedControls[] = {\n-\t\tV4L2_CID_CAMERA_ORIENTATION,\n+\tstatic const std::map<uint32_t, std::string> recommendedControls = {\n+\t\t{ V4L2_CID_CAMERA_ORIENTATION, \"Orientation\" },\n \t};\n \n-\tfor (uint32_t ctrl : recommendedControls) {\n+\tfor (const auto &[ctrl, name] : recommendedControls) {\n \t\tif (!controls.count(ctrl)) {\n \t\t\tLOG(CameraSensor, Warning)\n-\t\t\t\t<< \"Recommended V4L2 control \" << utils::hex(ctrl)\n-\t\t\t\t<< \" not supported\";\n+\t\t\t\t<< \"Recommended V4L2 control '\" << name\n+\t\t\t\t<< \"' not supported\";\n \t\t\terr = -EINVAL;\n \t\t}\n \t}\n@@ -300,20 +300,20 @@ int CameraSensor::validateSensorDriver()\n \t * For raw sensors, make sure the sensor driver supports the controls\n \t * required by the CameraSensor class.\n \t */\n-\tstatic constexpr uint32_t mandatoryControls[] = {\n-\t\tV4L2_CID_ANALOGUE_GAIN,\n-\t\tV4L2_CID_EXPOSURE,\n-\t\tV4L2_CID_HBLANK,\n-\t\tV4L2_CID_PIXEL_RATE,\n-\t\tV4L2_CID_VBLANK,\n+\tstatic const std::map<uint32_t, std::string> mandatoryControls = {\n+\t\t{ V4L2_CID_ANALOGUE_GAIN, \"Analogue gain\" },\n+\t\t{ V4L2_CID_EXPOSURE, \"Exposure\" },\n+\t\t{ V4L2_CID_HBLANK, \"Horizontal blanking\" },\n+\t\t{ V4L2_CID_PIXEL_RATE, \"Pixel Rate\" },\n+\t\t{ V4L2_CID_VBLANK, \"Vertical blanking\" }\n \t};\n \n \terr = 0;\n-\tfor (uint32_t ctrl : mandatoryControls) {\n+\tfor (const auto &[ctrl, name] : mandatoryControls) {\n \t\tif (!controls.count(ctrl)) {\n \t\t\tLOG(CameraSensor, Error)\n-\t\t\t\t<< \"Mandatory V4L2 control \" << utils::hex(ctrl)\n-\t\t\t\t<< \" not available\";\n+\t\t\t\t<< \"Mandatory V4L2 control '\" << name\n+\t\t\t\t<< \"' not available\";\n \t\t\terr = -EINVAL;\n \t\t}\n \t}\n", "prefixes": [ "libcamera-devel" ] }