diff -Nru usplash-0.5.25/bogl/.cvsignore usplash-0.5.25ubuntu1/bogl/.cvsignore --- usplash-0.5.25/bogl/.cvsignore 2007-10-15 05:20:39.000000000 -0400 +++ usplash-0.5.25ubuntu1/bogl/.cvsignore 1969-12-31 19:00:00.000000000 -0500 @@ -1,11 +0,0 @@ -.depend -bdftobogl -giftobogl -reduce-font -pngtobogl -bterm -unifont-reduced.bdf -unifont-reduced.bgf -*.lo -build-stamp -libbogl.so.0.1 diff -Nru usplash-0.5.25/debian/changelog usplash-0.5.25ubuntu1/debian/changelog --- usplash-0.5.25/debian/changelog 2008-10-16 17:39:56.000000000 -0400 +++ usplash-0.5.25ubuntu1/debian/changelog 2008-12-07 15:55:14.000000000 -0500 @@ -1,3 +1,19 @@ +usplash (0.5.25ubuntu1) intrepid; urgency=low + + * fixpal.c: Restore vga palette mapping. If this somehow makes it into + a release: FIX THIS IN USPLASH!!! If usplash is not restoring the vga + palette mapping, there's probably other things that it's leaving in a + bad state as well... + * Makefile: build and install fixpal + * debian/usplash.init: execute fixpal after usplash exits + * debian/local/fixpal: new init script to run fixpal just before gdm + starts and just after it exits, but only if usplash isn't running + * debian/usplash.postinst: do links for fixpal init script + * debian/usplash.postrm: do links for fixpal init script + * debian/usplash.install: new files: fixpal executable and init script + + -- J. Scott Berg Sat, 06 Dec 2008 16:49:46 -0500 + usplash (0.5.25) intrepid; urgency=low * libusplash.h: Export usplash_timeout_get_string() definition and provide a diff -Nru usplash-0.5.25/debian/local/fixpal usplash-0.5.25ubuntu1/debian/local/fixpal --- usplash-0.5.25/debian/local/fixpal 1969-12-31 19:00:00.000000000 -0500 +++ usplash-0.5.25ubuntu1/debian/local/fixpal 2008-12-07 16:10:57.000000000 -0500 @@ -0,0 +1,52 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: fixpal +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Clean up color palette that usplash scribbled on +# Description: Usplash leaves the color palette in a bad state. +# Probably some other things too. This is a hack, +# usplash needs to get fixed. +### END INIT INFO + +# Author: J. Scott Berg + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="VGA palette cleanup" +NAME=fixpal +DAEMON=/usr/lib/usplash/$NAME +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x "$DAEMON" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +case "$1" in + start|stop|reload|force-reload|restart) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + if pidof usplash > /dev/null + then + log_failure_msg "can't fix palette: usplash running" + elif ! $DAEMON + then + log_failure_msg "fix palette failed: $?" + fi + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff -Nru usplash-0.5.25/debian/usplash.init usplash-0.5.25ubuntu1/debian/usplash.init --- usplash-0.5.25/debian/usplash.init 2008-10-08 05:32:07.000000000 -0400 +++ usplash-0.5.25ubuntu1/debian/usplash.init 2008-12-06 18:07:53.000000000 -0500 @@ -82,6 +82,7 @@ case "$1" in start) usplash_quit + /usr/lib/usplash/fixpal ;; stop) SPLASH=false diff -Nru usplash-0.5.25/debian/usplash.install usplash-0.5.25ubuntu1/debian/usplash.install --- usplash-0.5.25/debian/usplash.install 2008-05-27 15:15:34.000000000 -0400 +++ usplash-0.5.25ubuntu1/debian/usplash.install 2008-12-07 15:41:58.000000000 -0500 @@ -4,5 +4,7 @@ usr/sbin/update-usplash-theme usr/share/initramfs-tools/hooks/usplash usr/share/initramfs-tools/scripts/init-top/usplash +usr/lib/usplash/fixpal +../local/fixpal /etc/init.d ../usplash.py /usr/share/apport/package-hooks/ ../splash-functions /lib/init/ diff -Nru usplash-0.5.25/debian/usplash.postinst usplash-0.5.25ubuntu1/debian/usplash.postinst --- usplash-0.5.25/debian/usplash.postinst 2008-03-31 06:08:13.000000000 -0400 +++ usplash-0.5.25ubuntu1/debian/usplash.postinst 2008-12-07 15:47:03.000000000 -0500 @@ -83,6 +83,11 @@ ;; esac +if [ -x /etc/init.d/fixpal ] +then + update-rc.d fixpal defaults 29 02 >/dev/null 2>&1 +fi + #DEBHELPER# exit 0 diff -Nru usplash-0.5.25/debian/usplash.postrm usplash-0.5.25ubuntu1/debian/usplash.postrm --- usplash-0.5.25/debian/usplash.postrm 2007-10-15 05:20:39.000000000 -0400 +++ usplash-0.5.25ubuntu1/debian/usplash.postrm 2008-12-07 15:51:32.000000000 -0500 @@ -43,6 +43,7 @@ purge) rm -f /etc/usplash.conf + update-rc.d usplash remove > /dev/null ;; upgrade|failed-upgrade|disappear|abort-install|abort-upgrade) ;; diff -Nru usplash-0.5.25/fixpal.c usplash-0.5.25ubuntu1/fixpal.c --- usplash-0.5.25/fixpal.c 1969-12-31 19:00:00.000000000 -0500 +++ usplash-0.5.25ubuntu1/fixpal.c 2008-12-01 20:11:36.000000000 -0500 @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +/* + This is essentially a trimmed down version of svgalib's restorepalette + */ + +static __inline__ void port_out(uint8_t value, uint16_t port) +{ + __asm__ volatile ("outb %0,%1" + ::"a" (value), "d"(port)); +} + +static __inline__ uint8_t port_in(uint16_t port) +{ + uint8_t value; + __asm__ volatile ("inb %1,%0" + :"=a" (value) + :"d"(port)); + return value; +} + +/* delay_index is an attempt to prevent the delay loop from being + optimized away */ +static unsigned delay_index=0; +void delay (void) +{ + unsigned j=0; + /* I have no idea how to determine an appropriate delay length. + I don't even know that it is needed. + This is just what was done in restorepalette */ + for (j=0 ; j < 10 ; ++j) + ++delay_index; +} + +static __inline__ void reset_ff(uint8_t msr) +{ + if (msr & 0x1) + port_in(0x3da); + else + port_in(0x3ba); + delay (); +} + +static __inline__ void acr_write(uint8_t reg, uint8_t val, uint8_t msr) +{ + reset_ff(msr); + port_out (reg, 0x3c0); + delay (); + port_out (val, 0x3c0); + delay (); +} + +int main(int argc, char *argv[]) +{ + uint8_t i; + uint8_t msr; + struct termios t0,t1; + + /* This means you must have CAP_SYS_RAWIO privilege: in most cases, + run as root */ + if (ioperm(0x3ba,0x21,1)) + { + fprintf(stderr,"ioperm : %d(%s)\n",errno,strerror(errno)); + return 1; + } + + ioctl(0,TCGETS,&t0); + t1 = t0; + t1.c_lflag &= ~ISIG; + ioctl(0,TCSETSW,&t1); + + /* + Reset palette mapping to the identity map. Also set a couple other + attribute controle registers to make sure the bits come from the right + places. + Where to find this documented: in principle everything here is "VGA + Standard," but I know of no definitive edition of this "standard." + The following reference manuals contain detailed documentation of + what I've done here: + Intel 810 Chipset Family Programmers Reference Manual, November 1999, + Revision 1.0 (Intel order number 298026-001) + Cirrus Logic CL-GD5446 Technical Reference Manual, November 1996, + Second Edition + */ + msr = port_in(0x3cc); + delay(); + acr_write(0x10,0x00,msr); + acr_write(0x14,0x00,msr); + for (i = 0; i < 0xf; i++) + acr_write(i,i,msr); + reset_ff(msr); + port_out (0x20, 0x3c0); + + ioctl(0,TCSETSW,&t0); + + return 0; +} diff -Nru usplash-0.5.25/Makefile usplash-0.5.25ubuntu1/Makefile --- usplash-0.5.25/Makefile 2007-10-15 05:20:39.000000000 -0400 +++ usplash-0.5.25ubuntu1/Makefile 2008-12-06 18:06:09.000000000 -0500 @@ -12,7 +12,7 @@ INSTALL_PROGRAM = $(INSTALL) -m 755 -TARGETS = usplash usplash_write +TARGETS = fixpal usplash usplash_write usplash_BACKEND_LDFLAGS = -ldl @@ -48,6 +48,9 @@ usplash_write: $(usplash_write_OBJECTS) $(LINK) -o $@ $^ +fixpal: fixpal.c + $(COMPILE) -c fixpal.c + $(LINK) -o $@ fixpal.o bogl: $(MAKE) -C bogl @@ -66,10 +69,11 @@ install: - $(INSTALL) -d $(DESTDIR)/sbin $(DESTDIR)/usr/sbin $(DESTDIR)/lib $(DESTDIR)/usr/include $(DESTDIR)/usr/bin + $(INSTALL) -d $(DESTDIR)/sbin $(DESTDIR)/usr/sbin $(DESTDIR)/lib $(DESTDIR)/usr/include $(DESTDIR)/usr/bin $(DESTDIR)/usr/lib/usplash $(INSTALL_PROGRAM) usplash $(DESTDIR)/sbin $(INSTALL_PROGRAM) usplash_write $(DESTDIR)/sbin $(INSTALL_PROGRAM) usplash_down $(DESTDIR)/sbin + $(INSTALL_PROGRAM) fixpal $(DESTDIR)/usr/lib/usplash $(INSTALL_PROGRAM) update-usplash-theme $(DESTDIR)/usr/sbin $(INSTALL_PROGRAM) libusplash.so.0 $(DESTDIR)/lib/libusplash.so.0 ln -sf /lib/libusplash.so.0 $(DESTDIR)/lib/libusplash.so