Patch Detail
Show a patch.
GET /api/patches/2330/?format=api
{ "id": 2330, "url": "https://patchwork.libcamera.org/api/patches/2330/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2330/", "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": "<20191119164421.68983-7-jacopo@jmondi.org>", "date": "2019-11-19T16:44:21", "name": "[libcamera-devel,RFC,6/6] libcamera: camera_sensor: Collect camera properties", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "61de8d5a1926e84e558a6daf9a36babfca9f81ca", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/2330/mbox/", "series": [ { "id": 571, "url": "https://patchwork.libcamera.org/api/series/571/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=571", "date": "2019-11-19T16:44:15", "name": "Collect Camera properties", "version": 1, "mbox": "https://patchwork.libcamera.org/series/571/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2330/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2330/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1ED85617A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2019 17:42:29 +0100 (CET)", "from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id B657020005;\n\tTue, 19 Nov 2019 16:42:28 +0000 (UTC)" ], "X-Originating-IP": "93.34.114.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 19 Nov 2019 17:44:21 +0100", "Message-Id": "<20191119164421.68983-7-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20191119164421.68983-1-jacopo@jmondi.org>", "References": "<20191119164421.68983-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC 6/6] libcamera: camera_sensor: Collect\n\tcamera properties", "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>", "X-List-Received-Date": "Tue, 19 Nov 2019 16:42:29 -0000" }, "content": "Store the camera sensor location and rotation by parsing the\nassociated V4L2 controls.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 32 +++++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h | 3 +++\n 2 files changed, 35 insertions(+)", "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 86f0c772861b..857853f4fcf9 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -13,6 +13,8 @@\n #include <limits.h>\n #include <math.h>\n \n+#include <libcamera/property_ids.h>\n+\n #include \"formats.h\"\n #include \"utils.h\"\n #include \"v4l2_subdevice.h\"\n@@ -89,6 +91,36 @@ int CameraSensor::init()\n \tif (ret < 0)\n \t\treturn ret;\n \n+\t/* Retrieve and store the camera sensor properties. */\n+\tconst ControlInfoMap &controls = subdev_->controls();\n+\tint32_t controlValue = V4L2_LOCATION_EXTERNAL;\n+\n+\tconst auto &locationControl = controls.find(V4L2_CID_CAMERA_SENSOR_LOCATION);\n+\tif (locationControl != controls.end())\n+\t\tcontrolValue = locationControl->second.defaultValue().get<int32_t>();\n+\n+\tswitch (controlValue) {\n+\tcase V4L2_LOCATION_EXTERNAL:\n+\t\tlocation_ = CAMERA_LOCATION_EXTERNAL;\n+\t\tbreak;\n+\tcase V4L2_LOCATION_FRONT:\n+\t\tlocation_ = CAMERA_LOCATION_FRONT;\n+\t\tbreak;\n+\tcase V4L2_LOCATION_BACK:\n+\t\tlocation_ = CAMERA_LOCATION_BACK;\n+\t\tbreak;\n+\tdefault:\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"Unsupported camera location: \" << controlValue;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tcontrolValue = 0;\n+\tconst auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION);\n+\tif (rotationControl != controls.end())\n+\t\tcontrolValue = rotationControl->second.defaultValue().get<int32_t>();\n+\trotation_ = controlValue;\n+\n \t/* Enumerate and cache media bus codes and sizes. */\n \tconst ImageFormats formats = subdev_->formats(0);\n \tif (formats.isEmpty()) {\ndiff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\nindex 1fb36a4f4951..ee26ca20ac20 100644\n--- a/src/libcamera/include/camera_sensor.h\n+++ b/src/libcamera/include/camera_sensor.h\n@@ -56,6 +56,9 @@ private:\n \n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n+\n+\tunsigned int location_;\n+\tunsigned int rotation_;\n };\n \n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "RFC", "6/6" ] }