How to create a callback for “monitor plugged” on an intel graphics?

后端 未结 5 697
猫巷女王i
猫巷女王i 2020-12-12 21:40

I\'ve got an eeepc with an intel graphics. I\'d like to hook a script to the event of a monitor plugged via VGA. How to do that?

5条回答
  •  天涯浪人
    2020-12-12 22:24

    You have three options:

    1. Poll on a specific entry in sysfs.
    2. Use inotify to detect changes in sysfs.
    3. Use a netlink socket with NETLINK_KOBJECT_UEVENT and listen for a change uevent for the device you want.

    In any of the ways mentioned, you're still going to have to poll in one way or another, so I'd just go with the first option.

提交回复
热议问题