{"id":3688,"url":"https://patchwork.libcamera.org/api/1.1/covers/3688/?format=json","web_url":"https://patchwork.libcamera.org/cover/3688/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","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-1-email@uajain.com>","date":"2020-05-06T10:33:51","name":"[libcamera-devel,0/4] Introduce UVC hotplug support","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"mbox":"https://patchwork.libcamera.org/cover/3688/mbox/","series":[{"id":881,"url":"https://patchwork.libcamera.org/api/1.1/series/881/?format=json","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/covers/3688/comments/","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 E8A38603F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 May 2020 12:33:52 +0200 (CEST)","by filter0073p3las1.sendgrid.net with SMTP id\n\tfilter0073p3las1-3640-5EB2928E-B0\n\t2020-05-06 10:33:50.835394126 +0000 UTC m=+1773089.258245711","from mail.uajain.com (unknown)\n\tby ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP id\n\tjX19BDfQSB26t9zVdvREKA for <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 May 2020 10:33:50.586 +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=\"F6D9c+kZ\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:mime-version:to:cc:content-transfer-encoding:\n\tcontent-type;\n\ts=s1; bh=CF4bVLVnoO++sPZ2jY7mP5xQZCRWO850iOpA6okRImc=;\n\tb=F6D9c+kZSaAScpmRLT7XcKrG62zKglzkMnAxF3hF4C75SOqwTwG4Gs53Wj3Ik3AvLIxp\n\tqbu9+HXDaCp1b3Mq6zoFKidQLfcrtIcyYFiqgAWBrL8fA5D3uldkSyjD8nyJM47Qp/cN/T\n\tL9UqhqkuDVCfDayysSEDe53CrGAeU2fPk=","From":"Umang Jain <email@uajain.com>","Date":"Wed, 06 May 2020 10:33:51 +0000 (UTC)","Message-Id":"<20200506103346.3433-1-email@uajain.com>","Mime-Version":"1.0","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPc7nggfkZXnk4gpr6Hf1oWqR869PN94HZjau4vp3/fI1SZf5qGE5Pl56X9iwbcs4MbxONfVE3kXPrFcuHB6mGeS+uXZ4pi2xt8SwTMV4KRJRkh2X4vI2mHa8wd9HFee72n1SqA3132eJH7Koc5t2yVyDnphTP31vGm2qd/J8Ij/CPjSc/mkXbYv4dqSpDMZbin","To":"libcamera-devel <libcamera-devel@lists.libcamera.org>","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=us-ascii","Subject":"[libcamera-devel] [PATCH 0/4] Introduce UVC hotplug support","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:53 -0000"},"content":"Hi all,\n\nThis is the patch series which introduces support for hotplugging\nand hot-unplugging UVC devices (like external webcam) while the\ncamera-manager is running. The implementation comes with a automated\nunit test and qcam integration. To test, simply compile the patch\nseries, fire up qcam, attach a UVC device and start streaming!\n\nHowever, while writing the unit-test in order to test this,\nI might have uncovered a bug in libcamera which I have not been\nable to dig deeper as of now. The unit-test simply bind/unbind a \navailable UVC camera to simulate the hotplug/unplug event.\nHowever, while unbinding a camera, I noticed that camera-manager\nstill keeps around some reference of media-directory(ies) in \n/sys/module/uvcvideo/drivers/usb:uvcvideo/ which makes\nthe symlinks keep linger around *until* the CameraManager\nis stopped. Hence, the test currently has a \"restart the\nCameraManager\" workaround to cleanup symlinks in that sysfs\ndirectory, before cleanly rebinding.\n\nUmang Jain (4):\n  libcamera: device_enumerator: Emit a signal when a new device is\n    hotplugged\n  libcamera: camera_manager: Introduce signals when a camera is\n    added/removed\n  qcam: main_window: Introduce hotplug support\n  tests: Introduce hotplug hot-unplug unit test\n\n include/libcamera/camera_manager.h        |   4 +\n src/libcamera/camera_manager.cpp          |  47 ++++++-\n src/libcamera/device_enumerator.cpp       |  10 ++\n src/libcamera/include/device_enumerator.h |   3 +\n src/qcam/main_window.cpp                  |  31 +++++\n src/qcam/main_window.h                    |   3 +\n test/hotplug-cameras.cpp                  | 152 ++++++++++++++++++++++\n test/meson.build                          |   1 +\n 8 files changed, 249 insertions(+), 2 deletions(-)\n create mode 100644 test/hotplug-cameras.cpp"}