Show a patch.

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

{
    "id": 1507,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1507/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1507/",
    "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": "<20190624142859.19313-5-jacopo@jmondi.org>",
    "date": "2019-06-24T14:28:57",
    "name": "[libcamera-devel,v6,4/6] libcamera: camera_sensor: Add V4L2 control operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1bc106ab2bfa81434a9d2607de83fc2b149fde56",
    "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/1507/mbox/",
    "series": [
        {
            "id": 371,
            "url": "https://patchwork.libcamera.org/api/1.1/series/371/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=371",
            "date": "2019-06-24T14:28:53",
            "name": "Add support for V4L2 controls",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/371/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1507/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1507/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 18A526162F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jun 2019 16:27:53 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 766352000D;\n\tMon, 24 Jun 2019 14:27:52 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 24 Jun 2019 16:28:57 +0200",
        "Message-Id": "<20190624142859.19313-5-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190624142859.19313-1-jacopo@jmondi.org>",
        "References": "<20190624142859.19313-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v6 4/6] libcamera: camera_sensor: Add V4L2\n\tcontrol operations",
        "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": "Mon, 24 Jun 2019 14:27:53 -0000"
    },
    "content": "Add operations to get and set control and to retrieve the informations\non a V4L2 control. For simple camera sensors, the operations are\ndirectly called on the underlying V4L2 subdevice.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/camera_sensor.cpp       | 69 +++++++++++++++++++++++++++\n src/libcamera/include/camera_sensor.h |  6 +++\n 2 files changed, 75 insertions(+)",
    "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex a804a68c9d91..471c3e2e6e47 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -247,6 +247,75 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format)\n \treturn subdev_->setFormat(0, format);\n }\n \n+/**\n+ * \\brief Retrieve information about a control\n+ * \\param[in] id The control ID\n+ * \\return A pointer to the V4L2ControlInfo for control \\a id, or nullptr\n+ * if the sensor doesn't have such a control\n+ */\n+const V4L2ControlInfo *CameraSensor::getControlInfo(unsigned int id) const\n+{\n+\treturn subdev_->getControlInfo(id);\n+}\n+\n+/**\n+ * \\brief Read controls from the sensor\n+ * \\param[inout] ctrls The list of controls to read\n+ *\n+ * This method reads the value of all controls contained in \\a ctrls, and stores\n+ * their values in the corresponding \\a ctrls entry.\n+ *\n+ * If any control in \\a ctrls is not supported by the device, is disabled (i.e.\n+ * has the V4L2_CTRL_FLAG_DISABLED flag set), is a compound control, or if any\n+ * other error occurs during validation of the requested controls, no control is\n+ * read and this method returns -EINVAL.\n+ *\n+ * If an error occurs while reading the controls, the index of the first control\n+ * that couldn't be read is returned. The value of all controls below that index\n+ * are updated in \\a ctrls, while the value of all the other controls are not\n+ * changed.\n+ *\n+ * \\sa V4L2Device::getControls()\n+ *\n+ * \\return 0 on success or an error code otherwise\n+ * \\retval -EINVAL One of the control is not supported or not accessible\n+ * \\retval i The index of the control that failed\n+ */\n+int CameraSensor::getControls(V4L2ControlList *ctrls)\n+{\n+\treturn subdev_->getControls(ctrls);\n+}\n+\n+/**\n+ * \\brief Write controls to the sensor\n+ * \\param[in] ctrls The list of controls to write\n+ *\n+ * This method writes the value of all controls contained in \\a ctrls, and\n+ * stores the values actually applied to the device in the corresponding\n+ * \\a ctrls entry.\n+ *\n+ * If any control in \\a ctrls is not supported by the device, is disabled (i.e.\n+ * has the V4L2_CTRL_FLAG_DISABLED flag set), is read-only, is a\n+ * compound control, or if any other error occurs during validation of\n+ * the requested controls, no control is written and this method returns\n+ * -EINVAL.\n+ *\n+ * If an error occurs while writing the controls, the index of the first\n+ * control that couldn't be written is returned. All controls below that index\n+ * are written and their values are updated in \\a ctrls, while all other\n+ * controls are not written and their values are not changed.\n+ *\n+ * \\sa V4L2Device::setControls()\n+ *\n+ * \\return 0 on success or an error code otherwise\n+ * \\retval -EINVAL One of the control is not supported or not accessible\n+ * \\retval i The index of the control that failed\n+ */\n+int CameraSensor::setControls(V4L2ControlList *ctrls)\n+{\n+\treturn subdev_->setControls(ctrls);\n+}\n+\n std::string CameraSensor::logPrefix() const\n {\n \treturn \"'\" + subdev_->entity()->name() + \"'\";\ndiff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\nindex b823480241a7..b42e7b8e1343 100644\n--- a/src/libcamera/include/camera_sensor.h\n+++ b/src/libcamera/include/camera_sensor.h\n@@ -17,6 +17,8 @@\n namespace libcamera {\n \n class MediaEntity;\n+class V4L2ControlInfo;\n+class V4L2ControlList;\n class V4L2Subdevice;\n \n struct V4L2SubdeviceFormat;\n@@ -41,6 +43,10 @@ public:\n \t\t\t\t      const Size &size) const;\n \tint setFormat(V4L2SubdeviceFormat *format);\n \n+\tconst V4L2ControlInfo *getControlInfo(unsigned int id) const;\n+\tint getControls(V4L2ControlList *ctrls);\n+\tint setControls(V4L2ControlList *ctrls);\n+\n protected:\n \tstd::string logPrefix() const;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "4/6"
    ]
}