Camera HAL Driver Discovery#
Every UDDF driver library is a .so exporting one C-linkage entry point: uddf_discover_drivers().
CameraHAL scans directories, loads each .so, and matches driver names from platform config to instantiate the right drivers.
Scan, Load, and Match Drivers from Platform Config#
// libraries/moduleMyModule/MyModuleLibrary.cpp
#include "uddf/ddi/discovery.hpp"
#include "modules/MyModule/MyModule.hpp"
static const ddi::DriverInfo g_info {
.name = "MyCameraModule",
.description = "GMSL module driver",
.vendor = "My Company",
.revision = "1.0.0"
};
// DriverInfo.name MUST match the platform config string —
// this is how CameraHAL finds your driver
class MyEnumerator final
: public ddi::IDriverEnumerator {
public:
std::string_view GetName() const override
{ return "MyCameraModuleProvider"; }
size_t GetDriverCount() const override
{ return 1; }
const ddi::DriverInfo* GetDriverInfo(
size_t idx) const override {
return (idx == 0) ? &g_info : nullptr;
}
std::unique_ptr<ddi::IDriver> CreateDriver(
size_t idx) override {
return (idx == 0)
? std::make_unique<MyModule>()
: nullptr;
}
};
// The single exported C symbol — every .so needs this
extern "C"
ddi::DriverEnumeratorPtr uddf_discover_drivers() {
return std::make_unique<MyEnumerator>();
}