py/tests: hpd test
[android/external-libkmsxx.git] / py / tests / hpd.py
1 #!/usr/bin/python3
3 import pyudev
4 import pykms
6 card = pykms.Card()
7 res = pykms.ResourceManager(card)
8 conn = res.reserve_connector("hdmi")
10 context = pyudev.Context()
12 dev = pyudev.Devices.from_name(context, 'drm', 'card0')
14 monitor = pyudev.Monitor.from_netlink(context)
15 monitor.filter_by('drm')
17 for device in iter(monitor.poll, None):
18         if 'HOTPLUG' in device:
19                 conn.refresh()
20                 mode = conn.get_modes()
21                 print("HPD")
22                 print(mode)