[libcamera-devel,v7,0/9] libcamera: Generate unique and stable camera IDs
mbox series

Message ID 20200804161358.1628962-1-niklas.soderlund@ragnatech.se
Headers show
Series
  • libcamera: Generate unique and stable camera IDs
Related show

Message

Niklas Söderlund Aug. 4, 2020, 4:13 p.m. UTC
Hello,

This series aims to make and enforce unique camera names that are static
between system resets. This version is a complete rewrite of previous 
versions and centers around on firmware descriptions. Biggest chance in 
this version is that the UVC ides are reworked from scratch.

Before this series camera names on different systems looked like this (I
do not have access to a simple pipeline device):

- ipu3
    ov13858 8-0010
    ov5670 10-0036
- raspberrypi
    imx219
- rkisp1
    ov5695 7-0036
    ov2685 7-003c
- uvcvideo
    Venus USB2.0 Camera: Venus USB2
    Logitech Webcam C930e
- vimc
    VIMC Sensor B

With this series applied camera names on the same systems:

- ipu3
    \_SB_.PCI0.I2C2.CAM0
    \_SB_.PCI0.I2C4.CAM1
- raspberrypi
    base/soc/i2c0mux/i2c@1/imx219@10
- rkisp1
    base/i2c@ff160000/camera@36
    base/i2c@ff160000/camera@3c
- uvcvideo
    \_SB_.PCI0.RP05.PXSX-2.1.1:1.0-0ac8:3420
    \_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843
- vimc
    platform:vimc Sensor B

Niklas Söderlund (9):
  libcamera: sysfs: Add new namespace to interact with sysfs
  libcamera: sysfs: Add method to lookup firmware ID
  libcamera: v4l2_device: Add method to lookup device path
  libcamera: camera_sensor: Generate a sensor ID
  libcamera: camera_sensor: Add accessors for sensor ID
  libcamera: pipelines: Use sensor ID as camera name
  libcamera: pipeline: uvcvideo: Generate unique camera names
  libcamera: camera: Rename name() to id()
  libcamera: camera_manager: Enforce unique camera IDs

 include/libcamera/camera.h                    |   6 +-
 include/libcamera/internal/camera_sensor.h    |   4 +
 include/libcamera/internal/meson.build        |   1 +
 include/libcamera/internal/sysfs.h            |  24 ++++
 include/libcamera/internal/v4l2_device.h      |   1 +
 src/android/camera_device.cpp                 |   4 +-
 src/cam/main.cpp                              |   8 +-
 src/gstreamer/gstlibcameraprovider.cpp        |   4 +-
 src/gstreamer/gstlibcamerasrc.cpp             |   6 +-
 src/libcamera/camera.cpp                      |  40 ++++---
 src/libcamera/camera_controls.cpp             |   2 +-
 src/libcamera/camera_manager.cpp              |  20 ++--
 src/libcamera/camera_sensor.cpp               |  48 ++++++++
 src/libcamera/framebuffer_allocator.cpp       |   2 +-
 src/libcamera/meson.build                     |   1 +
 src/libcamera/pipeline/ipu3/ipu3.cpp          |  12 +-
 .../pipeline/raspberrypi/raspberrypi.cpp      |   7 +-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  16 +--
 src/libcamera/pipeline/simple/simple.cpp      |   2 +-
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  77 ++++++++++++-
 src/libcamera/pipeline/vimc/vimc.cpp          |   4 +-
 src/libcamera/sysfs.cpp                       | 105 ++++++++++++++++++
 src/libcamera/v4l2_device.cpp                 |  28 +++++
 src/qcam/dng_writer.cpp                       |   4 +-
 src/qcam/main_window.cpp                      |  18 +--
 src/v4l2/v4l2_camera_proxy.cpp                |   2 +-
 test/camera/buffer_import.cpp                 |   2 +-
 test/camera/capture.cpp                       |   2 +-
 test/camera/configuration_default.cpp         |   2 +-
 test/camera/configuration_set.cpp             |   2 +-
 test/camera/statemachine.cpp                  |   2 +-
 test/controls/control_info_map.cpp            |   2 +-
 test/controls/control_list.cpp                |   2 +-
 test/pipeline/ipu3/ipu3_pipeline_test.cpp     |   2 +-
 test/pipeline/rkisp1/rkisp1_pipeline_test.cpp |   2 +-
 test/serialization/serialization_test.h       |   2 +-
 36 files changed, 381 insertions(+), 85 deletions(-)
 create mode 100644 include/libcamera/internal/sysfs.h
 create mode 100644 src/libcamera/sysfs.cpp

Comments

Laurent Pinchart Aug. 4, 2020, 7:47 p.m. UTC | #1
Hi Niklas,

Thank you for the patches.

