[v2,0/4] Use regular expressions for entity name matching
mbox series

Message ID 20250717124853.2317191-1-dan.scally@ideasonboard.com
Headers show
Series
  • Use regular expressions for entity name matching
Related show

Message

Daniel Scally July 17, 2025, 12:48 p.m. UTC
There are a couple of places in libcamera that fetch a MediaEntity
from a MediaDevice using the entity's name. This has raised an issue
lately on the RZ/V2H platforms, as the drivers for some of the
hardware give the entities that they create names that incorporate
things like the memory address for the hardware's registers. If we
simply use those names as-is then the pipeline handler would only
work for the instance of the hardware that's at the hard-coded
address and not any of the others.

To work around the issue, this series updates libcamera to add overloads for the
entity matching functions that accept a regex instead of a string. Existing call
sites which just pass a normal string should work unaffected, but new
call sites could pass a std::regex instead that then matches for entities using
the pattern instead of direct matches only.

Thanks
Dan


Daniel Scally (4):
  libcamera: base: Wrap <regex.h>
  libcamera: device_enumerator: Support regex to match entity names
  libcamera: media_device: Allow for a regex to match entity name
  libcamera: V4L2Subdevice: Allow for a regex to match entity name

 include/libcamera/base/meson.build            |  1 +
 include/libcamera/base/regex.h                | 13 +++++++
 .../libcamera/internal/device_enumerator.h    |  4 +-
 include/libcamera/internal/media_device.h     |  2 +
 include/libcamera/internal/v4l2_subdevice.h   |  3 ++
 src/libcamera/device_enumerator.cpp           | 37 ++++++++++++++++++-
 src/libcamera/media_device.cpp                | 25 +++++++++++++
 src/libcamera/v4l2_subdevice.cpp              | 27 ++++++++++----
 8 files changed, 103 insertions(+), 9 deletions(-)
 create mode 100644 include/libcamera/base/regex.h