Show a patch.

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

{
    "id": 1387,
    "url": "https://patchwork.libcamera.org/api/patches/1387/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1387/",
    "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": "<20190610164052.30741-7-jacopo@jmondi.org>",
    "date": "2019-06-10T16:40:52",
    "name": "[libcamera-devel,v2,6/6,HACK] ipu3: Set and get a few sensor controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "bb8715d15493d1d87168bfda2c5b7423c20ced8e",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1387/mbox/",
    "series": [
        {
            "id": 344,
            "url": "https://patchwork.libcamera.org/api/series/344/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=344",
            "date": "2019-06-10T16:40:46",
            "name": "Add support for V4L2 Controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/344/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1387/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1387/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 45ACE635E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Jun 2019 18:39:49 +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 relay10.mail.gandi.net (Postfix) with ESMTPSA id D79DB240007;\n\tMon, 10 Jun 2019 16:39:48 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 10 Jun 2019 18:40:52 +0200",
        "Message-Id": "<20190610164052.30741-7-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190610164052.30741-1-jacopo@jmondi.org>",
        "References": "<20190610164052.30741-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 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": "Mon, 10 Jun 2019 16:39:49 -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 | 80 ++++++++++++++++++++++++++++\n 1 file changed, 80 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex b3e7fb0e9c64..59c1fe3c56fd 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -688,6 +688,86 @@ int PipelineHandlerIPU3::start(Camera *camera)\n \tImgUDevice *imgu = data->imgu_;\n \tint ret;\n \n+\t/* --- Get control values --- */\n+\tstd::vector<unsigned int> controlIds = {\n+\t\tV4L2_CID_EXPOSURE, V4L2_CID_ANALOGUE_GAIN,\n+\t};\n+\tV4L2Controls controls;\n+\tret = cio2->sensor_->dev()->getControls(controlIds, &controls);\n+\tif (ret) {\n+\t\tLOG(Error) << \"Failed to get control values\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (V4L2Control *ctrl : controls) {\n+\t\tunsigned int id = ctrl->id();\n+\n+\t\tswitch(ctrl->type()) {\n+\t\tcase V4L2_CTRL_TYPE_INTEGER:\n+\t\tcase V4L2_CTRL_TYPE_BOOLEAN:\n+\t\t{\n+\t\t\tuint32_t val = controls.getInt(id);\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t   << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tcase V4L2_CTRL_TYPE_INTEGER64:\n+\t\t{\n+\t\t\tuint64_t val = controls.getInt64(id);\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t   << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tLOG(Error) << \"Unsupported type: \" << ctrl->type();\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n+\t/* --- Set control values --- */\n+\tV4L2Controls setControls;\n+\tsetControls.set(V4L2_CID_EXPOSURE, 2046);\n+\tsetControls.set(V4L2_CID_ANALOGUE_GAIN, 1024);\n+\n+\tret = cio2->sensor_->dev()->setControls(setControls);\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+\tV4L2Controls newcontrols;\n+\tret = cio2->sensor_->dev()->getControls(controlIds, &newcontrols);\n+\tif (ret) {\n+\t\tLOG(Error) << \"Failed to get control values\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (V4L2Control *ctrl : newcontrols) {\n+\t\tunsigned int id = ctrl->id();\n+\n+\t\tswitch(ctrl->type()) {\n+\t\tcase V4L2_CTRL_TYPE_INTEGER:\n+\t\tcase V4L2_CTRL_TYPE_BOOLEAN:\n+\t\t{\n+\t\t\tuint32_t val = newcontrols.getInt(id);\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t   << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tcase V4L2_CTRL_TYPE_INTEGER64:\n+\t\t{\n+\t\t\tuint64_t val = newcontrols.getInt64(id);\n+\t\t\tLOG(Error) << \"Control : \" << id\n+\t\t\t\t   << \" - value: \" << val;\n+\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tLOG(Error) << \"Unsupported type: \" << ctrl->type();\n+\t\t\treturn -EINVAL;\n+\t\t}\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",
        "v2",
        "6/6",
        "HACK"
    ]
}