From patchwork Mon Dec 23 07:26:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 2446 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 45F57605D0 for ; Mon, 23 Dec 2019 08:26:50 +0100 (CET) Received: from neptunite.amanokami.net (173-16-160-11.client.mchsi.com [173.16.160.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 35E8E330; Mon, 23 Dec 2019 08:26:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1577086010; bh=XjPedv3ULegMUBy6xhhY2mZExTaVM1tfjZZagdkETd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eHLoH71bpLxokfRZ7RvZ9BjdAwamgMJ9UHpQN1i5qxX+vpB6EfHqg2Tq8jakDa6C7 i0Ay7bHcEQRGoambVdRu7zYCv+fjRfXgfmGhzaAQFuUS2RG15/eWZVgqOtPbBDUqYS mj6eMyh/94Quxky4mGJicA/jE9G8MfCsN+6+YCwk= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Dec 2019 01:26:17 -0600 Message-Id: <20191223072620.13022-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191223072620.13022-1-paul.elder@ideasonboard.com> References: <20191223072620.13022-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/6] libcamera: pipeline_handler: uvcvideo: register all Cameras along with a devnum 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: Mon, 23 Dec 2019 07:26:50 -0000 Register all UVC Cameras along with its device number, to eventually allow the V4L2 compatibility layer to match against it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- New in v3 --- src/libcamera/pipeline/uvcvideo.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 3043366b..096c1c09 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -294,17 +295,19 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) return false; std::unique_ptr data = utils::make_unique(this); + dev_t devnum = 0; /* Locate and initialise the camera data with the default video node. */ for (MediaEntity *entity : media->entities()) { if (entity->flags() & MEDIA_ENT_FL_DEFAULT) { if (data->init(entity)) return false; + devnum = makedev(entity->deviceMajor(), entity->deviceMinor()); break; } } - if (!data) { + if (!data || !devnum) { LOG(UVC, Error) << "Could not find a default video device"; return false; } @@ -312,7 +315,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator) /* Create and register the camera. */ std::set streams{ &data->stream_ }; std::shared_ptr camera = Camera::create(this, media->model(), streams); - registerCamera(std::move(camera), std::move(data)); + registerCamera(std::move(camera), std::move(data), devnum); /* Enable hot-unplug notifications. */ hotplugMediaDevice(media);