Show a patch.

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

{
    "id": 10148,
    "url": "https://patchwork.libcamera.org/api/patches/10148/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10148/",
    "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": "<20201021002418.21764-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-10-21T00:24:16",
    "name": "[libcamera-devel] libcamera: pipeline: Fail match() when no camera is registered",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b1a331e4bcd74187e74c0fb0abf55fdef5c16272",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10148/mbox/",
    "series": [
        {
            "id": 1393,
            "url": "https://patchwork.libcamera.org/api/series/1393/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1393",
            "date": "2020-10-21T00:24:16",
            "name": "[libcamera-devel] libcamera: pipeline: Fail match() when no camera is registered",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1393/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10148/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10148/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 72BE0BDB1F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Oct 2020 00:25:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CD49F61DB2;\n\tWed, 21 Oct 2020 02:25:09 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2164160350\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Oct 2020 02:25:08 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9A895555\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Oct 2020 02:25:07 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mGaq8zkZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603239907;\n\tbh=gkoKl95ISo3XpmowdoMUzBOT9qNMEz4pOs2HQeL3QSc=;\n\th=From:To:Subject:Date:From;\n\tb=mGaq8zkZQM59Tu47NkTC6/qVVtGTFCIdmQqGN0UpQdx2x3RGfhU5S4cYaxLyMU19A\n\tYfmZYMAM99daZ0tuDFd4QNF1H7PshFrLWH3V/+AVaIjqDcZVmNdRQXtlTNqIOexEdn\n\tWUeXdm/6XyBf36vMdI90v/J9J7UXJXT0bB1s3x10=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 21 Oct 2020 03:24:16 +0300",
        "Message-Id": "<20201021002418.21764-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] libcamera: pipeline: Fail match() when no\n\tcamera is registered",
        "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": "The rkisp1 and simple pipeline handlers can fail to register any camera,\nif initialization of all the detected cameras fail. In that case, they\nstill return success from their match function. As no camera gets\nregistered, the pipeline handler is immediately destroyed, releasing the\nacquired media devices, and the camera manager immediately tries to\nmatch the same pipeline handler with the same media device, causing an\nendless loop.\n\nFix it by returning false from the match function if no camera gets\nregistered.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 9 ++++++---\n src/libcamera/pipeline/simple/simple.cpp | 5 ++++-\n 2 files changed, 10 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 2352ab3b234a..c74a2e9bd548 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -1107,10 +1107,13 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)\n \tif (!pad)\n \t\treturn false;\n \n-\tfor (MediaLink *link : pad->links())\n-\t\tcreateCamera(link->source()->entity());\n+\tbool registered = false;\n+\tfor (MediaLink *link : pad->links()) {\n+\t\tif (!createCamera(link->source()->entity()))\n+\t\t\tregistered = true;\n+\t}\n \n-\treturn true;\n+\treturn registered;\n }\n \n /* -----------------------------------------------------------------------------\ndiff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 8c00c0ffc121..8868a43beeb4 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -821,6 +821,8 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \t}\n \n \t/* Initialize each pipeline and register a corresponding camera. */\n+\tbool registered = false;\n+\n \tfor (std::unique_ptr<SimpleCameraData> &data : pipelines) {\n \t\tint ret = data->init();\n \t\tif (ret < 0)\n@@ -830,9 +832,10 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \t\t\tCamera::create(this, data->sensor_->id(),\n \t\t\t\t       data->streams());\n \t\tregisterCamera(std::move(camera), std::move(data));\n+\t\tregistered = true;\n \t}\n \n-\treturn true;\n+\treturn registered;\n }\n \n V4L2VideoDevice *SimplePipelineHandler::video(const MediaEntity *entity)\n",
    "prefixes": [
        "libcamera-devel"
    ]
}