2011-04-27 19:57:03 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# xorg - xorg plugin for postplug
|
2021-04-25 12:38:33 +02:00
|
|
|
# Copyright (c) 2004-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
2011-07-10 17:25:50 +02:00
|
|
|
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
if [ $UID != 0 ]; then
|
|
|
|
echo "$0: must be superuser." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
|
|
|
|
[ -r /etc/sysconfig/postplug ] && . /etc/sysconfig/postplug
|
2011-10-02 15:23:13 +02:00
|
|
|
[ -r /etc/sysconfig/machine ] && . /etc/sysconfig/machine
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
me="xorg"
|
|
|
|
|
|
|
|
. /etc/postplug/postplug.defs
|
|
|
|
|
|
|
|
XORGCONF=/etc/X11/xorg.conf
|
|
|
|
|
|
|
|
# xorg_section_screen_config()
|
|
|
|
# write a new xorg configuration
|
|
|
|
# args:
|
|
|
|
# $1 : default color depth
|
|
|
|
# $2 : file with the video modes (one per line)
|
|
|
|
function xorg_section_screen_config() {
|
|
|
|
# fixme: this deletes from first subsection "Display" to the endsection
|
|
|
|
sed '/SubSection "Display"/,/EndSection/s/.*//p' $XORGCONF | \
|
|
|
|
grep -v "^\s*$" > $XORGCONF.new
|
|
|
|
|
|
|
|
for i in `seq 1 ${#COLORDEPTHS[@]}`; do
|
|
|
|
echo -n "\
|
|
|
|
SubSection \"Display\"
|
|
|
|
Modes " >> $XORGCONF.new
|
|
|
|
grep "${COLORDEPTHS[$i-1]} bpp" $2 | tac | \
|
|
|
|
while read mode skip; do
|
|
|
|
echo -n "\"${mode%,*}\" " >> $XORGCONF.new
|
|
|
|
done
|
|
|
|
echo "
|
|
|
|
Depth ${COLORDEPTHS[$i-1]}
|
|
|
|
EndSubSection" >> $XORGCONF.new
|
|
|
|
done
|
|
|
|
echo "EndSection" >> $XORGCONF.new
|
|
|
|
|
|
|
|
mv $XORGCONF $XORGCONF.save
|
|
|
|
mv $XORGCONF.new $XORGCONF
|
|
|
|
}
|
|
|
|
|
2021-04-25 12:38:33 +02:00
|
|
|
## xorg_set_alternatives()
|
|
|
|
## set alternatives and xorg configuration for specific video drivers
|
|
|
|
#function xorg_set_alternatives() {
|
|
|
|
#if [ "$VIDEODRIVER" = "nvidia" ]; then
|
|
|
|
# grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF ||
|
|
|
|
# sed -i -e '/Driver\W*"nvidia"/a\
|
|
|
|
# Option \"RenderAccel\" \"true\"\
|
|
|
|
# Option \"AllowGLXWithComposite\" \"on\"\
|
|
|
|
# Option \"NoLogo\" \"true\"' $XORGCONF
|
|
|
|
#fi
|
|
|
|
#}
|
2011-04-27 19:57:03 +02:00
|
|
|
|
2011-10-02 15:51:10 +02:00
|
|
|
function xorg_d_configure_input() {
|
2011-08-14 19:36:45 +02:00
|
|
|
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
|
2014-06-29 19:56:04 +02:00
|
|
|
[ ! -e /etc/X11/xorg.conf.d/00-keyboard.conf ] && {
|
2014-06-30 00:13:38 +02:00
|
|
|
|
2011-04-27 19:57:03 +02:00
|
|
|
if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then
|
|
|
|
case "${LANG:0:2}" in
|
|
|
|
it)
|
2011-08-14 19:36:45 +02:00
|
|
|
# XKB_MODEL="pc105"
|
2011-04-27 19:57:03 +02:00
|
|
|
XKB_LAYOUT="it" ;;
|
|
|
|
de)
|
2011-08-14 19:36:45 +02:00
|
|
|
# XKB_MODEL="pc105"
|
2011-04-27 19:57:03 +02:00
|
|
|
XKB_LAYOUT="de" ;;
|
|
|
|
es)
|
2011-08-14 19:36:45 +02:00
|
|
|
# XKB_MODEL="pc105"
|
2011-04-27 19:57:03 +02:00
|
|
|
XKB_LAYOUT="es" ;;
|
|
|
|
fr)
|
2011-08-14 19:36:45 +02:00
|
|
|
# XKB_MODEL="pc105"
|
2011-04-27 19:57:03 +02:00
|
|
|
XKB_LAYOUT="fr" ;;
|
|
|
|
*)
|
2011-08-14 19:36:45 +02:00
|
|
|
# XKB_MODEL="pc104"
|
2011-04-27 19:57:03 +02:00
|
|
|
XKB_LAYOUT="us" ;;
|
|
|
|
esac
|
|
|
|
fi
|
2014-06-30 00:13:38 +02:00
|
|
|
|
|
|
|
cat > /etc/X11/xorg.conf.d/00-keyboard.conf << __EOF
|
|
|
|
# Created by postplug
|
|
|
|
Section "InputClass"
|
|
|
|
Identifier "system-keyboard"
|
|
|
|
MatchIsKeyboard "on"
|
|
|
|
Option "XkbLayout" "$XKB_LAYOUT"
|
|
|
|
__EOF
|
|
|
|
[ "$XKB_MODEL" ] && echo " Option \"XkbModel\" \"$XKB_MODEL\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
|
|
|
[ "$XKB_VARIANT" ] && echo " Option \"XkbVariant\" \"$XKB_VARIANT\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
|
|
|
if [ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ]; then
|
|
|
|
XKB_OPTIONS="${XKB_OPTIONS},lv3:rwin_switch"
|
|
|
|
fi
|
|
|
|
[ "$XKB_OPTIONS" ] && echo " Option \"XkbOptions\" \"$XKB_OPTIONS\"" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
|
|
|
echo "EndSection" >>/etc/X11/xorg.conf.d/00-keyboard.conf
|
2011-04-27 19:57:03 +02:00
|
|
|
}
|
2011-10-02 15:23:13 +02:00
|
|
|
|
2014-06-30 00:13:38 +02:00
|
|
|
if [ -e /etc/X11/xorg.conf.d/10-keyboard.conf ]; then
|
|
|
|
rm -f /etc/X11/xorg.conf.d/10-keyboard.conf
|
|
|
|
fi
|
|
|
|
if [ -e /etc/X11/xorg.conf.d/15-keyboard-apple.conf ]; then
|
|
|
|
rm -f /etc/X11/xorg.conf.d/15-keyboard-apple.conf
|
|
|
|
fi
|
|
|
|
|
2011-10-02 15:51:10 +02:00
|
|
|
[ ! -e /etc/X11/xorg.conf.d/20-synaptics.conf ] && {
|
|
|
|
cat > /etc/X11/xorg.conf.d/20-touchpad.conf << __EOF
|
|
|
|
Section "InputClass"
|
|
|
|
Identifier "touchpad defaults"
|
|
|
|
Driver "synaptics"
|
|
|
|
Option "RTCornerButton" "2"
|
|
|
|
Option "HorizEdgeScroll" "true"
|
|
|
|
Option "TapButton1" "1"
|
|
|
|
Option "TapButton2" "2"
|
|
|
|
Option "TapButton3" "3"
|
|
|
|
Option "HorizScrollDelta" "0"
|
|
|
|
MatchIsTouchpad "on"
|
|
|
|
EndSection
|
|
|
|
__EOF
|
|
|
|
}
|
2011-04-27 19:57:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# (re)create the '/tmp/.ICE-unix' directory with the right permissions
|
|
|
|
rm -fr /tmp/.ICE-unix
|
|
|
|
install -m 1777 -o root -g root -d /tmp/.ICE-unix
|
|
|
|
|
2011-07-10 17:25:50 +02:00
|
|
|
# video hardware change detection
|
2012-02-28 19:25:33 +01:00
|
|
|
if [ -e /dev/nvhost-ctrl ]; then
|
|
|
|
VIDEO_DEV="NVIDIA TEGRA"
|
|
|
|
else
|
2012-09-01 20:49:24 +02:00
|
|
|
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
|
2013-09-18 02:01:19 +02:00
|
|
|
[ "$VIDEO_DEV" ] || VIDEO_DEV="embedded-unknown"
|
2012-02-28 19:25:33 +01:00
|
|
|
fi
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
|
|
|
|
VIDEO_DEV_CACHED="`cat $postpluglibdir/xorg.cache`"
|
|
|
|
[ "$VIDEO_DEV" = "$VIDEO_DEV_CACHED" ] || {
|
|
|
|
logmsg "$me" "warning: video device appears to have changed; re-probing"
|
|
|
|
mv $XORGCONF $XORGCONF.postplug.save
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2011-07-10 17:25:50 +02:00
|
|
|
if [ -e $XORGCONF ]; then
|
|
|
|
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
|
|
|
|
# assume first driver as default videodriver
|
|
|
|
VIDEODRIVER=${VIDEODRIVERS[0]}
|
|
|
|
|
2012-07-05 16:35:29 +02:00
|
|
|
[ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset`
|
2013-04-05 14:54:33 +02:00
|
|
|
[ "$NOUVEAU_MODESET" = "-1" ] && NOUVEAU_MODESET=1
|
2012-07-11 01:06:57 +02:00
|
|
|
[ -e /sys/module/radeon/parameters/modeset ] && RADEON_MODESET=`cat /sys/module/radeon/parameters/modeset`
|
2014-10-03 18:49:24 +02:00
|
|
|
[ "$RADEON_MODESET" = "-1" ] && RADEON_MODESET=1
|
2012-07-05 16:35:29 +02:00
|
|
|
|
2012-07-16 18:47:34 +02:00
|
|
|
if [ "$VIDEODRIVER" = "nvidia" -a "$NOUVEAU_MODESET" = "1" ]; then
|
2012-07-05 16:35:29 +02:00
|
|
|
# replace nvidia with nouveau
|
|
|
|
mv $XORGCONF $XORGCONF.postplug.nvidia.save
|
|
|
|
rmmod nvidia
|
|
|
|
echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf
|
2014-09-30 01:55:06 +02:00
|
|
|
VIDEODRIVER=""
|
2015-03-05 19:16:00 +01:00
|
|
|
elif [ "$NOUVEAU_MODESET" = "0" ]; then
|
|
|
|
# replace nouveau with nvidia (NOUVEAU_MODESET=0 means we have nvidia chip)
|
2012-07-05 16:35:29 +02:00
|
|
|
mv $XORGCONF $XORGCONF.postplug.nouveau.save
|
|
|
|
rmmod nouveau
|
2012-07-11 01:06:57 +02:00
|
|
|
rm -f /etc/modprobe.d/postplug-nouveau.conf
|
2014-09-30 01:55:06 +02:00
|
|
|
VIDEODRIVER="nvidia"
|
2011-07-10 17:25:50 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-04-27 19:57:03 +02:00
|
|
|
if [ ! -e $XORGCONF ]; then
|
|
|
|
#
|
|
|
|
# Create a new Xorg configuration file
|
|
|
|
#
|
2012-02-28 19:25:33 +01:00
|
|
|
if [ -e /dev/nvhost-ctrl -a -e $XORGCONF.tegra ]; then
|
|
|
|
# use default xorg.conf for Tegra
|
|
|
|
cp $XORGCONF.tegra $XORGCONF
|
|
|
|
else
|
|
|
|
# remove any nvidia driver loaded as they don't load according to PCIID
|
|
|
|
[ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia
|
2011-04-27 19:57:03 +02:00
|
|
|
|
2012-02-28 19:25:33 +01:00
|
|
|
# sync to avoid filesystem corruption in case of system hang on probe
|
|
|
|
sync
|
2011-04-27 19:57:03 +02:00
|
|
|
|
2012-09-01 20:49:24 +02:00
|
|
|
rm -f /tmp/xorg.conf.new
|
2015-03-05 19:16:00 +01:00
|
|
|
logmsg "$me" "info: running Xorg -configure"
|
|
|
|
tmpfile=`mktemp`
|
|
|
|
HOME=/tmp Xorg :5 -configure 2>>$tmpfile
|
2012-09-01 20:49:24 +02:00
|
|
|
RET=$?
|
2015-03-05 19:16:00 +01:00
|
|
|
grep "Server terminated with error" $tmpfile >/dev/null && RET=255
|
|
|
|
logmsg "$me" "info: Xorg -configure return code was $RET"
|
|
|
|
if [ $RET -ne 0 -a "$NOUVEAU_MODESET" != "0" ]; then
|
2012-09-01 20:49:24 +02:00
|
|
|
logmsg "$me" "warning: xorg autoprobed configuration failed; using xorg autoconfig"
|
|
|
|
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
|
|
|
|
else
|
|
|
|
mv /tmp/xorg.conf.new $XORGCONF
|
|
|
|
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
|
|
|
|
# disable autoconfigured multiple screens
|
|
|
|
sed -i "s|^\([[:space:]]*Screen[[:space:]]*[1-9].*\)|#\1|" $XORGCONF
|
|
|
|
fi
|
2012-02-28 19:25:33 +01:00
|
|
|
fi
|
2011-04-27 19:57:03 +02:00
|
|
|
let "CONFCREATED = 1"
|
2013-09-18 02:01:19 +02:00
|
|
|
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
|
|
|
|
# assume first driver as default videodriver
|
|
|
|
VIDEODRIVER=${VIDEODRIVERS[0]}
|
2011-04-27 19:57:03 +02:00
|
|
|
fi
|
|
|
|
|
2013-09-18 02:01:19 +02:00
|
|
|
if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
|
|
|
|
|
|
|
|
if [ "$nomodeset" = "1" -a "$VIDEODRIVER" = "nouveau" ]; then
|
|
|
|
sed -i "s|Driver\W*\"nouveau\"|Driver \"nvidia\"|" $XORGCONF
|
|
|
|
VIDEODRIVER=nvidia
|
|
|
|
rmmod nouveau nvidia
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$VIDEODRIVER" in
|
|
|
|
vesa|vga) sed -i -e '/Section "Screen"/a\
|
|
|
|
#DefaultColorDepth 24' $XORGCONF ;;
|
|
|
|
*) sed -i -e '/Section "Screen"/a\
|
|
|
|
DefaultColorDepth 24' $XORGCONF ;;
|
|
|
|
esac
|
|
|
|
|
2012-07-16 19:30:18 +02:00
|
|
|
# NVIDIA Compiz/3d configuration options
|
2012-02-17 23:36:11 +01:00
|
|
|
if [ "$VIDEODRIVER" == "nvidia" ]; then
|
2011-04-27 19:57:03 +02:00
|
|
|
sed -i -e '/Section "Screen"/a\
|
|
|
|
Option "AddARGBGLXVisuals" "true"\
|
2012-02-17 23:36:11 +01:00
|
|
|
Option "DisableGLXRootClipping" "true"' $XORGCONF
|
2011-04-27 19:57:03 +02:00
|
|
|
fi
|
|
|
|
|
2012-07-16 19:30:18 +02:00
|
|
|
# Nouveau configuration options
|
|
|
|
if [ "$VIDEODRIVER" == "nouveau" ]; then
|
|
|
|
sed -i -e '/Driver.*"nouveau"/a\
|
|
|
|
Option "GLXVBlank" "true"' $XORGCONF
|
|
|
|
fi
|
|
|
|
|
2011-08-21 18:02:00 +02:00
|
|
|
# configure VirtualBox mouse driver
|
|
|
|
if [ "$VIDEODRIVER" = "vboxvideo" ]; then
|
|
|
|
sed -i "s|\"mouse\"|\"vboxmouse\"|" $XORGCONF
|
|
|
|
fi
|
|
|
|
|
2011-04-27 19:57:03 +02:00
|
|
|
# Configure fonts
|
|
|
|
sed -i '/fonts\/Type1/d;s@\(.*X11/fonts.*\)/@\1:unscaled@' $XORGCONF
|
|
|
|
fc-cache
|
|
|
|
|
|
|
|
# Configure keyboard
|
|
|
|
|
|
|
|
# NOTE:
|
|
|
|
# see: /etc/X11/xkb/README.config
|
|
|
|
# /usr/lib/X11/doc/README.XKB-Config
|
|
|
|
# The X Keyboard Extension: Protocol Specification
|
|
|
|
# <URL:http://www.x-docs.org/XKB/XKBproto.pdf>
|
|
|
|
# xkb configuration
|
|
|
|
# <URL:http://www.tsu.ru/~pascal/en/xkb>
|
|
|
|
#
|
|
|
|
# /etc/X11/xkb/rules/xfree86.lst (commonest file of rules)
|
|
|
|
#
|
|
|
|
# The parameters are:
|
|
|
|
# XkbRules - files of rules to be used for keyboard mapping composition
|
|
|
|
# XkbModel - name of model of your keyboard type
|
|
|
|
# XkbLayout - layout(s) you intend to use
|
|
|
|
# XkbVariant - variant(s) of layout you intend to use
|
|
|
|
# XkbOptions - extra xkb configuration options
|
|
|
|
#
|
|
|
|
# XkbVariant has been left out: that means the default variant named basic is loaded.
|
|
|
|
|
|
|
|
if [ ! "$XKB_MODEL" -o ! "$XKB_LAYOUT" ]; then
|
|
|
|
case "${LANG:0:2}" in
|
|
|
|
it)
|
|
|
|
XKB_MODEL="pc105"
|
|
|
|
XKB_LAYOUT="it" ;;
|
|
|
|
de)
|
|
|
|
XKB_MODEL="pc105"
|
|
|
|
XKB_LAYOUT="de" ;;
|
|
|
|
es)
|
|
|
|
XKB_MODEL="pc105"
|
|
|
|
XKB_LAYOUT="es" ;;
|
|
|
|
fr)
|
|
|
|
XKB_MODEL="pc105"
|
|
|
|
XKB_LAYOUT="fr" ;;
|
|
|
|
*)
|
|
|
|
XKB_MODEL="pc104"
|
|
|
|
XKB_LAYOUT="us" ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "XKbOptions" ]; then
|
|
|
|
sed -i -e "/Identifier\W*\"Keyboard.*\"/a\\
|
|
|
|
Option \"XkbModel\" \"$XKB_MODEL\"\\
|
|
|
|
Option \"XkbLayout\" \"$XKB_LAYOUT\"\\
|
|
|
|
Option \"XKbOptions\" \"$XKB_OPTIONS\"" $XORGCONF
|
|
|
|
else
|
|
|
|
sed -i -e "/Identifier\W*\"Keyboard.*\"/a\\
|
|
|
|
Option \"XkbModel\" \"$XKB_MODEL\"\\
|
|
|
|
Option \"XkbLayout\" \"$XKB_LAYOUT\"" $XORGCONF
|
|
|
|
fi
|
|
|
|
|
|
|
|
# global mouse modifications to default configuration
|
|
|
|
sed -i -e '/"CorePointer"/i \
|
|
|
|
Option "AllowMouseOpenFail"' $XORGCONF
|
|
|
|
|
|
|
|
# echo "$XORGCONF" > $postplugnew_file
|
|
|
|
|
|
|
|
# Final probe
|
|
|
|
[ -f /var/log/Xorg.5.log ] && rm -f /var/log/Xorg.5.log
|
|
|
|
|
|
|
|
# sync to avoid filesystem corruption in case of system hang on probe
|
|
|
|
sync
|
|
|
|
|
2017-12-20 12:58:27 +01:00
|
|
|
xinit /bin/true -- :5
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
if [ -r /var/log/Xorg.5.log ]; then
|
|
|
|
|
2011-07-22 19:09:11 +02:00
|
|
|
if [ "`grep '\[KMS\] Kernel modesetting enabled' /var/log/Xorg.5.log`" ]; then
|
|
|
|
logmsg "$me" "info: "$"KMS enabled: assuming autodetect works for PANEL_SIZE and HSYNC_RANGE"
|
|
|
|
PANEL_SIZE_DETECTED="true"
|
|
|
|
HSYNC_RANGE_NOT_DETECTED=""
|
2011-04-27 19:57:03 +02:00
|
|
|
else
|
2011-07-22 19:09:11 +02:00
|
|
|
if [ "`grep 'hsync range of 28.00-33.00 kHz' /var/log/Xorg.5.log`" -o \
|
|
|
|
"`grep 'The EDID read for display device CRT-0 is invalid' /var/log/Xorg.5.log`" ]; then
|
|
|
|
# no values could be autodetected by DDC, so use a failsafe low value (30-49)
|
|
|
|
HSYNC_RANGE_NOT_DETECTED="true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ "`grep 'Printing DDC gathered Modelines' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep 'EDID vendor \"' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep 'Adding EDID-provided mode' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep -i 'Panel size from' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep -i 'Panel size is' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep -i 'Panel Size ' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep 'VESA VBE DDC read successfully' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep 'LCD on internal LVDS' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep 'LCD on internal LVDS' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
[ "`grep 'LVDS.* using initial mode' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
|
|
|
|
# nvidia driver: CRT-. EDID not got?
|
|
|
|
if [ "`grep 'Unable to read EDID for display device CRT-.' /var/log/Xorg.5.log`" -o \
|
|
|
|
"`grep 'Unable to get display device CRT-..s EDID' /var/log/Xorg.5.log`" ]; then
|
|
|
|
# nvidia driver: disable CRT-x from being used by default if DFP-0 is present
|
|
|
|
[ "`grep 'DFP-0' /var/log/Xorg.5.log`" ] && {
|
|
|
|
sed -i -e '/Section "Screen"/a\
|
|
|
|
Option "ConnectedMonitor" "DFP"' $XORGCONF
|
|
|
|
} || {
|
|
|
|
HSYNC_RANGE_NOT_DETECTED="true"
|
|
|
|
unset PANEL_SIZE_DETECTED
|
|
|
|
}
|
|
|
|
else
|
|
|
|
# nvidia driver: we trust in nvidia-auto-select
|
|
|
|
[ "`grep 'nvidia-auto-select' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# fglrx driver
|
|
|
|
[ "`grep 'EDID Version:' /var/log/Xorg.5.log`" ] && PANEL_SIZE_DETECTED="true"
|
|
|
|
|
|
|
|
[ "$autoresvideo" ] && PANEL_SIZE_DETECTED="true"
|
2011-04-27 19:57:03 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
[ "$XORG_DETECT_SCREEN_SIZE" = off -o "$lowresvideo" ] && unset PANEL_SIZE_DETECTED
|
|
|
|
|
|
|
|
[ "$HSYNC_RANGE_NOT_DETECTED" ] && {
|
|
|
|
logmsg "$me" "\
|
|
|
|
warning: DDC hsync range cannot be detected, setting default of 30-49 kHz"
|
|
|
|
sed -i -e '/Section\W*"Monitor"/a\
|
|
|
|
HorizSync 30-49' $XORGCONF
|
|
|
|
}
|
|
|
|
|
2014-06-30 00:18:40 +02:00
|
|
|
[ "$HSYNC_RANGE_NOT_DETECTED" -a ! "$PANEL_SIZE_DETECTED" ] &&
|
2011-04-27 19:57:03 +02:00
|
|
|
sed -i -e '/SubSection "Display"/a\
|
|
|
|
Modes "1024x768" "800x600" "640x480"' $XORGCONF
|
|
|
|
else
|
|
|
|
logmsg "$me" "warning: "$"Xorg probe failed!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-09-18 02:01:19 +02:00
|
|
|
[ "$VIDEO_DEV" -a "$VIDEO_DEV" != "$VIDEO_DEV_CACHED" ] &&
|
|
|
|
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
|
|
|
|
|
2011-04-27 19:57:03 +02:00
|
|
|
####################################
|
|
|
|
#
|
|
|
|
# Xorg dynamic configuration section
|
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
2013-01-27 19:30:36 +01:00
|
|
|
# radeon: enable a conservative power profile (mid) by default
|
|
|
|
if [ -e /sys/class/drm/card0/device/power_profile ]; then
|
2014-10-03 18:49:24 +02:00
|
|
|
[ "$XORG_POWER_PROFILE" ] || XORG_POWER_PROFILE="mid"
|
|
|
|
echo $XORG_POWER_PROFILE > /sys/class/drm/card0/device/power_profile
|
2013-01-27 19:30:36 +01:00
|
|
|
fi
|
|
|
|
|
2014-06-29 19:56:04 +02:00
|
|
|
# Configure keyboard
|
|
|
|
xorg_d_configure_input
|
|
|
|
|
2014-12-21 13:27:09 +01:00
|
|
|
if [ -d /sys/devices/platform/sunxi-rtc -a ! -e /etc/X11/xorg.conf.d/30-serverflags.conf ]; then
|
|
|
|
# Workaround: disable DPMS on BananaPi
|
|
|
|
cat > /etc/X11/xorg.conf.d/30-serverflags.conf << _EOF
|
|
|
|
Section "ServerFlags"
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
Option "OffTime" "0"
|
|
|
|
EndSection
|
|
|
|
_EOF
|
|
|
|
fi
|
|
|
|
|
2015-03-05 19:16:00 +01:00
|
|
|
# enable 'Composite' extensions
|
|
|
|
if [ "$VIDEODRIVER" -a "$VIDEODRIVER" != "mga" -a ! -e /etc/X11/xorg.conf.d/40-extensions.conf ]; then
|
|
|
|
cat > /etc/X11/xorg.conf.d/40-extensions.conf << _EOF
|
|
|
|
Section "Extensions"
|
|
|
|
Option "Composite" "true"
|
|
|
|
EndSection
|
|
|
|
_EOF
|
|
|
|
elif [ "$VIDEODRIVER" != "mga" -a -e /etc/X11/xorg.conf.d/40-extensions.conf ]; then
|
|
|
|
rm -f /etc/X11/xorg.conf.d/40-extensions.conf
|
|
|
|
fi
|
2011-04-27 19:57:03 +02:00
|
|
|
|
2015-03-05 19:16:00 +01:00
|
|
|
# add 'Section "DRI"'
|
|
|
|
if [ "$VIDEODRIVER" -a "$VIDEODRIVER" != "mga" -a ! -e /etc/X11/xorg.conf.d/50-dri.conf ]; then
|
|
|
|
cat > /etc/X11/xorg.conf.d/50-dri.conf << _EOF
|
|
|
|
Section "DRI"
|
2011-04-27 19:57:03 +02:00
|
|
|
Mode 0666
|
2015-03-05 19:16:00 +01:00
|
|
|
EndSection
|
|
|
|
_EOF
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d /sys/devices/platform/sunxi-rtc -a ! -e /etc/X11/xorg.conf.d/30-serverflags.conf ]; then
|
|
|
|
# Workaround: disable DPMS on BananaPi
|
|
|
|
cat > /etc/X11/xorg.conf.d/30-serverflags.conf << _EOF
|
|
|
|
Section "ServerFlags"
|
|
|
|
Option "StandbyTime" "0"
|
|
|
|
Option "SuspendTime" "0"
|
|
|
|
Option "OffTime" "0"
|
|
|
|
EndSection
|
|
|
|
_EOF
|
2011-04-27 19:57:03 +02:00
|
|
|
fi
|
|
|
|
|
2015-03-05 19:16:00 +01:00
|
|
|
# Workaround symlink for libglx.so (or Xorg will choose the wrong one)
|
|
|
|
if [ -e /usr/lib/xorg/modules/extensions/libglx.so -a ! -e /usr/lib/xorg/modules/libglx.so ]; then
|
|
|
|
ln -s extensions/libglx.so /usr/lib/xorg/modules/extensions/libglx.so
|
2011-04-27 19:57:03 +02:00
|
|
|
fi
|
2015-03-05 19:16:00 +01:00
|
|
|
if [ -e /usr/lib64/xorg/modules/extensions/libglx.so -a ! -e /usr/lib64/xorg/modules/libglx.so ]; then
|
|
|
|
ln -s extensions/libglx.so /usr/lib64/xorg/modules/libglx.so
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ -e $XORGCONF -a "$VIDEODRIVER" ] || exit 0
|
|
|
|
|
|
|
|
# add missing brackets to Xorg.conf device entries
|
|
|
|
sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
# Configure Mice...
|
|
|
|
|
|
|
|
# remove wrong configuration for USBMouse (duplicating PS2MOUSE)
|
|
|
|
sed -i "/[\W]*InputDevice[\W]*"USBMouse".*/d" $XORGCONF
|
|
|
|
|
|
|
|
# remove obsolete input pointers configuration (since xorg-server 1.7)
|
|
|
|
sed -i "/[[:space:]]*InputDevice[[:space:]]*.*PS2Mouse.*/d; \
|
|
|
|
/[[:space:]]*InputDevice[[:space:]]*.*Synaptics.*/d; \
|
|
|
|
/[[:space:]]*InputDevice[[:space:]]*.*Alps.*/d" $XORGCONF
|
|
|
|
|
2012-02-17 23:36:11 +01:00
|
|
|
# remove all devices set
|
2011-04-27 19:57:03 +02:00
|
|
|
sed -i "/\W*Option \"Device\".*/d" $XORGCONF
|
|
|
|
|
2012-02-17 23:36:11 +01:00
|
|
|
# remove obsoleted XAANoOffscreenPixmaps
|
2012-02-19 22:37:58 +01:00
|
|
|
sed -i '/^[[:space:]]*Option[[:space:]]*"XAANoOffscreenPixmaps" "true"/d' $XORGCONF
|
2012-02-17 23:36:11 +01:00
|
|
|
|
2011-04-27 19:57:03 +02:00
|
|
|
# disable keyboard configuration for Xorg >= 1.4
|
|
|
|
sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF
|
|
|
|
|
|
|
|
# FIXME: delete empty lines
|
|
|
|
sed -i '/./,$!d' $XORGCONF
|
|
|
|
|
|
|
|
exit 0
|