summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-12-07 18:06:40 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-12-08 08:48:03 +0200
commit74a4a777627029dc51d4b1df89bedda501dc7543 (patch)
treeea1e9054d4150c3ea7c510082b12bf964b938714
parentc13047e3f7674a5a05b107ef3fd97d9ff4165639 (diff)
Fix Python bindings for Connector::get_possible_crtcs() method
The method returns an std::vector of DRMObject, which isn't supported by the latest pybind11 as explained in commit 706a44abb3aa. Fix it by wrapping the method manually. Fixes: 706a44abb3aa ("Update to latest pybind11") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--py/pykms/pykmsbase.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 96ebe7a..79c502c 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -54,7 +54,12 @@ void init_pykmsbase(py::module &m)
.def_property_readonly("fullname", &Connector::fullname)
.def("get_default_mode", &Connector::get_default_mode)
.def("get_current_crtc", &Connector::get_current_crtc)
- .def("get_possible_crtcs", &Connector::get_possible_crtcs)
+ .def("get_possible_crtcs", [](Connector* self) {
+ vector<unique_ptr<Crtc, py::nodelete>> v;
+ for (Crtc* p : self->get_possible_crtcs())
+ v.push_back(unique_ptr<Crtc, py::nodelete>(p));
+ return v;
+ })
.def("get_modes", &Connector::get_modes)
.def("get_mode", (Videomode (Connector::*)(const string& mode) const)&Connector::get_mode)
.def("get_mode", (Videomode (Connector::*)(unsigned xres, unsigned yres, float refresh, bool ilace) const)&Connector::get_mode)