summaryrefslogtreecommitdiff
path: root/py/tests/hpd.py
blob: d26f260f8048b0ed70a39436e91567b1e9693e21 (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()
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)