From patchwork Mon Aug 10 12:04:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 9272 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AAE18BD87D for ; Mon, 10 Aug 2020 12:04:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id ED33C60F27; Mon, 10 Aug 2020 14:04:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="hqx3bspg"; dkim-atps=neutral Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D41D60DCA for ; Mon, 10 Aug 2020 14:04:13 +0200 (CEST) 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=2hvchwMYv1l9Tnnb8CFXGVZceApNWpcCPyHk1+5IK28=; b=hqx3bspgm0aiIG2s/9w9zKk/033nprjPKES9z9XDQF986OUjWUCOIyO/m7xzFrNOI/Bd pr+WoKIHJerHIU17jZJ9AUtGbWh6AMCTFoiYcePgwCQ4AFxmm8wXGe9anWa09Con0dYOJy g6A1cNpLCzoznatMaqk5Cv3Cv1BPOTXDM= Received: by filterdrecv-p3las1-canary-695b95b5f7-4z57j with SMTP id filterdrecv-p3las1-canary-695b95b5f7-4z57j-19-5F3137BA-135 2020-08-10 12:04:11.183701171 +0000 UTC m=+1019291.604134524 Received: from mail.uajain.com (unknown) by ismtpd0003p1maa1.sendgrid.net (SG) with ESMTP id _VDpY-w6Rtm0o8nsvtV24A for ; Mon, 10 Aug 2020 12:04:10.534 +0000 (UTC) From: Umang Jain Date: Mon, 10 Aug 2020 12:04:11 +0000 (UTC) Message-Id: <20200810120406.52654-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPc9vLW9W8H4bP+KZ0PPVtun1Yrxv2Kv21+EEtvbtDfRfZDoIPNJqqboTM5Fq7jYVpIhc3PQi1jD0z0V0ycnXWeXHv18gXA/zqWnFJURg2NvVyqX8PWFG0jHrEQIHRa5VBQMs7jjnwoE7PYcH/k5tXAROSRl9gYMvrmN4OVF5utgVP4euIiOQzR0O0ayfNWp/9ym8vimDTnHqZ8ZxZif3wgpFNsuCVFElsWCUdeg5/g57w= To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH v2 0/4] android: Camera hotplug 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Changes from v1: - Treat all UVC cameras as external - based off Laurent's suggestion. -It's difficult to know whether a UVC camera is external or internal. Hence, treat all UVC camereas as external by setting their CameraLocation property as CameraLocationExternal. - Use different IDs for internal and external cameras. -Internal camera IDs are meant to be started with 0 and external/removable ones from 1000. Also, support that if the camera has been seen in the past, reuse it's ID. - Few changes dealing with race conditions, locking and graceful handling of currently streaming camera. Tested: - Camera hotplug and unplug by running cros_camera_service, their assigned IDs. Unfortunately I only have UVC cameras(#2) so the IDs always started with 1000 and so on. - Hotplug/Hot-unplug entry updated on chrome::media-internals in real time. Untested: - Hot-unplug of an currently open/streaming camera. The patch 4/4 deals with this is only a compile-test-only patch, not tested end-of-end. I am now looking into how to make libcamera streaming work with an UVC camera so that I can test this use case too with the internal CrOS camera application. Umang Jain (4): libcamera: pipeline: uvcvideo: Treat all UVC cameras as external android: camera_hal_manager: Set camera module callbacks android: camera_hal_manager: Support camera hotplug android: camera_hal_manager: Handle hot-unplug of currently open camera src/android/camera3_hal.cpp | 2 + src/android/camera_device.cpp | 15 ++ src/android/camera_device.h | 9 +- src/android/camera_hal_manager.cpp | 174 ++++++++++++++++--- src/android/camera_hal_manager.h | 20 ++- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 + 6 files changed, 197 insertions(+), 27 deletions(-)