On Tue, Aug 04, 2020 at 06:13:49PM +0200, Niklas Söderlund wrote:
> Hello,
> 
> This series aims to make and enforce unique camera names that are static
> between system resets. This version is a complete rewrite of previous 
> versions and centers around on firmware descriptions. Biggest chance in 
> this version is that the UVC ides are reworked from scratch.
> 
> Before this series camera names on different systems looked like this (I
> do not have access to a simple pipeline device):
> 
> - ipu3
>     ov13858 8-0010
>     ov5670 10-0036
> - raspberrypi
>     imx219
> - rkisp1
>     ov5695 7-0036
>     ov2685 7-003c
> - uvcvideo
>     Venus USB2.0 Camera: Venus USB2
>     Logitech Webcam C930e
> - vimc
>     VIMC Sensor B
> 
> With this series applied camera names on the same systems:
> 
> - ipu3
>     \_SB_.PCI0.I2C2.CAM0
>     \_SB_.PCI0.I2C4.CAM1
> - raspberrypi
>     base/soc/i2c0mux/i2c@1/imx219@10
> - rkisp1
>     base/i2c@ff160000/camera@36
>     base/i2c@ff160000/camera@3c
> - uvcvideo
>     \_SB_.PCI0.RP05.PXSX-2.1.1:1.0-0ac8:3420
>     \_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843
> - vimc
>     platform:vimc Sensor B

That's really nice :-)

I've tested the patches with the simple pipeline handler:

- Before: imx296 2-0036
- After: base/soc/bus@30800000/i2c@30a40000/camera@36

> Niklas Söderlund (9):
>   libcamera: sysfs: Add new namespace to interact with sysfs
>   libcamera: sysfs: Add method to lookup firmware ID
>   libcamera: v4l2_device: Add method to lookup device path
>   libcamera: camera_sensor: Generate a sensor ID
>   libcamera: camera_sensor: Add accessors for sensor ID
>   libcamera: pipelines: Use sensor ID as camera name
>   libcamera: pipeline: uvcvideo: Generate unique camera names
>   libcamera: camera: Rename name() to id()
>   libcamera: camera_manager: Enforce unique camera IDs
> 
>  include/libcamera/camera.h                    |   6 +-
>  include/libcamera/internal/camera_sensor.h    |   4 +
>  include/libcamera/internal/meson.build        |   1 +
>  include/libcamera/internal/sysfs.h            |  24 ++++
>  include/libcamera/internal/v4l2_device.h      |   1 +
>  src/android/camera_device.cpp                 |   4 +-
>  src/cam/main.cpp                              |   8 +-
>  src/gstreamer/gstlibcameraprovider.cpp        |   4 +-
>  src/gstreamer/gstlibcamerasrc.cpp             |   6 +-
>  src/libcamera/camera.cpp                      |  40 ++++---
>  src/libcamera/camera_controls.cpp             |   2 +-
>  src/libcamera/camera_manager.cpp              |  20 ++--
>  src/libcamera/camera_sensor.cpp               |  48 ++++++++
>  src/libcamera/framebuffer_allocator.cpp       |   2 +-
>  src/libcamera/meson.build                     |   1 +
>  src/libcamera/pipeline/ipu3/ipu3.cpp          |  12 +-
>  .../pipeline/raspberrypi/raspberrypi.cpp      |   7 +-
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  16 +--
>  src/libcamera/pipeline/simple/simple.cpp      |   2 +-
>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  77 ++++++++++++-
>  src/libcamera/pipeline/vimc/vimc.cpp          |   4 +-
>  src/libcamera/sysfs.cpp                       | 105 ++++++++++++++++++
>  src/libcamera/v4l2_device.cpp                 |  28 +++++
>  src/qcam/dng_writer.cpp                       |   4 +-
>  src/qcam/main_window.cpp                      |  18 +--
>  src/v4l2/v4l2_camera_proxy.cpp                |   2 +-
>  test/camera/buffer_import.cpp                 |   2 +-
>  test/camera/capture.cpp                       |   2 +-
>  test/camera/configuration_default.cpp         |   2 +-
>  test/camera/configuration_set.cpp             |   2 +-
>  test/camera/statemachine.cpp                  |   2 +-
>  test/controls/control_info_map.cpp            |   2 +-
>  test/controls/control_list.cpp                |   2 +-
>  test/pipeline/ipu3/ipu3_pipeline_test.cpp     |   2 +-
>  test/pipeline/rkisp1/rkisp1_pipeline_test.cpp |   2 +-
>  test/serialization/serialization_test.h       |   2 +-
>  36 files changed, 381 insertions(+), 85 deletions(-)
>  create mode 100644 include/libcamera/internal/sysfs.h
>  create mode 100644 src/libcamera/sysfs.cpp
>
Niklas Söderlund Aug. 5, 2020, 10:39 a.m. UTC | #2
Hi Laurent,

Thanks for your feedback.

