Patch Detail
Show a patch.
GET /api/1.1/patches/1861/?format=api
{ "id": 1861, "url": "https://patchwork.libcamera.org/api/1.1/patches/1861/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1861/", "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": "<20190827095008.11405-6-jacopo@jmondi.org>", "date": "2019-08-27T09:50:05", "name": "[libcamera-devel,v2,5/7] libcamera: camera_sensor: Collect camera properties", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d5ab4ac3305292003a3fc96f5721e5ab227979eb", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/1861/mbox/", "series": [ { "id": 468, "url": "https://patchwork.libcamera.org/api/1.1/series/468/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=468", "date": "2019-08-27T09:50:00", "name": "libcamera: camera_sensor: Collect camera location and sizes", "version": 2, "mbox": "https://patchwork.libcamera.org/series/468/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1861/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1861/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0534461580\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Aug 2019 11:48:48 +0200 (CEST)", "from uno.homenet.telecomitalia.it (unknown [87.18.63.98])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 796BF100008;\n\tTue, 27 Aug 2019 09:48:47 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 27 Aug 2019 11:50:05 +0200", "Message-Id": "<20190827095008.11405-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20190827095008.11405-1-jacopo@jmondi.org>", "References": "<20190827095008.11405-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 5/7] libcamera: camera_sensor: Collect\n\tcamera properties", "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": "Tue, 27 Aug 2019 09:48:48 -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 | 39 +++++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h | 4 +++\n 2 files changed, 43 insertions(+)", "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex a7670b449b31..fc7fdcdcaf5b 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -89,6 +89,45 @@ int CameraSensor::init()\n \tif (ret < 0)\n \t\treturn ret;\n \n+\t/* Retrieve and store the camera sensor properties. */\n+\tV4L2ControlList controls({\n+\t\tV4L2_CID_CAMERA_SENSOR_LOCATION,\n+\t\tV4L2_CID_CAMERA_SENSOR_ROTATION,\n+\t});\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 *control = controls[V4L2_CID_CAMERA_SENSOR_LOCATION];\n+\tint64_t value = control->value();\n+\tswitch (value) {\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: \" << value;\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tcontrol = controls[V4L2_CID_CAMERA_SENSOR_ROTATION];\n+\tvalue = control->value();\n+\tif (value < 0 || value > 360) {\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"Unsupported camera rotation: \" << value;\n+\t\treturn -EINVAL;\n+\t}\n+\trotation_ = value;\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..32d39127b275 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,9 @@ private:\n \n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n+\n+\tCameraLocation location_;\n+\tunsigned int rotation_;\n };\n \n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "v2", "5/7" ] }