Patch Detail
Show a patch.
GET /api/patches/3691/?format=api
{ "id": 3691, "url": "https://patchwork.libcamera.org/api/patches/3691/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3691/", "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": "<20200506103346.3433-4-email@uajain.com>", "date": "2020-05-06T10:33:55", "name": "[libcamera-devel,3/4] qcam: main_window: Introduce hotplug support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "45fd86e15720a7024e8ecb9fa67af3765243b672", "submitter": { "id": 1, "url": "https://patchwork.libcamera.org/api/people/1/?format=api", "name": "Umang Jain", "email": "email@uajain.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3691/mbox/", "series": [ { "id": 881, "url": "https://patchwork.libcamera.org/api/series/881/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=881", "date": "2020-05-06T10:33:51", "name": "Introduce UVC hotplug support", "version": 1, "mbox": "https://patchwork.libcamera.org/series/881/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3691/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3691/checks/", "tags": {}, "headers": { "Return-Path": "<bounces+15657259-5c31-libcamera-devel=lists.libcamera.org@em7280.uajain.com>", "Received": [ "from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E7D2A603F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 6 May 2020 12:33:56 +0200 (CEST)", "by filter0135p3las1.sendgrid.net with SMTP id\n\tfilter0135p3las1-28320-5EB29293-45\n\t2020-05-06 10:33:55.453271144 +0000 UTC m=+1773090.744415389", "from mail.uajain.com (unknown)\n\tby ismtpd0005p1hnd1.sendgrid.net (SG) with ESMTP id\n\toB1VGW0fSQGdyZH1_tqsxQ for <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 May 2020 10:33:54.946 +0000 (UTC)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=uajain.com\n\theader.i=@uajain.com header.b=\"jtje/80o\"; \n\tdkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:\n\tcontent-transfer-encoding:content-type;\n\ts=s1; bh=YOzeV9I0yRCuhBhV55Ws1NbDSeCQGxCmgAVL0q5ysaE=;\n\tb=jtje/80o3Ku1vQc6g82jTIXcGCV4jRBKtvAb1W/kr2AVD6smFQGTN9fK6mE8Q2m7JMhz\n\tyha/UEaKOocQgrDRUa9FpLCPK/dRDbOn2ucIEkeGzWjbu5D77pKnHOBiYpH0zclOg/jVcL\n\tM3o4SLesMrzuCU5jRVDBU8ynidq1qSeT4=", "From": "Umang Jain <email@uajain.com>", "Date": "Wed, 06 May 2020 10:33:55 +0000 (UTC)", "Message-Id": "<20200506103346.3433-4-email@uajain.com>", "In-Reply-To": "<20200506103346.3433-1-email@uajain.com>", "References": "<20200506103346.3433-1-email@uajain.com>", "Mime-Version": "1.0", "X-SG-EID": "1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcHcG1g99dnq0SJ9KzJgHEPq0KUG1dy9EmNymiHJrtKW61eXuBmqlYgdA/DCg/Df/zF8XfxjcYG4KGtvldMEXReScn5tVjNs0JYiWUAD+Zc02gAIwZ1T/lL7QDkhChpE98EahJ5S/jIUrr7fYLgfhb6BSgYCzY8axiTccO0xO7G2Vdv9mG9jwLklSjB71Hx6II", "To": "libcamera-devel <libcamera-devel@lists.libcamera.org>", "Content-Transfer-Encoding": "7bit", "Content-Type": "text/plain; charset=us-ascii", "Subject": "[libcamera-devel] [PATCH 3/4] qcam: main_window: Introduce hotplug\n\tsupport", "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>", "X-List-Received-Date": "Wed, 06 May 2020 10:33:57 -0000" }, "content": "Signed-off-by: Umang Jain <email@uajain.com>\n---\n src/qcam/main_window.cpp | 31 +++++++++++++++++++++++++++++++\n src/qcam/main_window.h | 3 +++\n 2 files changed, 34 insertions(+)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 7de0895..9db1647 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -71,6 +71,10 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \tsetCentralWidget(viewfinder_);\n \tadjustSize();\n \n+\t/* Hotplug/unplug support */\n+\tcm_->cameraAdded.connect(this, &MainWindow::addNewCamera);\n+\tcm_->cameraRemoved.connect(this, &MainWindow::removeCamera);\n+\n \t/* Open the camera and start capture. */\n \tret = openCamera();\n \tif (ret < 0) {\n@@ -525,6 +529,33 @@ void MainWindow::stopCapture()\n \tsetWindowTitle(title_);\n }\n \n+/* -----------------------------------------------------------------------------\n+ * Camera hotplugging support\n+ */\n+\n+void MainWindow::addNewCamera(Camera *cam)\n+{\n+\tqInfo() << \"Adding new camera: \" << cam->name().c_str();\n+\tcameraCombo_->addItem(QString::fromStdString(cam->name()));\n+}\n+\n+void MainWindow::removeCamera(Camera *cam)\n+{\n+\tint camIndex = cameraCombo_->findText(QString::fromStdString(cam->name()));\n+\n+\t/* Check if the currently-streaming camera is removed.\n+\t *\n+\t * \\todo Also analyse the edge-case where the only available\n+\t * camera is removed. */\n+\tif (camIndex == cameraCombo_->currentIndex()) {\n+\t\ttoggleCapture(false);\n+\t\tcameraCombo_->setCurrentIndex(0);\n+\t}\n+\n+\tqInfo() << \"Removing camera: \" << cam->name().c_str();\n+\tcameraCombo_->removeItem(camIndex);\n+}\n+\n /* -----------------------------------------------------------------------------\n * Image Save\n */\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 59fa2d9..cb2fa26 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -87,6 +87,9 @@ private:\n \tint startCapture();\n \tvoid stopCapture();\n \n+\tvoid addNewCamera(Camera *camera);\n+\tvoid removeCamera(Camera *camera);\n+\n \tvoid requestComplete(Request *request);\n \tvoid processCapture();\n \tvoid processViewfinder(FrameBuffer *buffer);\n", "prefixes": [ "libcamera-devel", "3/4" ] }