Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Udev monitor hotplug events.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tlhonmey
n00b
n00b


Joined: 06 Nov 2014
Posts: 8

PostPosted: Thu Nov 06, 2014 7:24 pm    Post subject: Udev monitor hotplug events. Reply with quote

I'm not quite certain if this is the proper subforum for this, but it seems to be the closest match. Feel free to move it if I've made a mistake.


I'm trying to set up a system which can be booted with no monitor attached, and then will automatically detect when a monitor is plugged in and signal X to readjust its output parameters accordingly.

In poking around at it, I discovered that it should be easy since udev generates monitor hotplug events. YAY!

So I put together a udev rule to detect when a monitor is plugged or unplugged and run a script to run xrandr to make it all happy.

Unplug monitor, startx, plug in monitor: Two seconds later, the monitor comes on and all is happy. Problem solved!

Unplug monitor, reboot, plug in monitor: Nothing. Hmmm... That's odd.


Login via ssh from a different machine. Turn on the udev monitor. Replug monitor a few times: No events.

Plug in monitor, restart udev. Replug monitor a few times: Now I get events.



In short: Udev only generates monitor hotplug events if the output in question is connected when udev starts. (This actually would explain some of the trouble I've had with multihead stuff on other distros as well).

Worst case, I *can* fall back to polling for changes with xrandr, but I'd rather not.


Kernel: 3.13.2
Udev: 208

Any suggestions about how to make udev pay attention like it should would be appreciated. Any suggestions about an alternative to udev that "just works" would also be appreciated (though I'd prefer the rules to be compatible since I have a few others for this system that I'd prefer to avoid rewriting.)

Failing that, if somebody who understands sysfs better than I do can give me a few pointers on how to reliably figure out which device nodes are video cards so I can use inotify without having to make manual changes to customize it to any particular video card I'd be grateful. Trying to absorb the entire structure at once on my own is proving challenging.


Edit: Interestingly, I don't get inotify events below /sys/devices/pci0000:00/0000:00:02.0/drm/card0/ Trying to watch /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-VGA-1/status or /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-VGA-1/ doesn't result in events generated when the cable is (un)plugged.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum