Show a patch.

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

{
    "id": 21701,
    "url": "https://patchwork.libcamera.org/api/patches/21701/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21701/",
    "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": "<20241019100925.42808-1-stanislaw.gruszka@linux.intel.com>",
    "date": "2024-10-19T10:09:25",
    "name": "[v2] qcam: Automatically select the camera if only one is available",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "b4962537baa516091c68f821220c9b39f57c2450",
    "submitter": {
        "id": 211,
        "url": "https://patchwork.libcamera.org/api/people/211/?format=api",
        "name": "Stanislaw Gruszka",
        "email": "stanislaw.gruszka@linux.intel.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21701/mbox/",
    "series": [
        {
            "id": 4724,
            "url": "https://patchwork.libcamera.org/api/series/4724/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4724",
            "date": "2024-10-19T10:09:25",
            "name": "[v2] qcam: Automatically select the camera if only one is available",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4724/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21701/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21701/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 7B8B0BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 19 Oct 2024 10:09:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E89606538C;\n\tSat, 19 Oct 2024 12:09:37 +0200 (CEST)",
            "from mgamail.intel.com (mgamail.intel.com [192.198.163.10])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 172AC65380\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 19 Oct 2024 12:09:35 +0200 (CEST)",
            "from orviesa002.jf.intel.com ([10.64.159.142])\n\tby fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n\t19 Oct 2024 03:09:29 -0700",
            "from sgruszka-mobl.ger.corp.intel.com (HELO localhost)\n\t([10.245.97.183]) by orviesa002-auth.jf.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2024 03:09:29 -0700"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=intel.com header.i=@intel.com\n\theader.b=\"cIoID2nc\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n\td=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n\tt=1729332576; x=1760868576;\n\th=from:to:subject:date:message-id:mime-version:\n\tcontent-transfer-encoding;\n\tbh=bRlaZ1nOa3qfHP+DpU354kdPacfmsnYOp84Fbriagq4=;\n\tb=cIoID2ncD/Xb+MJOy+b47KlBlw/AsxQ8VYqwT5Pbg4zPjuwnZ43p0776\n\tdtZmEEnA/UsDF2uJtN9fYBVJuGRFvgU6j8s2oUb5k67n1A/kZrrjeLQ05\n\tkruM+xf35f3GJ+6CPyJF6SzZMLdAlr4QObjXOQufjmPfb2ALvrz3VdGdk\n\t/2Ax3PRffPRlokcvvNtfWSRxid+qpnzkEXQzVq3iMfKyRlhuZgFfmsVDF\n\tHeQ0TzYQDzgpjHlL1K5NiYvUXa0dZO5m1VBbdq18swVaItiPwUfRUTohD\n\tfu+sVQteD84iSi/EiNedzV6tNxgbW434Z5hvajLM2aYoaqv5XW4xPRzBI g==;",
        "X-CSE-ConnectionGUID": [
            "ftx/ShmAQF+SkCcZdkIOwQ==",
            "Zk6buDlsSai78R3ZBVH2nw=="
        ],
        "X-CSE-MsgGUID": [
            "0lhsEFyfRtGBxP8xiJjHsQ==",
            "1dAPtHZtTT27dy9mywlORg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6700,10204,11229\"; a=\"40228504\"",
            "E=Sophos;i=\"6.11,216,1725346800\"; d=\"scan'208\";a=\"40228504\"",
            "E=Sophos;i=\"6.11,216,1725346800\"; d=\"scan'208\";a=\"109916210\""
        ],
        "X-ExtLoop1": "1",
        "From": "Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v2] qcam: Automatically select the camera if only one is\n\tavailable",
        "Date": "Sat, 19 Oct 2024 12:09:25 +0200",
        "Message-Id": "<20241019100925.42808-1-stanislaw.gruszka@linux.intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When only a single camera is available, showing the camera selection\ndialog is unnecessary. It's better to automatically select the available\ncamera without prompting the user for input.\n\nSigned-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>\n---\nv2:\n- Avoid cameras().size() vs cameras()[0] race condition\n- Update in code comment\n\n src/apps/qcam/main_window.cpp | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\nindex 5144c6b3..86ffa205 100644\n--- a/src/apps/qcam/main_window.cpp\n+++ b/src/apps/qcam/main_window.cpp\n@@ -296,14 +296,23 @@ std::string MainWindow::chooseCamera()\n int MainWindow::openCamera()\n {\n \tstd::string cameraName;\n+\tint num = 0;\n \n \t/*\n-\t * Use the camera specified on the command line, if any, or display the\n-\t * camera selection dialog box otherwise.\n+\t * Use the camera specified on the command line, if any, or select the\n+\t * only one available, otherwise display the camera selection dialog box.\n \t */\n-\tif (options_.isSet(OptCamera))\n+\tif (options_.isSet(OptCamera)) {\n \t\tcameraName = static_cast<std::string>(options_[OptCamera]);\n-\telse\n+\t} else {\n+\t\tfor (const auto &cam : cm_->cameras()) {\n+\t\t\tnum++;\n+\t\t\tif (num > 1)\n+\t\t\t\tbreak;\n+\t\t\tcameraName = cam->id();\n+\t\t}\n+\t}\n+\tif (num > 1)\n \t\tcameraName = chooseCamera();\n \n \tif (cameraName == \"\")\n",
    "prefixes": [
        "v2"
    ]
}