Show a patch.

GET /api/patches/10757/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 10757,
    "url": "https://patchwork.libcamera.org/api/patches/10757/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10757/",
    "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": "<20201228165203.53771-3-jacopo@jmondi.org>",
    "date": "2020-12-28T16:52:01",
    "name": "[libcamera-devel,v3,2/4] libcamera: camera_sensor: Register static properties",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "6fe8266720fe25217d96c5256b077d8505e2a034",
    "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/10757/mbox/",
    "series": [
        {
            "id": 1557,
            "url": "https://patchwork.libcamera.org/api/series/1557/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1557",
            "date": "2020-12-28T16:51:59",
            "name": "libcamera: Introduce sensor database",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1557/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10757/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10757/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 E4D5FC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Dec 2020 16:51:57 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 378A162000;\n\tMon, 28 Dec 2020 17:51:57 +0100 (CET)",
            "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 DB927615B2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Dec 2020 17:51:53 +0100 (CET)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 8A4451C000A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Dec 2020 16:51:53 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 28 Dec 2020 17:52:01 +0100",
        "Message-Id": "<20201228165203.53771-3-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.29.2",
        "In-Reply-To": "<20201228165203.53771-1-jacopo@jmondi.org>",
        "References": "<20201228165203.53771-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 2/4] libcamera: camera_sensor: Register\n\tstatic 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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Register static properties, retrieved inspecting the sensor\ndatabase, in the CameraSensor class.\n\nStatic properties are overridden by properties retrieved from\nthe kernel interface at run-time if any overlap between the two\nsets occurs.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/internal/camera_sensor.h |  1 +\n src/libcamera/camera_sensor.cpp            | 21 ++++++++++++++++++++-\n 2 files changed, 21 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 10877b9d1d9d..2790c55b6178 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -71,6 +71,7 @@ protected:\n private:\n \tint generateId();\n \tint validateSensorDriver();\n+\tvoid initStaticProperties();\n \tint initProperties();\n \tint initControls();\n \ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ea57943647b1..d86fc211c4f6 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -20,6 +20,7 @@\n \n #include \"libcamera/internal/bayer_format.h\"\n #include \"libcamera/internal/formats.h\"\n+#include \"libcamera/internal/sensor_database.h\"\n #include \"libcamera/internal/sysfs.h\"\n #include \"libcamera/internal/utils.h\"\n \n@@ -295,6 +296,21 @@ int CameraSensor::validateSensorDriver()\n \treturn 0;\n }\n \n+void CameraSensor::initStaticProperties()\n+{\n+\tconst SensorInfo *info = SensorDatabase::get(model_);\n+\tif (!info) {\n+\t\tLOG(CameraSensor, Warning)\n+\t\t\t<< \"No static properties available for '\" << model_ << \"'\";\n+\t\tLOG(CameraSensor, Warning)\n+\t\t\t<< \"Please consider updating the sensor database\";\n+\t\treturn;\n+\t}\n+\n+\t/* Register the properties retrieved from the sensor database. */\n+\tproperties_.set(properties::UnitCellSize, info->unitCellSize);\n+}\n+\n int CameraSensor::initProperties()\n {\n \t/*\n@@ -332,7 +348,10 @@ int CameraSensor::initProperties()\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Retrieve and store the camera sensor properties. */\n+\t/* Initialize the static properties from the sensor database. */\n+\tinitStaticProperties();\n+\n+\t/* Retrieve and register properties from the kernel interface. */\n \tconst ControlInfoMap &controls = subdev_->controls();\n \tint32_t propertyValue;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "2/4"
    ]
}