summaryrefslogtreecommitdiff
path: root/py/tests/hpd.py
blob: 185d78495e5666f8c744aa2108880d2052eb3a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python3

import pyudev
import pykms

card = pykms.Card()
conns = card.connectors

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:
		print("HPD")
		for conn in conns:
			conn.refresh()
			modes = conn.get_modes()
			print("  ", conn.fullname, ["{}x{}".format(m.hdisplay, m.vdisplay) for m in modes])