On 2020-08-04 22:47:12 +0300, Laurent Pinchart wrote:
> Hi Niklas,
> 
> Thank you for the patches.
> 
> On Tue, Aug 04, 2020 at 06:13:49PM +0200, Niklas Söderlund wrote:
> > Hello,
> > 
> > This series aims to make and enforce unique camera names that are static
> > between system resets. This version is a complete rewrite of previous 
> > versions and centers around on firmware descriptions. Biggest chance in 
> > this version is that the UVC ides are reworked from scratch.
> > 
> > Before this series camera names on different systems looked like this (I
> > do not have access to a simple pipeline device):
> > 
> > - ipu3
> >     ov13858 8-0010
> >     ov5670 10-0036
> > - raspberrypi
> >     imx219
> > - rkisp1
> >     ov5695 7-0036
> >     ov2685 7-003c
> > - uvcvideo
> >     Venus USB2.0 Camera: Venus USB2
> >     Logitech Webcam C930e
> > - vimc
> >     VIMC Sensor B
> > 
> > With this series applied camera names on the same systems:
> > 
> > - ipu3
> >     \_SB_.PCI0.I2C2.CAM0
> >     \_SB_.PCI0.I2C4.CAM1
> > - raspberrypi
> >     base/soc/i2c0mux/i2c@1/imx219@10
> > - rkisp1
> >     base/i2c@ff160000/camera@36
> >     base/i2c@ff160000/camera@3c
> > - uvcvideo
> >     \_SB_.PCI0.RP05.PXSX-2.1.1:1.0-0ac8:3420
> >     \_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843
> > - vimc
> >     platform:vimc Sensor B
> 
> That's really nice :-)
> 
> I've tested the patches with the simple pipeline handler:
> 
> - Before: imx296 2-0036
> - After: base/soc/bus@30800000/i2c@30a40000/camera@36

This for this report, I'm happy it works for other hardware then the one 
I'm able to test on ;-)

> 
> > Niklas Söderlund (9):
> >   libcamera: sysfs: Add new namespace to interact with sysfs
> >   libcamera: sysfs: Add method to lookup firmware ID
> >   libcamera: v4l2_device: Add method to lookup device path
> >   libcamera: camera_sensor: Generate a sensor ID
> >   libcamera: camera_sensor: Add accessors for sensor ID
> >   libcamera: pipelines: Use sensor ID as camera name
> >   libcamera: pipeline: uvcvideo: Generate unique camera names
> >   libcamera: camera: Rename name() to id()
> >   libcamera: camera_manager: Enforce unique camera IDs
> > 
> >  include/libcamera/camera.h                    |   6 +-
> >  include/libcamera/internal/camera_sensor.h    |   4 +
> >  include/libcamera/internal/meson.build        |   1 +
> >  include/libcamera/internal/sysfs.h            |  24 ++++
> >  include/libcamera/internal/v4l2_device.h      |   1 +
> >  src/android/camera_device.cpp                 |   4 +-
> >  src/cam/main.cpp                              |   8 +-
> >  src/gstreamer/gstlibcameraprovider.cpp        |   4 +-
> >  src/gstreamer/gstlibcamerasrc.cpp             |   6 +-
> >  src/libcamera/camera.cpp                      |  40 ++++---
> >  src/libcamera/camera_controls.cpp             |   2 +-
> >  src/libcamera/camera_manager.cpp              |  20 ++--
> >  src/libcamera/camera_sensor.cpp               |  48 ++++++++
> >  src/libcamera/framebuffer_allocator.cpp       |   2 +-
> >  src/libcamera/meson.build                     |   1 +
> >  src/libcamera/pipeline/ipu3/ipu3.cpp          |  12 +-
> >  .../pipeline/raspberrypi/raspberrypi.cpp      |   7 +-
> >  src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  16 +--
> >  src/libcamera/pipeline/simple/simple.cpp      |   2 +-
> >  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |  77 ++++++++++++-
> >  src/libcamera/pipeline/vimc/vimc.cpp          |   4 +-
> >  src/libcamera/sysfs.cpp                       | 105 ++++++++++++++++++
> >  src/libcamera/v4l2_device.cpp                 |  28 +++++
> >  src/qcam/dng_writer.cpp                       |   4 +-
> >  src/qcam/main_window.cpp                      |  18 +--
> >  src/v4l2/v4l2_camera_proxy.cpp                |   2 +-
> >  test/camera/buffer_import.cpp                 |   2 +-
> >  test/camera/capture.cpp                       |   2 +-
> >  test/camera/configuration_default.cpp         |   2 +-
> >  test/camera/configuration_set.cpp             |   2 +-
> >  test/camera/statemachine.cpp                  |   2 +-
> >  test/controls/control_info_map.cpp            |   2 +-
> >  test/controls/control_list.cpp                |   2 +-
> >  test/pipeline/ipu3/ipu3_pipeline_test.cpp     |   2 +-
> >  test/pipeline/rkisp1/rkisp1_pipeline_test.cpp |   2 +-
> >  test/serialization/serialization_test.h       |   2 +-
> >  36 files changed, 381 insertions(+), 85 deletions(-)
> >  create mode 100644 include/libcamera/internal/sysfs.h
> >  create mode 100644 src/libcamera/sysfs.cpp
> > 
> 
> -- 
> Regards,
> 
> Laurent Pinchart