Show a patch.

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

{
    "id": 1430,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1430/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1430/",
    "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": "<20190613112046.25260-7-jacopo@jmondi.org>",
    "date": "2019-06-13T11:20:46",
    "name": "[libcamera-devel,v3,6/6,HACK] ipu3: Set and get a few sensor controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "aca05947ccc8f403ea67f7d7094aa4c9d550e7d7",
    "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/1430/mbox/",
    "series": [
        {
            "id": 357,
            "url": "https://patchwork.libcamera.org/api/1.1/series/357/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=357",
            "date": "2019-06-13T11:20:40",
            "name": "Add support for V4L2 Controls",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/357/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1430/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1430/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 70CE363728\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2019 13:19:45 +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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 03999C000C;\n\tThu, 13 Jun 2019 11:19:44 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 13 Jun 2019 13:20:46 +0200",
        "Message-Id": "<20190613112046.25260-7-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190613112046.25260-1-jacopo@jmondi.org>",
        "References": "<20190613112046.25260-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 6/6] [HACK] ipu3: Set and get a few\n\tsensor controls",
        "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": "Thu, 13 Jun 2019 11:19:45 -0000"
    },
    "content": "Not to merge patch to demonstrate how to set controls on the image\nsensor device.\n\nNot-Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 49 ++++++++++++++++++++++++++++\n 1 file changed, 49 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex d13bdfcce54e..a803fa9d8dde 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -688,6 +688,55 @@ int PipelineHandlerIPU3::start(Camera *camera)\n \tImgUDevice *imgu = data->imgu_;\n \tint ret;\n \n+\t/* --- Get control values --- */\n+\tV4L2Controls controls;\n+\tcontrols.add(V4L2_CID_EXPOSURE);\n+\tcontrols.add(V4L2_CID_ANALOGUE_GAIN);\n+\tret = cio2->sensor_->getControls(&controls);\n+\tif (ret) {\n+\t\tLOG(Error) << \"Failed to get control values\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (const V4L2Control &ctrl : controls) {\n+\t\tunsigned int id = ctrl.id();\n+\t\tV4L2ControlInfo *info = cio2->sensor_->getControlInfo(id);\n+\t\tif (!info)\n+\t\t\tcontinue;\n+\n+\t\tint val = controls.get(id);\n+\t\tLOG(Error) << \"Control : \" << id << \" - name : \" << info->name()\n+\t\t\t   << \" - value: \" << val;\n+\t}\n+\n+\t/* --- Set control values --- */\n+\tcontrols.set(V4L2_CID_EXPOSURE, 2046);\n+\tcontrols.set(V4L2_CID_ANALOGUE_GAIN, 1024);\n+\n+\tret = cio2->sensor_->setControls(&controls);\n+\tif (ret) {\n+\t\tLOG(IPU3, Error) << \"Failed to set controls\";\n+\t\treturn ret;\n+\t}\n+\n+\t/* --- Get control values back again and verify they have changed --- */\n+\tret = cio2->sensor_->getControls(&controls);\n+\tif (ret) {\n+\t\tLOG(Error) << \"Failed to get control values\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (const V4L2Control &ctrl : controls) {\n+\t\tunsigned int id = ctrl.id();\n+\t\tV4L2ControlInfo *info = cio2->sensor_->getControlInfo(id);\n+\t\tif (!info)\n+\t\t\tcontinue;\n+\n+\t\tint val = controls.get(id);\n+\t\tLOG(Error) << \"Control : \" << id << \" - name : \" << info->name()\n+\t\t\t   << \" - value: \" << val;\n+\t}\n+\n \t/*\n \t * Start the ImgU video devices, buffers will be queued to the\n \t * ImgU output and viewfinder when requests will be queued.\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "6/6",
        "HACK"
    ]
}