improve hpd.py
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 9 Dec 2019 13:07:48 +0000 (15:07 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 29 Jan 2020 06:44:45 +0000 (08:44 +0200)
py/tests/hpd.py

index d26f260..185d784 100755 (executable)
@@ -4,8 +4,7 @@ import pyudev
 import pykms
 
 card = pykms.Card()
-res = pykms.ResourceManager(card)
-conn = res.reserve_connector("hdmi")
+conns = card.connectors
 
 context = pyudev.Context()
 
@@ -16,7 +15,8 @@ monitor.filter_by('drm')
 
 for device in iter(monitor.poll, None):
        if 'HOTPLUG' in device:
-               conn.refresh()
-               mode = conn.get_modes()
                print("HPD")
-               print(mode)
+               for conn in conns:
+                       conn.refresh()
+                       modes = conn.get_modes()
+                       print("  ", conn.fullname, ["{}x{}".format(m.hdisplay, m.vdisplay) for m in modes])