How do I detect when a monitor is plugged in or unplugged without acpi, xrandr, /sys and udev?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I've read the answers to this question but I don't have ACPI, the /sys/class/drm/card0-socket/status
method does not work and the xrandr
method chokes my CPU. udevadm monitor
shows nothing when (un)plugging the monitor.
I've got a circa 2013 Lenovo ThinkPad w530 with nVidia quadro something. I'm running Lubuntu 18.04 with the nouveau
driver. The monitor is a 27" Philips 271S. I'm using a VGA cable.
How do I do detect monitor (un)plugging?
x11 nvidia xrandr display thinkpad
New contributor
add a comment |
up vote
1
down vote
favorite
I've read the answers to this question but I don't have ACPI, the /sys/class/drm/card0-socket/status
method does not work and the xrandr
method chokes my CPU. udevadm monitor
shows nothing when (un)plugging the monitor.
I've got a circa 2013 Lenovo ThinkPad w530 with nVidia quadro something. I'm running Lubuntu 18.04 with the nouveau
driver. The monitor is a 27" Philips 271S. I'm using a VGA cable.
How do I do detect monitor (un)plugging?
x11 nvidia xrandr display thinkpad
New contributor
1
Are you runningnvidia
ornouveau
? Depending on that, you may also get "files" with EDID entries under/sys
or/proc
. Also, it's interesting thatxrandr
"chokes your CPU', whileread-edid
, which calls the BIOS and has to do some extremely complicated things to do that, does not.xrandr
really should just call the X server, which should already have this information. Unless nvidia/nouveau decides that's a good time to test for connected monitors again, with all the time-outs that usually involves.
– dirkt
21 hours ago
I'm runningnouveau
. I have the EDID in/sys/class/drm/card0-VGA-1/edid
butcat /path/edid
gives the same result both with the monitor plugged and unplugged. Maybe the chocking could be avoided with somenice
trick, I didn't try that route. About "just calling the X server", maybe that's what srandr does, but I'm not at ease with compiling C.
– White_Rabbit
20 hours ago
Which call did you use? Justxrandr -q
? If this results in monitor probing with long timeouts each time it's called (check/var/log/Xorg.0.log
for hints if it really does that), I'd consider a bugreport with the nouveau developers. Possibly there's also a way to set shorter timeouts or to just probe card0-VGA-1, so I'd ask them. It seems to work viaget-edid
, after all.
– dirkt
20 hours ago
I usexrandr --display :0 --query
. I can't interpret the log. #Last line before call [ 15674.053] (II) event7 - ThinkPad Extra Buttons: device is a keyboard # I call xrandr [ 17548.848] (II) NOUVEAU(0): EDID vendor "PHL", prod id 2314 # [ many lines ] # [ last line of/var/log/Xorg.0.log
] [ 17548.849] (II) NOUVEAU(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)
– White_Rabbit
20 hours ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I've read the answers to this question but I don't have ACPI, the /sys/class/drm/card0-socket/status
method does not work and the xrandr
method chokes my CPU. udevadm monitor
shows nothing when (un)plugging the monitor.
I've got a circa 2013 Lenovo ThinkPad w530 with nVidia quadro something. I'm running Lubuntu 18.04 with the nouveau
driver. The monitor is a 27" Philips 271S. I'm using a VGA cable.
How do I do detect monitor (un)plugging?
x11 nvidia xrandr display thinkpad
New contributor
I've read the answers to this question but I don't have ACPI, the /sys/class/drm/card0-socket/status
method does not work and the xrandr
method chokes my CPU. udevadm monitor
shows nothing when (un)plugging the monitor.
I've got a circa 2013 Lenovo ThinkPad w530 with nVidia quadro something. I'm running Lubuntu 18.04 with the nouveau
driver. The monitor is a 27" Philips 271S. I'm using a VGA cable.
How do I do detect monitor (un)plugging?
x11 nvidia xrandr display thinkpad
x11 nvidia xrandr display thinkpad
New contributor
New contributor
edited 20 hours ago
New contributor
asked yesterday
White_Rabbit
284
284
New contributor
New contributor
1
Are you runningnvidia
ornouveau
? Depending on that, you may also get "files" with EDID entries under/sys
or/proc
. Also, it's interesting thatxrandr
"chokes your CPU', whileread-edid
, which calls the BIOS and has to do some extremely complicated things to do that, does not.xrandr
really should just call the X server, which should already have this information. Unless nvidia/nouveau decides that's a good time to test for connected monitors again, with all the time-outs that usually involves.
– dirkt
21 hours ago
I'm runningnouveau
. I have the EDID in/sys/class/drm/card0-VGA-1/edid
butcat /path/edid
gives the same result both with the monitor plugged and unplugged. Maybe the chocking could be avoided with somenice
trick, I didn't try that route. About "just calling the X server", maybe that's what srandr does, but I'm not at ease with compiling C.
– White_Rabbit
20 hours ago
Which call did you use? Justxrandr -q
? If this results in monitor probing with long timeouts each time it's called (check/var/log/Xorg.0.log
for hints if it really does that), I'd consider a bugreport with the nouveau developers. Possibly there's also a way to set shorter timeouts or to just probe card0-VGA-1, so I'd ask them. It seems to work viaget-edid
, after all.
– dirkt
20 hours ago
I usexrandr --display :0 --query
. I can't interpret the log. #Last line before call [ 15674.053] (II) event7 - ThinkPad Extra Buttons: device is a keyboard # I call xrandr [ 17548.848] (II) NOUVEAU(0): EDID vendor "PHL", prod id 2314 # [ many lines ] # [ last line of/var/log/Xorg.0.log
] [ 17548.849] (II) NOUVEAU(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)
– White_Rabbit
20 hours ago
add a comment |
1
Are you runningnvidia
ornouveau
? Depending on that, you may also get "files" with EDID entries under/sys
or/proc
. Also, it's interesting thatxrandr
"chokes your CPU', whileread-edid
, which calls the BIOS and has to do some extremely complicated things to do that, does not.xrandr
really should just call the X server, which should already have this information. Unless nvidia/nouveau decides that's a good time to test for connected monitors again, with all the time-outs that usually involves.
– dirkt
21 hours ago
I'm runningnouveau
. I have the EDID in/sys/class/drm/card0-VGA-1/edid
butcat /path/edid
gives the same result both with the monitor plugged and unplugged. Maybe the chocking could be avoided with somenice
trick, I didn't try that route. About "just calling the X server", maybe that's what srandr does, but I'm not at ease with compiling C.
– White_Rabbit
20 hours ago
Which call did you use? Justxrandr -q
? If this results in monitor probing with long timeouts each time it's called (check/var/log/Xorg.0.log
for hints if it really does that), I'd consider a bugreport with the nouveau developers. Possibly there's also a way to set shorter timeouts or to just probe card0-VGA-1, so I'd ask them. It seems to work viaget-edid
, after all.
– dirkt
20 hours ago
I usexrandr --display :0 --query
. I can't interpret the log. #Last line before call [ 15674.053] (II) event7 - ThinkPad Extra Buttons: device is a keyboard # I call xrandr [ 17548.848] (II) NOUVEAU(0): EDID vendor "PHL", prod id 2314 # [ many lines ] # [ last line of/var/log/Xorg.0.log
] [ 17548.849] (II) NOUVEAU(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)
– White_Rabbit
20 hours ago
1
1
Are you running
nvidia
or nouveau
? Depending on that, you may also get "files" with EDID entries under /sys
or /proc
. Also, it's interesting that xrandr
"chokes your CPU', while read-edid
, which calls the BIOS and has to do some extremely complicated things to do that, does not. xrandr
really should just call the X server, which should already have this information. Unless nvidia/nouveau decides that's a good time to test for connected monitors again, with all the time-outs that usually involves.– dirkt
21 hours ago
Are you running
nvidia
or nouveau
? Depending on that, you may also get "files" with EDID entries under /sys
or /proc
. Also, it's interesting that xrandr
"chokes your CPU', while read-edid
, which calls the BIOS and has to do some extremely complicated things to do that, does not. xrandr
really should just call the X server, which should already have this information. Unless nvidia/nouveau decides that's a good time to test for connected monitors again, with all the time-outs that usually involves.– dirkt
21 hours ago
I'm running
nouveau
. I have the EDID in /sys/class/drm/card0-VGA-1/edid
but cat /path/edid
gives the same result both with the monitor plugged and unplugged. Maybe the chocking could be avoided with some nice
trick, I didn't try that route. About "just calling the X server", maybe that's what srandr does, but I'm not at ease with compiling C.– White_Rabbit
20 hours ago
I'm running
nouveau
. I have the EDID in /sys/class/drm/card0-VGA-1/edid
but cat /path/edid
gives the same result both with the monitor plugged and unplugged. Maybe the chocking could be avoided with some nice
trick, I didn't try that route. About "just calling the X server", maybe that's what srandr does, but I'm not at ease with compiling C.– White_Rabbit
20 hours ago
Which call did you use? Just
xrandr -q
? If this results in monitor probing with long timeouts each time it's called (check /var/log/Xorg.0.log
for hints if it really does that), I'd consider a bugreport with the nouveau developers. Possibly there's also a way to set shorter timeouts or to just probe card0-VGA-1, so I'd ask them. It seems to work via get-edid
, after all.– dirkt
20 hours ago
Which call did you use? Just
xrandr -q
? If this results in monitor probing with long timeouts each time it's called (check /var/log/Xorg.0.log
for hints if it really does that), I'd consider a bugreport with the nouveau developers. Possibly there's also a way to set shorter timeouts or to just probe card0-VGA-1, so I'd ask them. It seems to work via get-edid
, after all.– dirkt
20 hours ago
I use
xrandr --display :0 --query
. I can't interpret the log. #Last line before call [ 15674.053] (II) event7 - ThinkPad Extra Buttons: device is a keyboard # I call xrandr [ 17548.848] (II) NOUVEAU(0): EDID vendor "PHL", prod id 2314 # [ many lines ] # [ last line of /var/log/Xorg.0.log
] [ 17548.849] (II) NOUVEAU(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)– White_Rabbit
20 hours ago
I use
xrandr --display :0 --query
. I can't interpret the log. #Last line before call [ 15674.053] (II) event7 - ThinkPad Extra Buttons: device is a keyboard # I call xrandr [ 17548.848] (II) NOUVEAU(0): EDID vendor "PHL", prod id 2314 # [ many lines ] # [ last line of /var/log/Xorg.0.log
] [ 17548.849] (II) NOUVEAU(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)– White_Rabbit
20 hours ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
I resorted to polling for the external screen EDID.
I installed the read-edid package, added a line in visudo
%sudo ALL=(ALL:ALL) NOPASSWD:/usr/bin/get-edid
to allow passwordless get-edid and used the following loop:
#!/bin/bash
# edid_based_automatic_display_loop.sh
export NEW_CONNECTION=1
export NEW_DISCONNECTION=1
while :
do
sleep 1
sudo get-edid 2>/dev/null|parse-edid 2>/dev/null|grep "PHL 271S7Q">/dev/null
_DISCONNECTED=`echo $?`
# echo "DISCONNECTED $_DISCONNECTED"
if [ $_DISCONNECTED = "0" -a $NEW_CONNECTION = "1" ] ; then
export NEW_DISCONNECTION=1;
export NEW_CONNECTION=0;
bash /home/bruno/.screenlayout/only_external.sh
elif [ $_DISCONNECTED = "1" -a $NEW_DISCONNECTION = "1" ] ; then
export NEW_DISCONNECTION=0;
export NEW_CONNECTION=1;
bash /home/bruno/.screenlayout/only_laptop.sh
fi
done
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
I resorted to polling for the external screen EDID.
I installed the read-edid package, added a line in visudo
%sudo ALL=(ALL:ALL) NOPASSWD:/usr/bin/get-edid
to allow passwordless get-edid and used the following loop:
#!/bin/bash
# edid_based_automatic_display_loop.sh
export NEW_CONNECTION=1
export NEW_DISCONNECTION=1
while :
do
sleep 1
sudo get-edid 2>/dev/null|parse-edid 2>/dev/null|grep "PHL 271S7Q">/dev/null
_DISCONNECTED=`echo $?`
# echo "DISCONNECTED $_DISCONNECTED"
if [ $_DISCONNECTED = "0" -a $NEW_CONNECTION = "1" ] ; then
export NEW_DISCONNECTION=1;
export NEW_CONNECTION=0;
bash /home/bruno/.screenlayout/only_external.sh
elif [ $_DISCONNECTED = "1" -a $NEW_DISCONNECTION = "1" ] ; then
export NEW_DISCONNECTION=0;
export NEW_CONNECTION=1;
bash /home/bruno/.screenlayout/only_laptop.sh
fi
done
New contributor
add a comment |
up vote
2
down vote
I resorted to polling for the external screen EDID.
I installed the read-edid package, added a line in visudo
%sudo ALL=(ALL:ALL) NOPASSWD:/usr/bin/get-edid
to allow passwordless get-edid and used the following loop:
#!/bin/bash
# edid_based_automatic_display_loop.sh
export NEW_CONNECTION=1
export NEW_DISCONNECTION=1
while :
do
sleep 1
sudo get-edid 2>/dev/null|parse-edid 2>/dev/null|grep "PHL 271S7Q">/dev/null
_DISCONNECTED=`echo $?`
# echo "DISCONNECTED $_DISCONNECTED"
if [ $_DISCONNECTED = "0" -a $NEW_CONNECTION = "1" ] ; then
export NEW_DISCONNECTION=1;
export NEW_CONNECTION=0;
bash /home/bruno/.screenlayout/only_external.sh
elif [ $_DISCONNECTED = "1" -a $NEW_DISCONNECTION = "1" ] ; then
export NEW_DISCONNECTION=0;
export NEW_CONNECTION=1;
bash /home/bruno/.screenlayout/only_laptop.sh
fi
done
New contributor
add a comment |
up vote
2
down vote
up vote
2
down vote
I resorted to polling for the external screen EDID.
I installed the read-edid package, added a line in visudo
%sudo ALL=(ALL:ALL) NOPASSWD:/usr/bin/get-edid
to allow passwordless get-edid and used the following loop:
#!/bin/bash
# edid_based_automatic_display_loop.sh
export NEW_CONNECTION=1
export NEW_DISCONNECTION=1
while :
do
sleep 1
sudo get-edid 2>/dev/null|parse-edid 2>/dev/null|grep "PHL 271S7Q">/dev/null
_DISCONNECTED=`echo $?`
# echo "DISCONNECTED $_DISCONNECTED"
if [ $_DISCONNECTED = "0" -a $NEW_CONNECTION = "1" ] ; then
export NEW_DISCONNECTION=1;
export NEW_CONNECTION=0;
bash /home/bruno/.screenlayout/only_external.sh
elif [ $_DISCONNECTED = "1" -a $NEW_DISCONNECTION = "1" ] ; then
export NEW_DISCONNECTION=0;
export NEW_CONNECTION=1;
bash /home/bruno/.screenlayout/only_laptop.sh
fi
done
New contributor
I resorted to polling for the external screen EDID.
I installed the read-edid package, added a line in visudo
%sudo ALL=(ALL:ALL) NOPASSWD:/usr/bin/get-edid
to allow passwordless get-edid and used the following loop:
#!/bin/bash
# edid_based_automatic_display_loop.sh
export NEW_CONNECTION=1
export NEW_DISCONNECTION=1
while :
do
sleep 1
sudo get-edid 2>/dev/null|parse-edid 2>/dev/null|grep "PHL 271S7Q">/dev/null
_DISCONNECTED=`echo $?`
# echo "DISCONNECTED $_DISCONNECTED"
if [ $_DISCONNECTED = "0" -a $NEW_CONNECTION = "1" ] ; then
export NEW_DISCONNECTION=1;
export NEW_CONNECTION=0;
bash /home/bruno/.screenlayout/only_external.sh
elif [ $_DISCONNECTED = "1" -a $NEW_DISCONNECTION = "1" ] ; then
export NEW_DISCONNECTION=0;
export NEW_CONNECTION=1;
bash /home/bruno/.screenlayout/only_laptop.sh
fi
done
New contributor
New contributor
answered yesterday
White_Rabbit
284
284
New contributor
New contributor
add a comment |
add a comment |
White_Rabbit is a new contributor. Be nice, and check out our Code of Conduct.
White_Rabbit is a new contributor. Be nice, and check out our Code of Conduct.
White_Rabbit is a new contributor. Be nice, and check out our Code of Conduct.
White_Rabbit is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481728%2fhow-do-i-detect-when-a-monitor-is-plugged-in-or-unplugged-without-acpi-xrandr%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Are you running
nvidia
ornouveau
? Depending on that, you may also get "files" with EDID entries under/sys
or/proc
. Also, it's interesting thatxrandr
"chokes your CPU', whileread-edid
, which calls the BIOS and has to do some extremely complicated things to do that, does not.xrandr
really should just call the X server, which should already have this information. Unless nvidia/nouveau decides that's a good time to test for connected monitors again, with all the time-outs that usually involves.– dirkt
21 hours ago
I'm running
nouveau
. I have the EDID in/sys/class/drm/card0-VGA-1/edid
butcat /path/edid
gives the same result both with the monitor plugged and unplugged. Maybe the chocking could be avoided with somenice
trick, I didn't try that route. About "just calling the X server", maybe that's what srandr does, but I'm not at ease with compiling C.– White_Rabbit
20 hours ago
Which call did you use? Just
xrandr -q
? If this results in monitor probing with long timeouts each time it's called (check/var/log/Xorg.0.log
for hints if it really does that), I'd consider a bugreport with the nouveau developers. Possibly there's also a way to set shorter timeouts or to just probe card0-VGA-1, so I'd ask them. It seems to work viaget-edid
, after all.– dirkt
20 hours ago
I use
xrandr --display :0 --query
. I can't interpret the log. #Last line before call [ 15674.053] (II) event7 - ThinkPad Extra Buttons: device is a keyboard # I call xrandr [ 17548.848] (II) NOUVEAU(0): EDID vendor "PHL", prod id 2314 # [ many lines ] # [ last line of/var/log/Xorg.0.log
] [ 17548.849] (II) NOUVEAU(0): Modeline "1280x720"x60.0 74.48 1280 1336 1472 1664 720 721 724 746 -hsync +vsync (44.8 kHz e)– White_Rabbit
20 hours ago