This repository has been archived by the owner on Oct 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://svn.o-hand.com/repos/misc/trunk/psplash@125 f5eea0f0-44ea-0310-b729-df5b855dafe5
- Loading branch information
mallum
committed
Sep 6, 2006
0 parents
commit d3e79e8
Showing
16 changed files
with
1,603 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
bin_PROGRAMS=psplash psplash-write | ||
|
||
AM_CFLAGS = $(GCC_FLAGS) -D_GNU_SOURCE | ||
|
||
psplash_SOURCES = psplash.c psplash.h psplash-fb.c psplash-fb.h \ | ||
psplash-console.c psplash-console.h psplash-image.h | ||
|
||
psplash_write_SOURCES = psplash-write.c psplash.h | ||
|
||
EXTRA_DIST = make-image-header.sh | ||
|
||
MAINTAINERCLEANFILES = aclocal.m4 compile config.guess config.sub configure depcomp install-sh ltmain.sh Makefile.in missing | ||
|
||
snapshot: | ||
$(MAKE) dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"` | ||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/sh | ||
autoreconf -v --install || exit 1 | ||
./configure --enable-maintainer-mode "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
AC_PREREQ(2.53) | ||
AC_INIT(psplash, 0.0, [http://bugzilla.o-hand.com/enter_bug.cgi?product=psplash]) | ||
AM_INIT_AUTOMAKE() | ||
AC_CONFIG_SRCDIR(psplash.c) | ||
AM_CONFIG_HEADER(config.h) | ||
AM_MAINTAINER_MODE | ||
|
||
AC_ISC_POSIX | ||
AC_PROG_CC | ||
AC_STDC_HEADERS | ||
|
||
if test "x$GCC" = "xyes"; then | ||
GCC_FLAGS="-g -Wall" | ||
fi | ||
|
||
AC_SUBST(GCC_FLAGS) | ||
|
||
AC_OUTPUT([ | ||
Makefile | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
imageh=psplash-image.h | ||
gdk-pixbuf-csource --macros $1 > $imageh.tmp | ||
sed -e 's/MY_PIXBUF/IMG/g' -e "s/guint8/uint8/g" $imageh.tmp > $imageh && rm $imageh.tmp | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
/* | ||
* pslash - a lightweight framebuffer splashscreen for embedded devices. | ||
* | ||
* Copyright (c) 2006 Matthew Allum <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
*/ | ||
|
||
#include "psplash.h" | ||
|
||
/* Globals, needed for signal handling */ | ||
static int ConsoleFd = -1; | ||
static int VTNum = -1; | ||
static int VTNumInitial = -1; | ||
static int Visible = 1; | ||
|
||
static void | ||
vt_request (int sig) | ||
{ | ||
DBG("mark, visible:%i", Visible); | ||
|
||
if (Visible) | ||
{ | ||
/* Allow Switch Away */ | ||
if (ioctl (ConsoleFd, VT_RELDISP, 1) < 0) | ||
perror("Error cannot switch away from console"); | ||
Visible = 0; | ||
|
||
/* FIXME: | ||
* We likely now want to signal the main loop as to exit | ||
* and we've now likely switched to the X tty. Note, this | ||
* seems to happen anyway atm due to select() call getting | ||
* a signal interuption error - not sure if this is really | ||
* reliable however. | ||
*/ | ||
} | ||
else | ||
{ | ||
if (ioctl (ConsoleFd, VT_RELDISP, VT_ACKACQ)) | ||
perror ("Error can't acknowledge VT switch"); | ||
Visible = 1; | ||
/* FIXME: need to schedule repaint some how ? */ | ||
} | ||
} | ||
|
||
static void | ||
psplash_console_ignore_switches (void) | ||
{ | ||
struct sigaction act; | ||
struct vt_mode vt_mode; | ||
|
||
if (ioctl(ConsoleFd, VT_GETMODE, &vt_mode) < 0) | ||
{ | ||
perror("Error VT_SETMODE failed"); | ||
return; | ||
} | ||
|
||
act.sa_handler = SIG_IGN; | ||
sigemptyset (&act.sa_mask); | ||
act.sa_flags = 0; | ||
sigaction (SIGUSR1, &act, 0); | ||
|
||
vt_mode.mode = VT_AUTO; | ||
vt_mode.relsig = 0; | ||
vt_mode.acqsig = 0; | ||
|
||
if (ioctl(ConsoleFd, VT_SETMODE, &vt_mode) < 0) | ||
perror("Error VT_SETMODE failed"); | ||
} | ||
|
||
static void | ||
psplash_console_handle_switches (void) | ||
{ | ||
struct sigaction act; | ||
struct vt_mode vt_mode; | ||
|
||
if (ioctl(ConsoleFd, VT_GETMODE, &vt_mode) < 0) | ||
{ | ||
perror("Error VT_SETMODE failed"); | ||
return; | ||
} | ||
|
||
act.sa_handler = vt_request; | ||
sigemptyset (&act.sa_mask); | ||
act.sa_flags = 0; | ||
sigaction (SIGUSR1, &act, 0); | ||
|
||
vt_mode.mode = VT_PROCESS; | ||
vt_mode.relsig = SIGUSR1; | ||
vt_mode.acqsig = SIGUSR1; | ||
|
||
if (ioctl(ConsoleFd, VT_SETMODE, &vt_mode) < 0) | ||
perror("Error VT_SETMODE failed"); | ||
} | ||
|
||
void | ||
psplash_console_switch (void) | ||
{ | ||
char vtname[10]; | ||
int fd; | ||
struct vt_stat vt_state; | ||
|
||
if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0) | ||
{ | ||
perror("Error Cannot open /dev/tty0"); | ||
return; | ||
} | ||
|
||
/* Find next free terminal */ | ||
if ((ioctl(fd, VT_OPENQRY, &VTNum) < 0)) | ||
{ | ||
perror("Error unable to find a free virtual terminal"); | ||
close(fd); | ||
return; | ||
} | ||
|
||
close(fd); | ||
|
||
sprintf(vtname,"/dev/tty%d", VTNum); | ||
|
||
if ((ConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0) | ||
{ | ||
fprintf(stderr, "Error cannot open %s: %s\n", vtname, strerror(errno)); | ||
return; | ||
} | ||
|
||
if (ioctl(ConsoleFd, VT_GETSTATE, &vt_state) == 0) | ||
VTNumInitial = vt_state.v_active; | ||
|
||
/* Switch to new free terminal */ | ||
|
||
psplash_console_ignore_switches (); | ||
|
||
if (ioctl(ConsoleFd, VT_ACTIVATE, VTNum) != 0) | ||
perror("Error VT_ACTIVATE failed"); | ||
|
||
if (ioctl(ConsoleFd, VT_WAITACTIVE, VTNum) != 0) | ||
perror("Error VT_WAITACTIVE failed\n"); | ||
|
||
psplash_console_handle_switches (); | ||
|
||
if (ioctl(ConsoleFd, KDSETMODE, KD_GRAPHICS) < 0) | ||
perror("Error KDSETMODE KD_GRAPHICS failed\n"); | ||
|
||
return; | ||
} | ||
|
||
void | ||
psplash_console_reset (void) | ||
{ | ||
int fd; | ||
struct vt_stat vt_state; | ||
|
||
if (ConsoleFd < 0) | ||
return; | ||
|
||
/* Back to text mode */ | ||
ioctl(ConsoleFd, KDSETMODE, KD_TEXT); | ||
|
||
psplash_console_ignore_switches (); | ||
|
||
/* Attempt to switch back to initial console if were still active */ | ||
ioctl (ConsoleFd, VT_GETSTATE, &vt_state); | ||
|
||
if (VTNum == vt_state.v_active) | ||
{ | ||
if (VTNumInitial > -1) | ||
{ | ||
ioctl (ConsoleFd, VT_ACTIVATE, VTNumInitial); | ||
ioctl (ConsoleFd, VT_WAITACTIVE, VTNumInitial); | ||
VTNumInitial = -1; | ||
} | ||
} | ||
|
||
/* Cleanup */ | ||
|
||
close(ConsoleFd); | ||
|
||
if ((fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0)) >= 0) | ||
{ | ||
ioctl (fd, VT_DISALLOCATE, VTNum); | ||
close (fd); | ||
} | ||
|
||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* pslash - a lightweight framebuffer splashscreen for embedded devices. | ||
* | ||
* Copyright (c) 2006 Matthew Allum <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
*/ | ||
|
||
#ifndef _HAVE_PSPLASH_CONSOLE_H | ||
#define _HAVE_PSPLASH_CONSOLE_H | ||
|
||
void | ||
psplash_console_switch (void); | ||
|
||
void | ||
psplash_console_reset (void); | ||
|
||
#endif |
Oops, something went wrong.