[PATCH 3/3] py: Add bindings for ControlId enum name

Paul Elder paul.elder at ideasonboard.com
Tue Sep 10 22:48:12 CEST 2024


Add python bindings for quering enum value names from a ControlId.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
New in v2
---
 src/py/libcamera/py_main.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
index ab33f38a8..f6aff5005 100644
--- a/src/py/libcamera/py_main.cpp
+++ b/src/py/libcamera/py_main.cpp
@@ -404,7 +404,8 @@ PYBIND11_MODULE(_libcamera, m)
 		.def("__repr__", [](const ControlId &self) {
 			return py::str("libcamera.ControlId({}, {}, {})")
 				.format(self.id(), self.name(), self.type());
-		});
+		})
+		.def("enum_name", &ControlId::enumName);
 
 	pyControlInfo
 		.def_property_readonly("min", [](const ControlInfo &self) {
-- 
2.39.2



More information about the libcamera-devel mailing list