[libcamera-devel] [PATCH 0/1] Generalized DeviceMatch

Sophie Friedrich dev at flowerpot.me
Thu Mar 2 01:54:14 CET 2023


In preparation for introducing libusb support into libcamera, we need
to generalize the matching functionality. The `MediaEntity` class was
never meant to handle the cases required for e.g. libusb. Additionally
the current way matching is handled is insufficient for (future)
`MediaDevices` in which a specific key/value relationship exists
for properties (e.g. USB vid and pid).

To solve these two problems I've abstracted away the requirements for
entities that `DeviceMatch` requires in `DeviceMatchEntityInterface`
and extended `DeviceMatch` to handle key/value pairs. Using "*" as a
key is currently a catch all for the presumably keyless property of
V4L2 `MediaEntity`.

Sophie Friedrich (1):
  libcamera: enumeration: Generalize DeviceMatch

 .../libcamera/internal/device_enumerator.h    |  16 +--
 include/libcamera/internal/device_match.h     |  46 +++++++
 include/libcamera/internal/media_device.h     |   1 +
 include/libcamera/internal/media_object.h     |   7 +-
 include/libcamera/internal/meson.build        |   1 +
 src/libcamera/device_enumerator.cpp           |  73 ----------
 src/libcamera/device_match.cpp                | 126 ++++++++++++++++++
 src/libcamera/meson.build                     |   1 +
 8 files changed, 183 insertions(+), 88 deletions(-)
 create mode 100644 include/libcamera/internal/device_match.h
 create mode 100644 src/libcamera/device_match.cpp

-- 
2.34.1



More information about the libcamera-devel mailing list