debian/changelog | 14 + debian/local/Failsafe/failsafeDexconf | 335 +++++++++++++++++++++------------- debian/local/Failsafe/failsafeXServer | 18 + 3 files changed, 235 insertions(+), 132 deletions(-)
New commits: commit 20c9c0a41dfe9fa3ece88b5d097272369f316333 Author: Bryce Harrington <[EMAIL PROTECTED]> Date: Fri Sep 19 16:02:30 2008 -0700 Resync failsafeDexconf to dexconf. Switch keyboard/mouse handling over to input-hotplug. diff --git a/debian/changelog b/debian/changelog index d76a5c7..a0e66d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,14 @@ xorg (1:7.4~2ubuntu4) UNRELEASED; urgency=low - * local/Failsafe/failsafeXServer: 'discover' is no longer used, so - disable the pci-id based detection of alternate fallback driver, since - without discover it just uses 'vesa'. Going forward, we'll probably - just have the X server do the fallback on its own. (LP: 272086) - - -- Bryce Harrington <[EMAIL PROTECTED]> Fri, 19 Sep 2008 13:28:43 -0700 + * local/Failsafe/failsafeXServer: + - 'discover' is no longer used, so disable the pci-id based detection + of alternate fallback driver. (LP: #272086) + - Add detection of ppc hardware and prefer 'fbdev' instead of 'vesa' + in this case (LP: #155685) + * local/Failsafe/failsafeDexconf: + - Re-sync with dexconf; use input-hotplug for devices. (LP: #227818) + + -- Bryce Harrington <[EMAIL PROTECTED]> Fri, 19 Sep 2008 16:01:43 -0700 xorg (1:7.4~2ubuntu3) intrepid; urgency=low diff --git a/debian/local/Failsafe/failsafeDexconf b/debian/local/Failsafe/failsafeDexconf index 6b08ec5..ff51c5d 100755 --- a/debian/local/Failsafe/failsafeDexconf +++ b/debian/local/Failsafe/failsafeDexconf @@ -1,16 +1,14 @@ #!/bin/sh -# failsafeDexconf: Debian X server configuration file writer for failsafe X mode +# dexconf: Debian X server configuration file writer for failsafe mode # -# This tool is a backend which uses debconf database values along with -# some overrides for running X in vesa (or vga) modes. It outputs an -# XFree86 X server configuration file based on the information in the -# database. +# This tool is a backend which uses debconf database values. It writes an +# XFree86 X server configuration file based on the information in the database. # # This script is derived from the dexconf program, written by -# Branden Robinson. +# Branden Robinson -# Copyright 2007 Canonical, Ltd. +# Copyright 2007--2008 Canonical, Ltd. # Copyright 2000--2004 Progeny Linux Systems, Inc. # # This is free software; you may redistribute it and/or modify @@ -28,16 +26,27 @@ # not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA -DEVICE_DRIVER=${1:-"vesa"} -OUTFILE=${2:-"/etc/X11/xorg.conf.failsafe"} -SERVER="xorg" +set -e # source debconf library . /usr/share/debconf/confmodule +# display a usage message +usage () { + cat <<EOF +Usage: $PROGNAME [OPTION ...] + write an Xorg X server configuration file based on debconf database values +Options: + -h, --help display this usage message and exit + -o FILE, --output=FILE write configuration file to FILE +This help message is intended only as a quick reference. For a description of +the usage of $PROGNAME, see the $PROGNAME(1) manual page. +EOF +} + # the error-out function bomb () { - echo "$PROGNAME: error: $*" | fold -s -w "${COLUMNS:-80}" 1>&2 + echo "$PROGNAME: error: $*" | fold -s -w "${COLUMNS:-80}" >&2 exit 1 } @@ -53,163 +62,243 @@ fetch () { fi } -if [ -e ${OUTFILE} ]; then - if [ ! -w ${OUTFILE} ]; then - bomb "Cannot write to existing ${OUTFILE}" - else - mv ${OUTFILE} ${OUTFILE}.bak - cat /dev/null > ${OUTFILE} - fi -fi - -if which laptop-detect >/dev/null 2>&1; then - if laptop-detect > /dev/null ; then - LAPTOP=true - fi -fi +# convert a debconf comma-delimited list to a shell whitespace-delimited list +list_convert () { + echo $(IFS=", "; set -- $RET; while [ $# -gt 0 ]; do echo \"$1\"; shift; done) +} -### HEADER +SERVER="xorg" +XF86CONFIG=/etc/X11/xorg.conf.failsafe +PROGNAME=${0##*/} +SHOWHELP= +EARLYEXIT= -# Because debconf hijacks standard output and its confmodule uses file -# descriptor 3 for its own purposes, we will write our output to file descriptor -# 4 instead of standard output. +GETOPT_OUTPUT=$(getopt --options ho: \ + --longoptions help,output: \ + -n "$PROGNAME" -- "$@") -cat <<SECTION >> ${OUTFILE} -# xorg.conf (X.Org X Window System server configuration file) -# -# This file was generated by failsafeDexconf, using -# values from the debconf database and some overrides to use vesa mode. -# -# You should use dexconf or another such tool for creating a "real" xorg.conf -# For example: -# sudo dpkg-reconfigure -phigh xserver-xorg -SECTION +if [ $? -ne 0 ]; then + bomb "error while getting options; use \"$PROGNAME --help\" for help" +fi -### KEYBOARD / INPUTDEVICE - -fetch xserver-$SERVER/config/inputdevice/keyboard/rules -XKB_RULES="$RET" -fetch xserver-$SERVER/config/inputdevice/keyboard/model -XKB_MODEL="$RET" -fetch xserver-$SERVER/config/inputdevice/keyboard/layout -XKB_LAYOUT="$RET" -# XkbVariant and XkbOptions are permitted to be null. -db_get xserver-$SERVER/config/inputdevice/keyboard/variant -XKB_VARIANT="$RET" -db_get xserver-$SERVER/config/inputdevice/keyboard/options -XKB_OPTIONS="$RET" - -cat <<SECTION >> ${OUTFILE} -Section "InputDevice" - Identifier "Generic Keyboard" - Driver "kbd" - Option "XkbRules" "$XKB_RULES" - Option "XkbModel" "$XKB_MODEL" - Option "XkbLayout" "$XKB_LAYOUT" -SECTION -if [ -n "$XKB_VARIANT" ]; then - printf "\tOption\t\t\"XkbVariant\"\t\"$XKB_VARIANT\"\n" >> ${OUTFILE} +eval set -- "$GETOPT_OUTPUT" + +while :; do + case "$1" in + -f|--format) + bomb "This option, and XFree86 3.x output, are no longer supported." + ;; + -h|--help) SHOWHELP=yes EARLYEXIT=yes ;; + -o|--output) XF86CONFIG="$2"; shift ;; + --) shift; break ;; + *) + bomb "unrecognized option \"$1\"; use \"$PROGNAME --help\" for help" + ;; + esac + shift +done + +if [ -n "$SHOWHELP" ]; then + usage fi -if [ -n "$XKB_OPTIONS" ]; then - printf "\tOption\t\t\"XkbOptions\"\t\"$XKB_OPTIONS\"\n" >> ${OUTFILE} + +if [ -n "$EARLYEXIT" ]; then + exit 0 fi -printf "EndSection\n\n" >> ${OUTFILE} -### MOUSE / INPUTDEVICE +DEXCONFTMPDIR= -DO_EMULATE3BUTTONS= +trap 'if [ -e "$DEXCONFTMPDIR/backup" ] && [ -n "$XF86CONFIG" ]; then \ + cat "$DEXCONFTMPDIR/backup" >"$XF86CONFIG"; \ + fi; \ + exec 4<&-; \ + rm -rf "$DEXCONFTMPDIR"; \ + bomb "received signal; aborting"' HUP INT QUIT TERM -fetch xserver-$SERVER/config/inputdevice/mouse/emulate3buttons -if [ "$RET" = "true" ]; then - DO_EMULATE3BUTTONS=true -fi -MOUSE_DRIVER=mouse -IS_VIRT= -if which vmmouse_detect >/dev/null 2>&1; then - if vmmouse_detect > /dev/null ; then - MOUSE_DRIVER=vmmouse - IS_VIRT=true - fi +# Set up a temporary directory for the files we'll be writing. +TDIR_PARENT="${TMPDIR:-/tmp}" +TDIR="${TMPDIR:-/tmp}/dexconf-tmp-$$" + +if [ ! -d "$TDIR_PARENT" ]; then + bomb "cannot create temporary work directory; \"$TDIR_PARENT\" does not" \ + "exist or is not a directory" fi -cat <<SECTION >> ${OUTFILE} -Section "InputDevice" - Identifier "Configured Mouse" - Driver "$MOUSE_DRIVER" -SECTION -if [ -n "$DO_EMULATE3BUTTONS" ]; then - printf "\tOption\t\t\"Emulate3Buttons\"\t\"true\"\n" >> ${OUTFILE} +if [ ! -w "$TDIR_PARENT" ]; then + bomb "cannot create temporary work directory in \"$TDIR_PARENT\"; directory" \ + "not writable" fi -if [ -n "$IS_VIRT" ]; then - printf "\tOption\t\t\"Device\"\t\"/dev/input/mice\"\n" >> ${OUTFILE} + +rm -rf "$TDIR" + +if mkdir -m 0700 "$TDIR"; then + DEXCONFTMPDIR="$TDIR" +else + bomb "creation of temporary work directory \"$TDIR\" failed" fi -printf "EndSection\n\n" >> ${OUTFILE} -if [ -n "$LAPTOP" ]; then - cat <<SECTION >> ${OUTFILE} +# xorg.conf sections: +# Files File pathnames +# ServerFlags Server flags NOT USED BY DEXCONF +# Module Dynamic module loading NOT USED BY DEXCONF +# InputDevice Input device description +# Device Graphics device description +# VideoAdaptor Xv video adaptor description NOT USED BY DEXCONF +# Monitor Monitor description +# Modes Video modes descriptions NOT USED BY DEXCONF +# Screen Screen configuration +# ServerLayout Overall layout NOT USED BY DEXCONF +# DRI DRI-specific configuration NOT USED BY DEXCONF +# Vendor Vendor-specific configuration NOT USED BY DEXCONF -Section "InputDevice" - Identifier "Synaptics Touchpad" - Driver "synaptics" - Option "SendCoreEvents" "true" - Option "Device" "/dev/psaux" - Option "Protocol" "auto-dev" - Option "HorizEdgeScroll" "0" -EndSection +### HEADER + +# Because debconf hijacks standard output and its confmodule uses file +# descriptor 3 for its own purposes, we will write our output to file descriptor +# 4 instead of standard output. + +exec 4>"$DEXCONFTMPDIR/Header" +cat >&4 <<SECTION +# xorg.conf.failsafe (X.Org X Window System server configuration file) +# +# This file was generated by dexconf, the Debian X Configuration tool, using +# values from the debconf database. +# +# Edit this file with caution, and see the xorg.conf manual page. +# (Type "man xorg.conf" at the shell prompt.) +# +# This file is automatically updated on xserver-xorg package upgrades *only* +# if it has not been modified since the last upgrade of the xserver-xorg +# package. +# +# If you have edited this file but would like it to be automatically updated +# again, run the following command: +# sudo dpkg-reconfigure -phigh xserver-xorg SECTION -fi ### DEVICE +db_get xserver-$SERVER/config/device/driver +DEVICE_DRIVER="$RET" db_get xserver-$SERVER/config/device/bus_id DEVICE_BUSID="$RET" -cat <<SECTION >> ${OUTFILE} +db_get xserver-$SERVER/config/device/use_fbdev +DEVICE_USE_FBDEV="$RET" + +# Override device driver +DEVICE_DRIVER=${1:-"vesa"} + +QEMU_KVM=$(grep "QEMU Virtual CPU" /proc/cpuinfo || true) +if [ -n "$QEMU_KVM" ]; then + DEVICE_DRIVER="cirrus" +fi + +exec 4>"$DEXCONFTMPDIR/Device" +cat >&4 <<SECTION Section "Device" Identifier "Configured Video Device" - Driver "$DEVICE_DRIVER" SECTION -printf "EndSection\n\n" >> ${OUTFILE} +if [ -n "$DEVICE_DRIVER" ]; then + printf "\tDriver\t\t\"$DEVICE_DRIVER\"\n" >&4 +fi +PS3_FB=$(grep -i PS3 /proc/fb 2>/dev/null || true) +if [ -n "$PS3_FB" ]; then + printf "\tOption\t\t\"ShadowFB\"\t\t\"false\"\n" >&4 +fi +if [ -n "$DEVICE_BUSID" ]; then + printf "\tBusID\t\t\"$DEVICE_BUSID\"\n" >&4 +fi +if [ "$DEVICE_USE_FBDEV" = "true" ]; then + printf "\tOption\t\t\"UseFBDev\"\t\t\"$DEVICE_USE_FBDEV\"\n" >&4 +fi +printf "EndSection\n" >&4 ### MONITOR -cat <<SECTION >> ${OUTFILE} +exec 4>"$DEXCONFTMPDIR/Monitor" +cat >&4 <<SECTION Section "Monitor" Identifier "Configured Monitor" -EndSection +SECTION +if [ -n "$QEMU_KVM" ]; then + printf "\tHorizSync\t30-70\n" >&4 + printf "\tVertRefresh\t50-160\n" >&4 +fi +cat >&4 <<SECTION +EndSection SECTION ### SCREEN -DISPLAY_MODES="800x600" - -cat <<SECTION >> ${OUTFILE} +exec 4>"$DEXCONFTMPDIR/Screen" +cat >&4 <<SECTION Section "Screen" Identifier "Default Screen" - Device "Configured Video Device" Monitor "Configured Monitor" + Device "Configured Video Device" +SECTION +if [ -n "$PS3_FB" ]; then + printf "\tDefaultFbBpp 32\n" >&4 +fi +if [ -n "$QEMU_KVM" ]; then +cat >&4 <<SUBSECTION + DefaultDepth 24 SubSection "Display" - Modes "$DISPLAY_MODES" + Depth 24 + Modes "1280x800" "1152x768" "1024x768" "800x600" "640x480" EndSubSection -EndSection +SUBSECTION +fi +printf "EndSection\n" >&4 -SECTION +# Close file descriptor 4 before we delete temporary files +exec 4<&- + +# Tell debconf to stop listening to us. +db_stop -### SERVERLAYOUT +# Write the configuration file. Put a blank line before every section we write +# except the first. -cat <<SECTION >> ${OUTFILE} -Section "ServerLayout" - Identifier "Default Layout" - Screen "Default Screen" -SECTION -if [ -n "$LAPTOP" ]; then - printf "\tInputDevice\t\"Synaptics Touchpad\"\n" >> ${OUTFILE} +OUTFILE="$DEXCONFTMPDIR/dexconf-out" +umask 022 +: >"$OUTFILE" + +SPACER= +for SECTION in Header Files InputDeviceKeyboard InputDeviceMouse \ + Device Monitor Screen; do + if [ -e "$DEXCONFTMPDIR/$SECTION" ]; then + eval $SPACER + cat "$DEXCONFTMPDIR/$SECTION" >>"$OUTFILE" + SPACER='echo "" >>"$OUTFILE"' + fi +done + +# Ensure we can write to our destination if it already exits. +if [ -e "$XF86CONFIG" ]; then + if [ ! -w "$XF86CONFIG" ]; then + bomb "unable to write to \"$XF86CONFIG\"" + fi fi -printf "EndSection\n" >> ${OUTFILE} -# Tell debconf to stop listening to us. -db_stop +BACKUP= +# Create a backup of the existing configuration file if it already exists. +if [ -e "$XF86CONFIG" ]; then + cat "$XF86CONFIG" >"$DEXCONFTMPDIR/backup" + BACKUP=true +fi + +# Move the new file into place. +if ! cat "$OUTFILE" >"$XF86CONFIG"; then + # Failed; try to restore the backup. + if [ -n "$BACKUP" ]; then + cat "$DEXCONFTMPDIR/backup" >"$XF86CONFIG" + fi +fi + +rm -rf "$DEXCONFTMPDIR" exit 0 commit b5ecfbec28a8b4415745bb75e02ceefc5fa5437e Author: Bryce Harrington <[EMAIL PROTECTED]> Date: Fri Sep 19 15:38:45 2008 -0700 Update how the fallback driver is detected diff --git a/debian/changelog b/debian/changelog index 23d78c8..d76a5c7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +xorg (1:7.4~2ubuntu4) UNRELEASED; urgency=low + + * local/Failsafe/failsafeXServer: 'discover' is no longer used, so + disable the pci-id based detection of alternate fallback driver, since + without discover it just uses 'vesa'. Going forward, we'll probably + just have the X server do the fallback on its own. (LP: 272086) + + -- Bryce Harrington <[EMAIL PROTECTED]> Fri, 19 Sep 2008 13:28:43 -0700 + xorg (1:7.4~2ubuntu3) intrepid; urgency=low [Michael Larabel] @@ -6,7 +15,7 @@ xorg (1:7.4~2ubuntu3) intrepid; urgency=low -- Bryce Harrington <[EMAIL PROTECTED]> Fri, 19 Sep 2008 12:17:46 -0700 -xorg (1:7.4~2ubuntu2) UNRELEASED; urgency=low +xorg (1:7.4~2ubuntu2) intrepid; urgency=low [Loic Minier] * local/xserver-wrapper.c: Add support for /dev/console and other diff --git a/debian/local/Failsafe/failsafeXServer b/debian/local/Failsafe/failsafeXServer index 107a4bf..8c99e9e 100755 --- a/debian/local/Failsafe/failsafeXServer +++ b/debian/local/Failsafe/failsafeXServer @@ -26,15 +26,8 @@ xorg_conf_failsafe=${BPX_XORG_CONF_FAILSAFE:-"/etc/X11/xorg.conf.failsafe"} xorg_conf=${BPX_XORG_CONF:-"/etc/X11/xorg.conf"} - run_dexconf=${BPX_RUN_DEXCONF:-"yes"} - -# TODO: This should be set to "vga", however I have been unable to -# succeed in getting the vga driver running in anything over -# 320x200, which is unusable. So fallback is disabled for now. -#fallback_driver="vga" fallback_driver=${BPX_FALLBACK_DRIVER:-"vesa"} - client=${BPX_CLIENT:-"/etc/gdm/failsafeXinit"} clientargs=${BPX_CLIENTARGS:-$xorg_conf_failsafe} blacklist=${BPX_BLACKLIST:-"/etc/gdm/failsafeBlacklist"} @@ -86,7 +79,16 @@ pciids_in_order() { } get_driver() { - echo $fallback_driver + machine=$(uname -m) + if [ $machine = "ppc" ]; then + echo "fbdev" + elif [ $machine = "powerpc" ]; then + echo "fbdev" + elif [ $machine = "ppc64" ]; then + echo "fbdev" + else + echo $fallback_driver + fi return 0 } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]