[{"id":467,"web_url":"https://patchwork.libcamera.org/comment/467/","msgid":"<20190121211007.GK4439@pendragon.ideasonboard.com>","date":"2019-01-21T21:10:07","subject":"Re: [libcamera-devel] [PATCH 2/2] libcamera: pipeline: uvcvideo:\n\tadd pipeline handler for uvcvideo","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Mon, Jan 21, 2019 at 04:30:05PM +0100, Niklas Söderlund wrote:\n> Provide a pipeline handler for uvcvideo devices. The entity names for\n> uvc devices are different for different cameras so matching on entity\n> names is not possible in the generic case. This leaves options to create\n> specialized uvc pipeline handlers if needed to fit a specific models\n\ns/uvc/UVC/\ns/models/model's/\n\n> needs.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/pipeline/meson.build  |  1 +\n>  src/libcamera/pipeline/uvcvideo.cpp | 59 +++++++++++++++++++++++++++++\n>  2 files changed, 60 insertions(+)\n>  create mode 100644 src/libcamera/pipeline/uvcvideo.cpp\n> \n> diff --git a/src/libcamera/pipeline/meson.build b/src/libcamera/pipeline/meson.build\n> index 615ecd20f1a21141..4da5d8cf9c4384bb 100644\n> --- a/src/libcamera/pipeline/meson.build\n> +++ b/src/libcamera/pipeline/meson.build\n> @@ -1,3 +1,4 @@\n>  libcamera_sources += files([\n> +    'uvcvideo.cpp',\n>      'vimc.cpp',\n>  ])\n> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\n> new file mode 100644\n> index 0000000000000000..2579782e90caec5a\n> --- /dev/null\n> +++ b/src/libcamera/pipeline/uvcvideo.cpp\n> @@ -0,0 +1,59 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * uvcvideo.cpp - Pipeline handler for uvcvideo devices\n> + */\n> +\n> +#include <libcamera/camera.h>\n> +#include <libcamera/camera_manager.h>\n> +\n> +#include \"device_enumerator.h\"\n> +#include \"media_device.h\"\n> +#include \"pipeline_handler.h\"\n> +\n> +namespace libcamera {\n> +\n> +class PipeHandlerUvcvideo : public PipelineHandler\n\nHow about PipelineHandlerUVC to retain the common prefix ?\n\n> +{\n> +public:\n> +\tPipeHandlerUvcvideo();\n> +\t~PipeHandlerUvcvideo();\n> +\n> +\tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n> +\n> +private:\n> +\tMediaDevice *dev_;\n> +};\n> +\n> +PipeHandlerUvcvideo::PipeHandlerUvcvideo()\n> +\t: dev_(nullptr)\n> +{\n> +}\n> +\n> +PipeHandlerUvcvideo::~PipeHandlerUvcvideo()\n> +{\n> +\tif (dev_)\n> +\t\tdev_->release();\n> +}\n> +\n> +bool PipeHandlerUvcvideo::match(CameraManager *manager, DeviceEnumerator *enumerator)\n> +{\n> +\tDeviceMatch dm(\"uvcvideo\");\n> +\n> +\tdev_ = enumerator->search(dm);\n> +\n> +\tif (!dev_)\n> +\t\treturn false;\n> +\n> +\tdev_->acquire();\n> +\n> +\tstd::shared_ptr<Camera> camera = Camera::create(dev_->model());\n\nDoes this guarantee unicity of the name ? I think we'll need more than\nthat, but it can probably be fixed later. I foresee the need for a\nmachine-parsable name and a human-readable description, along the lines\nof \"uvcvideo/1-5:1.0\" and \"Integrated_Webcam_HD\", or\n\"uvcvideo/3-1.3:1.0\" and \"Logitech Portable Webcam C905 on USB port\n3-1.3\" (those are real examples).\n\n> +\tmanager->addCamera(std::move(camera));\n> +\n> +\treturn true;\n\nWhile this doesn't do much, it's a stumb that allows enumerating cameras\non most development platforms, so it's very useful as such. Let's get it\nin, with the above issues fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +}\n> +\n> +REGISTER_PIPELINE_HANDLER(PipeHandlerUvcvideo);\n> +\n> +} /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6282B60B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Jan 2019 22:10:08 +0100 (CET)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D1A9453E;\n\tMon, 21 Jan 2019 22:10:07 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548105008;\n\tbh=g/qFsaKAPWcX1cEOQkJiB8SRSbA4IxKmpYF0VM7qCFI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sO2HlnkdR312UkBX3JCY30J735njBKhd9BfyJ5OJkDLpSmMll44ZLLAeASmI279np\n\tjW/aLDr8OwOCbw4pdPMCx/k3WB3RGko89GEvK+zKKAw5Ly4phEoJ48NTI3fR322pG6\n\tkaVn7ZpAW7swwPT2iSs0lkM9xiqpwsvOuCoBT6cA=","Date":"Mon, 21 Jan 2019 23:10:07 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190121211007.GK4439@pendragon.ideasonboard.com>","References":"<20190121153005.19110-1-niklas.soderlund@ragnatech.se>\n\t<20190121153005.19110-3-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190121153005.19110-3-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 2/2] libcamera: pipeline: uvcvideo:\n\tadd pipeline handler for uvcvideo","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Mon, 21 Jan 2019 21:10:08 -0000"}}]