Package: libdirectfb-1.0-0
Version: 1.0.1-9
Severity: important
Tags: patch
splashy is now launched from the initramfs, i.e. before init.
Because init does horrible things when moving into multiuser mode
directfb loses it's connection to the keyboard.
This breaks splashy.
I attach a patch for directfb that is needed to fix bug 462626 (closed
by error) and probably bug 492643.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.25-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libdirectfb-1.0-0 depends on:
ii libc6 2.7-12 GNU C Library: Shared libraries
ii libsysfs2 2.1.0-4 interface library to sysfs
ii libts-0.0-0 1.0-4 touch screen library
libdirectfb-1.0-0 recommends no packages.
libdirectfb-1.0-0 suggests no packages.
-- no debconf information
--- directfb-1.0.1-orig/systems/fbdev/vt.h 2007-08-07 21:43:00.000000000 +0200
+++ directfb-1.0.1/systems/fbdev/vt.h 2008-04-02 23:14:48.000000000 +0200
@@ -34,7 +34,7 @@
#include <directfb.h>
-typedef struct {
+typedef struct VirtualTerminal {
int fd0; /* file descriptor of /dev/tty0 */
int fd; /* file descriptor of /dev/ttyN
where N is the number of the allocated VT,
@@ -56,6 +56,8 @@
pthread_cond_t wait;
int vt_sig;
+
+ DFBResult (*method_open) (struct VirtualTerminal *);
} VirtualTerminal;
/*
--- directfb-1.0.1-orig/systems/fbdev/vt.c 2007-08-07 21:43:00.000000000 +0200
+++ directfb-1.0.1/systems/fbdev/vt.c 2008-04-02 23:07:44.000000000 +0200
@@ -96,6 +96,8 @@
static void vt_set_fb( int vt, int fb );
static void *vt_thread( DirectThread *thread, void *arg );
+static DFBResult vt_open (VirtualTerminal *vt);
+
DFBResult
dfb_vt_initialize()
{
@@ -219,6 +221,8 @@
return ret;
}
+ dfb_vt->method_open = &vt_open;
+
dfb_fbdev->vt = dfb_vt;
return DFB_OK;
@@ -439,27 +443,23 @@
}
static DFBResult
-vt_init_switching()
-{
- const char cursoroff_str[] = "\033[?1;0;0c";
- const char blankoff_str[] = "\033[9;0]";
+vt_open (VirtualTerminal *vt) {
+
char buf[32];
D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
- /* FIXME: Opening the device should be moved out of this function. */
-
- snprintf(buf, 32, "/dev/tty%d", dfb_vt->num);
- dfb_vt->fd = open( buf, O_RDWR | O_NOCTTY );
- if (dfb_vt->fd < 0) {
+ snprintf(buf, 32, "/dev/tty%d", vt->num);
+ vt->fd = open( buf, O_RDWR | O_NOCTTY );
+ if (vt->fd < 0) {
if (errno == ENOENT) {
- snprintf(buf, 32, "/dev/vc/%d", dfb_vt->num);
- dfb_vt->fd = open( buf, O_RDWR | O_NOCTTY );
- if (dfb_vt->fd < 0) {
+ snprintf(buf, 32, "/dev/vc/%d", vt->num);
+ vt->fd = open( buf, O_RDWR | O_NOCTTY );
+ if (vt->fd < 0) {
if (errno == ENOENT) {
D_PERROR( "DirectFB/core/vt: Couldn't open "
"neither `/dev/tty%d' nor `/dev/vc/%d'!\n",
- dfb_vt->num, dfb_vt->num );
+ vt->num, vt->num );
}
else {
D_PERROR( "DirectFB/core/vt: "
@@ -477,7 +477,24 @@
/* attach to the new TTY before doing anything like KDSETMODE with it,
otherwise we'd get access denied error: */
- ioctl( dfb_vt->fd, TIOCSCTTY, 0 );
+ if (ioctl( vt->fd, TIOCSCTTY, 0 ) == -1) {
+ return errno2result (errno);
+ }
+
+ return DFB_OK;
+}
+
+
+static DFBResult
+vt_init_switching()
+{
+ const char cursoroff_str[] = "\033[?1;0;0c";
+ const char blankoff_str[] = "\033[9;0]";
+ DFBResult res;
+
+ D_DEBUG_AT( VT, "%s()\n", __FUNCTION__ );
+
+ if ((res = vt_open (dfb_vt)) != DFB_OK) return res;
write( dfb_vt->fd, cursoroff_str, sizeof(cursoroff_str) );
if (dfb_config->kd_graphics) {
--- directfb-1.0.1-orig/inputdrivers/keyboard/keyboard.c 2007-08-07 21:43:00.000000000 +0200
+++ directfb-1.0.1/inputdrivers/keyboard/keyboard.c 2008-04-03 00:32:49.000000000 +0200
@@ -287,6 +287,18 @@
ioctl( data->vt->fd, KDSKBLED, locks );
}
+static void
+keyboard_set_input (KeyboardData *data)
+{
+ struct termios ts;
+ ts = data->old_ts;
+ ts.c_cc[VTIME] = 0;
+ ts.c_cc[VMIN] = 1;
+ ts.c_lflag &= ~(ICANON|ECHO|ISIG);
+ ts.c_iflag = 0;
+ tcsetattr( data->vt->fd, TCSAFLUSH, &ts );
+}
+
static void*
keyboardEventThread( DirectThread *thread, void *driver_data )
{
@@ -300,6 +312,13 @@
direct_thread_testcancel( thread );
+ if (readlen == 0) {
+ /* Maybe our controlling terminal has been stolen by init */
+ close (data->vt->fd);
+ if (data->vt->method_open (data->vt) != DFB_OK) break;
+ keyboard_set_input (data);
+ }
+
for (i = 0; i < readlen; i++) {
DFBInputEvent evt;
@@ -351,7 +370,6 @@
InputDeviceInfo *info,
void **driver_data )
{
- struct termios ts;
KeyboardData *data;
FBDev *dfb_fbdev = dfb_system_data();
@@ -369,12 +387,7 @@
tcgetattr( data->vt->fd, &data->old_ts );
- ts = data->old_ts;
- ts.c_cc[VTIME] = 0;
- ts.c_cc[VMIN] = 1;
- ts.c_lflag &= ~(ICANON|ECHO|ISIG);
- ts.c_iflag = 0;
- tcsetattr( data->vt->fd, TCSAFLUSH, &ts );
+ keyboard_set_input (data);
tcsetpgrp( data->vt->fd, getpgrp() );