You are not logged in.

#1 2012-04-05 07:19:41

fsck
Member
Registered: 2008-11-24
Posts: 4

Udev Rules for Monitors

So I've got a bit of a fluid monitor setup.  Three different screens with three different configurations that are switched among rather often.  I wrote a script using xrandr to handle this, and it works very well when it gets called.  I thought it would be really nice to have it automated whenever I plugged in or unplugged a monitor, so I took a look with udevadm, and it spits out the same two events when I plug/unplug my VGA monitor.

KERNEL[44363.562487] change   /devices/pci0000:00/0000:00:02.0/drm/card1 (drm)
UDEV  [44363.572260] change   /devices/pci0000:00/0000:00:02.0/drm/card1 (drm)

udevadm --query=all --path=/devices/pci0000:00/0000:00:02.0/drm/card1 (drm)

P: /devices/pci0000:00/0000:00:02.0/drm/card1
N: dri/card1
E: DEVNAME=/dev/dri/card1
E: DEVPATH=/devices/pci0000:00/0000:00:02.0/drm/card1
E: DEVTYPE=drm_minor
E: MAJOR=226
E: MINOR=1
E: SUBSYSTEM=drm
E: TAGS=:udev-acl:
E: UDEV_LOG=3
E: USEC_INITIALIZED=18414634

Based on that information, I made a udev rule that I thought would do exactly what I wanted.

KERNEL=="dri/card1", ACTION=="change", RUN+="/usr/bin/monfix"

Unfortunately, nothing happens.

I've never messed with udev before, and I learned a lot in this effort, but I seem to be doing something wrong here, and I can't quite figure out what it is.  Can someone point this out for me?

Offline

Board footer

Powered by FluxBB