From patchwork Tue Dec 31 05:33:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 2480 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 D479860465 for ; Tue, 31 Dec 2019 06:33:27 +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 915A3B76; Tue, 31 Dec 2019 06:33:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1577770407; bh=dOAs2LYtUhJ1boZ7yjcU847mYZ59gSvd1VScfNM8mVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j25DWgEg0tMgvV5O6c25AFWSrwu8qENnuUBWZ/A+SAE6WjcIfaYxxriKZni7oQPzV 8CguET/Y2TlzVPsJf1qu4J25UErMjl7EdGsYRaiIwHGXNHiLYdzmVl3MGoM64rXwvb TWao+81Q8f9LqVm7xZgaqBPvzaxQT6bVJg0dbTSs= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 30 Dec 2019 23:33:13 -0600 Message-Id: <20191231053314.20063-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191231053314.20063-1-paul.elder@ideasonboard.com> References: <20191231053314.20063-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 3/4] 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: Tue, 31 Dec 2019 05:33:28 -0000 Register all UVC Cameras along with their device numbers, to eventually allow the V4L2 compatibility layer to match against it. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Laurent Pinchart --- No change in v4 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);