diff options
-rw-r--r-- | src/libcamera/device_enumerator.cpp | 19 | ||||
-rw-r--r-- | src/libcamera/include/device_enumerator.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index 8e8b280f..4373fdf0 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -121,6 +121,25 @@ bool DeviceMatch::match(const DeviceInfo *info) const * Enumerator Base */ +DeviceEnumerator *DeviceEnumerator::create() +{ + DeviceEnumerator *enumerator; + + /* TODO: add compile time checks to only try udev enumerator if libudev is available */ + enumerator = new DeviceEnumeratorUdev(); + if (!enumerator->init()) + return enumerator; + + /* + * NOTE: Either udev is not available or initialization of it + * failed, use/fallback on sysfs enumerator + */ + + /* TODO: add a sysfs based enumerator */ + + return nullptr; +} + DeviceEnumerator::~DeviceEnumerator() { for (DeviceInfo *dev : devices_) { diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h index 5348e6cf..24bca0e3 100644 --- a/src/libcamera/include/device_enumerator.h +++ b/src/libcamera/include/device_enumerator.h @@ -56,6 +56,8 @@ private: class DeviceEnumerator { public: + static DeviceEnumerator *create(); + virtual ~DeviceEnumerator(); virtual int init() = 0; |