py/tests: hpd test
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 27 Jan 2017 08:40:03 +0000 (10:40 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 27 Jan 2017 09:04:19 +0000 (11:04 +0200)
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
py/tests/hpd.py [new file with mode: 0755]

diff --git a/py/tests/hpd.py b/py/tests/hpd.py
new file mode 100755 (executable)
index 0000000..d26f260
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+
+import pyudev
+import pykms
+
+card = pykms.Card()
+res = pykms.ResourceManager(card)
+conn = res.reserve_connector("hdmi")
+
+context = pyudev.Context()
+
+dev = pyudev.Devices.from_name(context, 'drm', 'card0')
+
+monitor = pyudev.Monitor.from_netlink(context)
+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)