1#!/usr/bin/python3 2 3import pyudev 4import pykms 5 6card = pykms.Card() 7res = pykms.ResourceManager(card) 8conn = res.reserve_connector("hdmi") 9 10context = pyudev.Context() 11 12dev = pyudev.Devices.from_name(context, 'drm', 'card0') 13 14monitor = pyudev.Monitor.from_netlink(context) 15monitor.filter_by('drm') 16 17for 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) 23