diff options
author | Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> | 2023-06-27 15:44:36 -0600 |
---|---|---|
committer | Mark Hatle <mark.hatle@amd.com> | 2023-07-19 17:07:45 -0600 |
commit | ce7dbf979118a520a0e4ee45b0c86550bd047dfa (patch) | |
tree | ab8548cea4cb097dfb05ea6e91ae2701a5a00260 /meta-xilinx-core/recipes-graphics | |
parent | 33c908312e7dec4244f80819d4fe2946ff7c0e70 (diff) | |
download | meta-xilinx-ce7dbf979118a520a0e4ee45b0c86550bd047dfa.tar.gz |
xserver-xorg: Move monitor hotplug rules from meta-petalinux
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')
3 files changed, 68 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/99-monitor-hotplug.rules b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/99-monitor-hotplug.rules new file mode 100644 index 00000000..eeb7d671 --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/99-monitor-hotplug.rules | |||
@@ -0,0 +1 @@ | |||
ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/usr/bin/monitor-hotplug.sh" | |||
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 new file mode 100755 index 00000000..d603082d --- /dev/null +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg/monitor-hotplug.sh | |||
@@ -0,0 +1,50 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | # Copyright (C) 2018 Xilinx, Inc. All rights reserved. | ||
4 | # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. | ||
5 | # | ||
6 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | # of this software and associated documentation files (the "Software"), to deal | ||
8 | # in the Software without restriction, including without limitation the rights | ||
9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
10 | # copies of the Software, and to permit persons to whom the Software is | ||
11 | # furnished to do so, subject to the following conditions: | ||
12 | # | ||
13 | # The above copyright notice and this permission notice shall be included in | ||
14 | # all copies or substantial portions of the Software. | ||
15 | # | ||
16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
22 | # THE SOFTWARE. | ||
23 | |||
24 | # Adapt this script to your needs. | ||
25 | |||
26 | DEVICES=$(find /sys/class/drm/*/status) | ||
27 | |||
28 | # inspired by /etc/acpd/lid.sh and the function it sources. | ||
29 | |||
30 | displaynum=`ls /tmp/.X11-unix/* | sed s#/tmp/.X11-unix/X##` | ||
31 | display=":$displaynum.0" | ||
32 | export DISPLAY=":$displaynum.0" | ||
33 | |||
34 | # from https://wiki.archlinux.org/index.php/Acpid#Laptop_Monitor_Power_Off | ||
35 | export XAUTHORITY=$(ps -C Xorg -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') | ||
36 | |||
37 | for i in /sys/class/drm/*/*/status ; | ||
38 | do | ||
39 | status=$(cat $i); | ||
40 | connector=${i%/status*}; | ||
41 | connector=${connector#*-}; | ||
42 | if [ "$status" == "disconnected" ]; then | ||
43 | xset dpms force off | ||
44 | elif [ "$status" == "connected" ]; then | ||
45 | xset dpms force on | ||
46 | if [ "$(xrandr | grep '\*')" = "" ]; then | ||
47 | xrandr --output $connector --auto | ||
48 | fi | ||
49 | fi | ||
50 | done | ||
diff --git a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend index 83fd7fa6..a9973eff 100644 --- a/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend +++ b/meta-xilinx-core/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend | |||
@@ -2,3 +2,20 @@ | |||
2 | DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" | 2 | DEFAULT_PACKAGE_ARCH := "${PACKAGE_ARCH}" |
3 | MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" | 3 | MALI_PACKAGE_ARCH = "${@'${MACHINE_ARCH}' if d.getVar('PREFERRED_PROVIDER_virtual/libgles1') == 'libmali-xlnx' else '${DEFAULT_PACKAGE_ARCH}'}" |
4 | PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" | 4 | PACKAGE_ARCH = "${@bb.utils.contains_any('DEPENDS', 'virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm', '${MALI_PACKAGE_ARCH}', '${DEFAULT_PACKAGE_ARCH}', d)}" |
5 | |||
6 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" | ||
7 | |||
8 | SRC_URI += " \ | ||
9 | file://monitor-hotplug.sh \ | ||
10 | file://99-monitor-hotplug.rules \ | ||
11 | " | ||
12 | |||
13 | do_install:append() { | ||
14 | install -d ${D}${bindir} | ||
15 | install -m 0755 ${WORKDIR}/monitor-hotplug.sh ${D}${bindir} | ||
16 | |||
17 | install -d ${D}${sysconfdir}/udev/rules.d | ||
18 | install -m 0644 ${WORKDIR}/99-monitor-hotplug.rules ${D}${sysconfdir}/udev/rules.d/local.rules | ||
19 | } | ||
20 | |||
21 | FILES:${PN} += "${sysconfdir}/udev/rules.d/*" | ||