{"id":8849,"url":"https://patchwork.libcamera.org/api/covers/8849/?format=json","web_url":"https://patchwork.libcamera.org/cover/8849/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200718132324.867815-1-niklas.soderlund@ragnatech.se>","date":"2020-07-18T13:23:15","name":"[libcamera-devel,0/9] libcamera: camera: Add camera ID","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/cover/8849/mbox/","series":[{"id":1115,"url":"https://patchwork.libcamera.org/api/series/1115/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1115","date":"2020-07-18T13:23:15","name":"libcamera: camera: Add camera ID","version":1,"mbox":"https://patchwork.libcamera.org/series/1115/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/8849/comments/","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3D2D1C0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 18 Jul 2020 13:23:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 429CB60589;\n\tSat, 18 Jul 2020 15:23:34 +0200 (CEST)","from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A28D60493\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Jul 2020 15:23:32 +0200 (CEST)","from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de\n\t[79.202.46.202]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid dc891b3a-c8f9-11ea-933e-005056917a89;\n\tSat, 18 Jul 2020 15:23:29 +0200 (CEST)"],"X-Halon-ID":"dc891b3a-c8f9-11ea-933e-005056917a89","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 18 Jul 2020 15:23:15 +0200","Message-Id":"<20200718132324.867815-1-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.27.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 0/9] libcamera: camera: Add camera ID","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Hello,\n\nThis series aims to add a ID to each camera in addition to it's more \nuser-friendly name. The ID is unique and persistent between reboots of \nthe same system. The use-case for this is to create a single \nmachine-friendly ID that can be stored and used to always resolve to the \nsame camera.\n\nThe idea on how to generate a ID is to take the sysfs path of the sensor \ndevice which is part of each camera pipeline. As the path describes the \nlocation of the sensor hardware it is persistent across reboots and as \nthe path is read from sysfs it's guaranteed to be unique in the system.\n\nFor pipelines that do not have a sensor (UVC) the sysfs path of the main \nvideo device is used instead. That path resolves to the USB device and \nincludes the USB bus information so it satisfy the ID requirements.\n\nWhile working with this problem it became apparent that two pipelines \ndiverge from the others on how they name their cameras, raspberrypi and \nvimc. This series aligns these two and adds a helper to avoid such \nsituations in the future. Unfortunately this means the user-friendly \nname of the sensor changes but this proves the need for a \nmachine-friendly ID which luckily this series also adds :-)\n\nBefore this series camera user-friendly names on different systems \nlooked like this (I do not have access to a simple pipeline device):\n\n- ipu3\n        ov13858 8-0010\n        ov5670 10-0036\n- raspberrypi\n        imx219\n- rkisp1\n        ov5695 7-0036\n        ov2685 7-003c\n- uvcvideo\n        Logitech Webcam C930e\n- vimc\n        VIMC Sensor B\n\nWith this series applied the user-friendly names machine-friendly ID on \nthe same systems look like this:\n\nThe format is:\n    <user-friendly name> (<machine-friendly ID>)\n\n- ipu3\n        ov13858 8-0010 (pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8/i2c-OVTID858:00)\n        ov5670 10-0036 (pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-INT3479:00)\n- raspberrypi\n        imx219 10-0010 (platform/soc/3f205000.i2c/i2c-11/i2c-10/10-0010)\n- rkisp1\n        ov5695 7-0036 (platform/ff160000.i2c/i2c-7/7-0036)\n        ov2685 7-003c (platform/ff160000.i2c/i2c-7/7-003c)\n- uvcvideo\n        Logitech Webcam C930e (pci0000:00/0000:00:1c.4/0000:08:00.0/0000:09:02.0/0000:25:00.0/usb3/3-2/3-2.4/3-2.4:1.0)\n- vimc\n        Sensor B (platform/vimc.0)\n\nWhere it previously where possible to select a camera by its \nuser-friendly name its now possible to also select it using its \nmachine-friendly one. The following is therefor two equivalent \ncommands:\n\n    $ cam -c \"Logitech Webcam C930e\" -C\n    $ cam -c \"pci0000:00/0000:00:1c.4/0000:08:00.0/0000:09:02.0/0000:25:00.0/usb3/3-2/3-2.4/3-2.4:1.0\" -C\n\nNiklas Söderlund (9):\n  libcamera: v4l2_device: Add method to lookup device path\n  libcamera: camera_sensor: Expose a sensor ID\n  libcamera: camera: Add camera ID\n  libcamera: camera_manager: Enforce unique camera IDs\n  libcamera: camera_manager: Try to match camera IDs first\n  libcamera: pipeline: vimc: Align camera name\n  libcamera: pipeline: raspberrypi: Align camera name\n  libcamera: camera: Add create() that operates on CameraSensor\n  cam: Print camera IDs when listing cameras\n\n include/libcamera/camera.h                    | 11 +++-\n include/libcamera/internal/camera_sensor.h    |  2 +\n include/libcamera/internal/v4l2_device.h      |  1 +\n src/cam/main.cpp                              |  3 +-\n src/libcamera/camera.cpp                      | 54 +++++++++++++++----\n src/libcamera/camera_manager.cpp              | 13 +++++\n src/libcamera/camera_sensor.cpp               | 17 ++++++\n src/libcamera/pipeline/ipu3/ipu3.cpp          |  9 ++--\n .../pipeline/raspberrypi/raspberrypi.cpp      |  3 +-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  2 +-\n src/libcamera/pipeline/simple/simple.cpp      |  3 +-\n src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  7 ++-\n src/libcamera/pipeline/vimc/vimc.cpp          |  4 +-\n src/libcamera/v4l2_device.cpp                 | 27 ++++++++++\n test/camera/buffer_import.cpp                 |  2 +-\n test/camera/capture.cpp                       |  2 +-\n test/camera/configuration_default.cpp         |  2 +-\n test/camera/configuration_set.cpp             |  2 +-\n test/camera/statemachine.cpp                  |  2 +-\n test/controls/control_info_map.cpp            |  2 +-\n test/controls/control_list.cpp                |  2 +-\n 21 files changed, 138 insertions(+), 32 deletions(-)"}