libcamera: V4L2Subdevice: Get device by regexp
Some kernel drivers give their entities names that will differ from
implementation to implementation; for example the drivers for the
Camera Receiver Unit and CSI-2 receiver in the RZ/V2H(P) SoC give their
entities names that include their memory address, in the format
"csi-16000400.csi2". Passing that entity name to
V4L2Subdevice::fromEntityName() is too inflexible given it would only
then work if that specific CSI-2 receiver were the one being used.
Add an overload for V4L2Subdevice::fromEntityName() to instead allow
users to pass a std::basic_regex, and use std::regex_search() instead
of a direct string comparison to find a matching entity. Ths allows
us to form regular expressions like "csi-[0-9a-f]{8}.csi2" to find
the entities.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
committed by
Jacopo Mondi
parent
1e92c4cc0d
commit
f4c3dee217
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <libcamera/base/class.h>
|
||||
#include <libcamera/base/log.h>
|
||||
#include <libcamera/base/regex.h>
|
||||
|
||||
#include <libcamera/color_space.h>
|
||||
#include <libcamera/geometry.h>
|
||||
@@ -163,6 +164,8 @@ public:
|
||||
|
||||
static std::unique_ptr<V4L2Subdevice>
|
||||
fromEntityName(const MediaDevice *media, const std::string &entity);
|
||||
static std::unique_ptr<V4L2Subdevice>
|
||||
fromEntityName(const MediaDevice *media, const std::regex &entity);
|
||||
|
||||
protected:
|
||||
std::string logPrefix() const override;
|
||||
|
||||
Reference in New Issue
Block a user