[PATCH 3/3] py: Add bindings for ControlId vendor information

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Oct 10 22:26:47 CEST 2024


Quoting Paul Elder (2024-10-10 09:47:19)
> Add python bindings for quering vendor information from a ControlId.
> 
> Example usage:
> >>> cid
> libcamera.ControlId(20, Saturation, ControlType.Float)

Is it worth updating __repr__ to report the vendor as well ? - or even
update the print of the name parameter so it shows the same way it could
be used?

> >>> cid.vendor
> 'libcamera'
> 
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
>  src/py/libcamera/py_main.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp
> index 983b76f6e998..11e9dd6bf6eb 100644
> --- a/src/py/libcamera/py_main.cpp
> +++ b/src/py/libcamera/py_main.cpp
> @@ -400,6 +400,7 @@ PYBIND11_MODULE(_libcamera, m)
>                 .def_property_readonly("id", &ControlId::id)
>                 .def_property_readonly("name", &ControlId::name)
>                 .def_property_readonly("type", &ControlId::type)
> +               .def_property_readonly("vendor", &ControlId::vendor)
>                 .def("__str__", [](const ControlId &self) { return self.name(); })
>                 .def("__repr__", [](const ControlId &self) {
>                         return py::str("libcamera.ControlId({}, {}, {})")
> -- 
> 2.39.2
>


More information about the libcamera-devel mailing list