summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/recipes-graphics/xorg-xserver
diff options
context:
space:
mode:
authorDaniel Levin <daniel.levin@amd.com>2023-08-08 20:31:56 -0600
committerMark Hatle <mark.hatle@amd.com>2023-08-14 10:16:29 -0500
commit9220f00412b1cce5c3904ffda19c4ad87d8e83e4 (patch)
tree563778e410a5bb64b9e2b680ff08b959fc7ef28f /meta-xilinx-core/recipes-graphics/xorg-xserver
parentef56d304f5fcf24020c3cd4cd62ce2d16247abb6 (diff)
downloadmeta-xilinx-9220f00412b1cce5c3904ffda19c4ad87d8e83e4.tar.gz
monitor-hotplug.sh: Fix detecting XAUTHORITY
Previously XAUTHORITY location was detected by filtering Xorg process command line, which is not available in busybox ps implementation. Instead detect correct Xorg commnad line by grepping for the "Xorg :displaynum" and extract -auth argument. If no -auth argument present then Xorg is running without display manager, thus XAUTHORITY env var should remain undefined. Signed-off-by: Daniel Levin <daniel.levin@amd.com> Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Diffstat (limited to 'meta-xilinx-core/recipes-graphics/xorg-xserver')
-rwxr-xr-xmeta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh
index d603082d..bceb5607 100755
--- a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh
+++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh
@@ -27,12 +27,27 @@ DEVICES=$(find /sys/class/drm/*/status)
27 27
28# inspired by /etc/acpd/lid.sh and the function it sources. 28# inspired by /etc/acpd/lid.sh and the function it sources.
29 29
30displaynum=`ls /tmp/.X11-unix/* | sed s#/tmp/.X11-unix/X##` 30# Read first X display number from the list.
31displaynum=`ls /tmp/.X11-unix/* | sed s#/tmp/.X11-unix/X## | head -n 1`
32displaynum=${displaynum%% *}
33
31display=":$displaynum.0" 34display=":$displaynum.0"
32export DISPLAY=":$displaynum.0" 35export DISPLAY=":$displaynum.0"
33 36
34# from https://wiki.archlinux.org/index.php/Acpid#Laptop_Monitor_Power_Off 37# from https://wiki.archlinux.org/index.php/Acpid#Laptop_Monitor_Power_Off
35export XAUTHORITY=$(ps -C Xorg -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') 38
39# Clear XAUTHORITY by default in case X session is not using display manager.
40unset XAUTHORITY
41
42# Detect X session command line started for the display $displaynum and extract
43# -auth argument if any.
44ps -eo args | grep -e "Xorg\W*:$displaynum" | grep -e -auth | while read -r line
45do
46 if [[ "${line%% *}" == *Xorg ]]; then
47 export XAUTHORITY=`echo $line | sed -n 's/.*-auth //; s/ -[^ ].*//; p'`
48 break
49 fi
50done
36 51
37for i in /sys/class/drm/*/*/status ; 52for i in /sys/class/drm/*/*/status ;
38do 53do