On Sun, 7 Jun 2020 at 14:06, Marcus MERIGHI <[email protected]> wrote:
>
> [email protected] (Switch 1024), 2020.06.07 (Sun) 08:59 (CEST):
> > tldr; My question is, how can I get HDMI Events, I want to execute scripts
> > when a new HDMI (or DP, for that matter) device is connected or
> > disconnected.
> > Maybe there is a really obvious or simple way or solution but I did not see
> > it.
>
> x-on-resize might have some clues:
> https://marc.info/?l=openbsd-misc&m=157104216604576
>
> marcus
Ok, Thank you, I downloaded the sources for x-on-resize [1], got it to
compile with clang, but I do not receive events.
Clang line:
clang -v -L/usr/X11R6/lib/ -lX11 -lXrandr
-I/usr/src/lib/libX11/include/ -I/usr/src/proto/xorgproto/include/
-I/usr/src/lib/libXrandr/include/ -I/usr/src/lib/libXrender/include/
x-on-resize.c
I modified the source a bit to get some output:
```
for (;;) {
int configed = 0;
int resized = 0;
printf ("in for\n");
do {
printf ("in while\n");
printf ("XNextEvent\n");
XNextEvent(dpy, &ev);
printf ("ev.type: %d\n", ev.type);
switch (ev.type - event_base) {
case RRNotify:
printf ("in RRNotify\n");
nev = (XRRNotifyEvent *) &ev;
```
But I only get "in while", then "XNextEvent" and nothing more, it sits
there. If i execute Xrandr, change Xrandr configuration, disconnect
HDMI port, reconnect HDMI port, I do not receive any events.
Does any one have any thoughts? Could it be my graphics card?
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics" rev 0x0b
drm0 at inteldrm0
inteldrm0: msi, HASWELL, gen 7
inteldrm0: 1600x900, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
[drm] *ERROR* Potential atomic update failure on pipe B
[1] https://people.freedesktop.org/~keithp/x-on-resize.git/