Patch Detail
Show a patch.
GET /api/1.1/patches/1815/?format=api
{ "id": 1815, "url": "https://patchwork.libcamera.org/api/1.1/patches/1815/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1815/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190817105937.29353-4-jacopo@jmondi.org>", "date": "2019-08-17T10:59:35", "name": "[libcamera-devel,3/5] libcamera: camera_sensor: Store the camera location", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "afe18b73a9296942b8a64dc1d4e917ee4a668770", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1815/mbox/", "series": [ { "id": 462, "url": "https://patchwork.libcamera.org/api/1.1/series/462/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=462", "date": "2019-08-17T10:59:32", "name": "libcamera: camera_sensor: Collect camera location and sizes", "version": 1, "mbox": "https://patchwork.libcamera.org/series/462/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1815/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1815/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DFACD61919\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 17 Aug 2019 12:58:17 +0200 (CEST)", "from uno.homenet.telecomitalia.it\n\t(host64-130-dynamic.5-87-r.retail.telecomitalia.it [87.5.130.64])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 648CD1C0002;\n\tSat, 17 Aug 2019 10:58:17 +0000 (UTC)" ], "X-Originating-IP": "87.5.130.64", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 17 Aug 2019 12:59:35 +0200", "Message-Id": "<20190817105937.29353-4-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.22.0", "In-Reply-To": "<20190817105937.29353-1-jacopo@jmondi.org>", "References": "<20190817105937.29353-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 3/5] libcamera: camera_sensor: Store the\n\tcamera location", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Sat, 17 Aug 2019 10:58:18 -0000" }, "content": "Store the camera sensor location by parsing the\nV4L2_CID_CAMERA_SENSOR_LOCATION V4L2 control.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 25 +++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h | 3 +++\n 2 files changed, 28 insertions(+)", "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex a7670b449b31..2703d10c719e 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -89,6 +89,31 @@ int CameraSensor::init()\n \tif (ret < 0)\n \t\treturn ret;\n \n+\t/* Retrieve and store the camera sensor location. */\n+\tV4L2ControlList controls;\n+\tcontrols.add(V4L2_CID_CAMERA_SENSOR_LOCATION);\n+\n+\tret = subdev_->getControls(&controls);\n+\tif (ret) {\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"Failed to get camera sensor controls: \" << ret;\n+\t\treturn ret;\n+\t}\n+\n+\tV4L2Control *locationControl = controls[V4L2_CID_CAMERA_SENSOR_LOCATION];\n+\tint64_t v4l2Location = locationControl->value();\n+\tswitch (v4l2Location) {\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) << \"Unsupported camera location\";\n+\t\treturn -EINVAL;\n+\t}\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 fe033fb374c1..a237a1684605 100644\n--- a/src/libcamera/include/camera_sensor.h\n+++ b/src/libcamera/include/camera_sensor.h\n@@ -10,6 +10,7 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/control_ids.h>\n #include <libcamera/geometry.h>\n \n #include \"log.h\"\n@@ -55,6 +56,8 @@ private:\n \n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n+\n+\tCameraLocation location_;\n };\n \n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "3/5" ] }