From patchwork Tue Jun 16 19:45:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 4065 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D73C1603C4 for ; Tue, 16 Jun 2020 21:45:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="eZOXOXmb"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:mime-version:to:cc:content-type: content-transfer-encoding; s=s1; bh=GMq6a7YbGQ5jWaj9l4gSPCTWEOe6U+/nbpJJpx8q/Bg=; b=eZOXOXmbHuzQgeUoNq9O2iayxF/7R8zhwRcX+nw6llh1GohyWfEe1t2rYCtTak4nbOZt Coj1yfAK1r5ZwkUJFA53o13aia30M4fROx6sVJSX0LcSv8qaBaTIvUFQPyRBefU6f0qs13 u8Ri8FFRuhOtcON/7hKbQjseth9o0LNeI= Received: by filter0135p3las1.sendgrid.net with SMTP id filter0135p3las1-31150-5EE9215C-100 2020-06-16 19:45:32.775346366 +0000 UTC m=+696613.763536559 Received: from mail.uajain.com (unknown) by ismtpd0008p1hnd1.sendgrid.net (SG) with ESMTP id bOjg1rY5Q3-ViCCarMv85g Tue, 16 Jun 2020 19:45:32.528 +0000 (UTC) From: Umang Jain Date: Tue, 16 Jun 2020 19:45:32 +0000 (UTC) Message-Id: <20200616194523.23268-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcZSRriRpMrvF+w7NThKsF/EM5+TBU7M/eEzrVLp9sOiTJEiVNMkPnbkKGOxghb1AS6dyNJXPF3G45mB89RKDxJ8i+2H010mcgb1grItPOnr0eaMHV4Seer5M4/Ftbwd34xRBNdFU9hJ0VadaM5vjMt5nNCnrF6kOmkMEaSAOHCniK9cwXUI9QNd64suapfkMk To: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v5 0/6] Introduce UVC hotplugging support X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2020 19:45:35 -0000 v4->v5: - Rework "libcamera: CameraManager: Drop the vector of created PipelineHandlers" commit to guard against the possibility of pipeline handler getting deleted in PipelineHandler::disconnect(). Add a _lot_ of documentation to it via commit message and a comment. - Make sure no use-after-free errors are present when the unit-test runs under valgrind. Fold the patch given by Laurent in previous review to properly address and document it. - Provide more past context to "libcamera: CameraManager: Drop the vector of created PipelineHandlers" in commit message, to 'why' pipes_ vector is not needed anymore. - Few typos fixes. v3->v4: - Introduce one additional commit to eliminate Pipehandlers' vector from CameraManager. It was leaving behind a leaked reference which was causing unclean unbind->bind operation (due to dangling dirs) for the hotplug unit test to run. - Simplify hotplug unit test with use of std::ofstream. - Change CameraManager::Private::addCamera() signature to accept Camera arg as pass-by-value instead of pass-by-reference. - qcam: Finalize HotplugEvent naming with ::HotPlug and ::HotUnplug - Few small improvements in commit messages and rebase. Umang Jain (6): libcamera: CameraManager: Drop the vector of created PipelineHandlers libcamera: camera_manager: Refactor pipelines creation into separate function libcamera: device_enumerator: Emit a signal when new devices are added libcamera: camera_manager: Introduce signals when a camera is added or removed qcam: main_window: Introduce initial hotplug support tests: Introduce hotplug hot-unplug unit test include/libcamera/camera_manager.h | 6 +- .../libcamera/internal/device_enumerator.h | 4 + src/libcamera/camera_manager.cpp | 65 ++++++--- src/libcamera/device_enumerator.cpp | 13 ++ src/libcamera/pipeline_handler.cpp | 20 ++- src/qcam/main_window.cpp | 76 +++++++++++ src/qcam/main_window.h | 6 + test/hotplug-cameras.cpp | 128 ++++++++++++++++++ test/meson.build | 1 + 9 files changed, 298 insertions(+), 21 deletions(-) create mode 100644 test/hotplug-cameras.cpp