OBS User unknown 2008-05-07 21:13:32 +00:00 committed by Git OBS Bridge
parent 68248f1fd0
commit 6d3899a57c
6 changed files with 336 additions and 135 deletions

49
fbtest.8 Normal file
View File

@ -0,0 +1,49 @@
'\" -*- coding: UTF-8 -*-
.\"
.\" Copyright 2008 Werner Fink, 2008 SUSE LINUX Products GmbH, Germany.
.\"
.\" 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 of the License, or
.\" (at your option) any later version.
.\"
.TH FBTEST 8 "May 6, 2008" "0.42" "International Support"
.SH NAME
fbtest \- test if a virtual console is mapped to a frame buffer devive
.SH SYNOPSIS
.B fbtest
.RB [ \-f \ \fI<fb_device>\fR]
.RB [ \-C \ \fI<vc_device>\fR]
.br
.B fbtest
.B \-\-help
.SH DESCRIPTION
The program
.BR fbtest (8)
is used to test if a virtual console, e.g.
.I /dev/tty1
is mapped on a frame buffer device.
.SH OPTIONS
.TP
.BR \-f ,\ \-\-fb = \fI<fb_device>\fR
This option specifies an other frame buffer device than
the default
.IR /dev/fb0 .
.TP
.BR \-C ,\ \-\-vc = \fI<vc_device>\fR
This option specifies an other virtual console than the default
.IR /dev/tty1 .
.SH EXIT STATUS
.IP \fB0\fR 5
The virtual console is mapped onto a frame buffer device.
.IP \fB1\fR 5
The virtual console is
.B not
mapped onto a frame buffer device.
.PP
.SH FILES
.I /dev/fb0
.br
.I /dev/tty<1...63>
.SH SEE ALSO
.BR fbset (8).

111
fbtest.c Normal file
View File

@ -0,0 +1,111 @@
/*
* fbtest(.c)
*
* Copyright 2008 Werner Fink, 2008 SUSE LINUX Products GmbH, Germany.
*
* 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 of the License, or
* (at your option) any later version.
*
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <unistd.h>
#include <linux/fb.h>
static struct option options[] = {
{ "fb", required_argument, 0, 'f'},
{ "vc", required_argument, 0, 'C'},
{ "help", no_argument, 0, 'h'},
{ (const char*)0, 0, (int*)0, 0}
};
int main(int argc, char * argv[])
{
struct fb_con2fbmap map = {1, -1};
const char *base = basename(argv[0]);
const char * fb = (char*)0;
const char * vc = (char*)0;
struct stat st;
int c, fd;
opterr = 0;
while ((c = getopt_long(argc, argv, "hf:C:", options, (int *)0)) != -1) {
switch (c) {
case 'f':
fb = optarg;
break;
case 'C':
vc = optarg;
break;
case 'h':
fprintf(stderr, "%s: Usage:\n %s [-f <fb_device>] [-C <vc_device>]\n", base, base);
fprintf(stderr, "Valid options are:\n");
fprintf(stderr, " -f <fb_device> The frame buffer device (default /dev/fb0)\n");
fprintf(stderr, " -C <vc_device> The virtual console device (default /dev/tty1)\n");
return 0;
case '?':
fprintf(stdout, "%s: Invalid option for help use:\n %s --help\n", base, base);
return 1;
break;
default:
break;
}
}
if (fb == (char*)0) {
fb = "/dev/fb/0";
if (stat(fb, &st) < 0) {
if (errno != ENOENT && errno != ENOTDIR) {
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
fb = "/dev/fb0";
if (stat(fb, &st) < 0) {
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
}
}
if (vc == (char*)0)
vc = "/dev/tty1";
if (stat(vc, &st) < 0) {
fprintf(stderr, "%s: %s: %m\n", base, vc);
return 1;
}
if (major(st.st_rdev) != (dev_t)4) {
errno = ECANCELED;
fprintf(stderr, "%s: %s: %m\n", base, vc);
return 1;
}
if ((fd = open(fb, O_RDONLY|O_NOCTTY)) < 0) {
if (errno != ENODEV)
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
map.console = (typeof(map.console))minor(st.st_rdev);
map.framebuffer = (typeof(map.framebuffer))-1;
if (ioctl(fd, FBIOGET_CON2FBMAP, &map) < 0) {
fprintf(stderr, "%s: %s: %m\n", base, fb);
return 1;
}
return map.framebuffer > FB_MAX;
}

View File

@ -1,6 +1,37 @@
--- kbd-1.12/src/kdfontop.c.orig 2004-01-16 20:45:31.000000000 +0100
--- kbd-1.12/man/man8/showconsolefont.8
+++ kbd-1.12/man/man8/showconsolefont.8 2008-05-07 18:19:41.000000000 +0200
@@ -13,15 +13,25 @@ showconsolefont \- Show the current EGA/
.B \-C
.I console
]
+[
+.B \-i
+]
+
.SH DESCRIPTION
The
.B showconsolefont
command outputs the current console font to stdout.
-The option \-v prints additional information, while
-the option \-V prints the program version number.
-On Linux 2.6.1 and later, the option \-C allows one
+The option \fB\-v\fR prints additional information, while
+the option \fB\-V\fR prints the program version number.
+On Linux 2.6.1 and later, the option \fB\-C\fR allows one
to indicate the console involved. Its argument is a pathname.
+The option \fB\-i\fR cause
+.B showconsolefont
+not to show the font table but show the value of the
+used ROWS, COLUMNS, and character COUNT of the current
+font with the format
+.BR ROWS x COLUMNS x COUNT .
.SH "SEE ALSO"
.BR setfont (8)
--- kbd-1.12/src/kdfontop.c
+++ kbd-1.12/src/kdfontop.c 2006-07-26 18:14:55.000000000 +0200
@@ -142,8 +142,11 @@
@@ -142,8 +142,11 @@ font_charheight(char *buf, int count, in
return h;
}
@ -14,7 +45,7 @@
int
getfont(int fd, char *buf, int *count, int *width, int *height) {
struct consolefontdesc cfd;
@@ -193,6 +196,11 @@
@@ -193,6 +196,11 @@ getfont(int fd, char *buf, int *count, i
fprintf(stderr, _("bug: getfont called with count<256\n"));
return -1;
}
@ -26,7 +57,7 @@
i = ioctl(fd, GIO_FONT, buf);
if (i) {
perror("getfont: GIO_FONT");
@@ -208,11 +216,11 @@
@@ -206,11 +214,11 @@ getfont(int fd, char *buf, int *count, i
int
getfontsize(int fd) {
@ -41,9 +72,9 @@
return (i == 0) ? count : 256;
}
--- kbd-1.12/src/showconsolefont.c.orig 2004-01-16 20:45:31.000000000 +0100
+++ kbd-1.12/src/showconsolefont.c 2006-07-26 18:40:31.000000000 +0200
@@ -101,8 +101,15 @@
--- kbd-1.12/src/showconsolefont.c
+++ kbd-1.12/src/showconsolefont.c 2008-05-07 18:27:36.130879445 +0200
@@ -101,8 +101,15 @@ setnewunicodemap(int *list, int cnt) {
static void
usage(void) {
fprintf(stderr,
@ -61,7 +92,7 @@
exit(1);
}
@@ -110,7 +117,7 @@
@@ -110,7 +117,7 @@ int
main (int argc, char **argv) {
int c, n, cols, rows, nr, i, j, k;
char *sep, *console = NULL;
@ -70,7 +101,7 @@
set_progname(argv[0]);
@@ -122,8 +129,11 @@
@@ -122,8 +129,11 @@ main (int argc, char **argv) {
(!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")))
print_version_and_exit();
@ -83,7 +114,7 @@
case 'v':
verbose = 1;
break;
@@ -135,9 +145,26 @@
@@ -135,11 +145,28 @@ main (int argc, char **argv) {
}
}
@ -91,6 +122,8 @@
+ if (optind != argc)
usage();
fd = getfd(console);
+ if (info)
+ {
+ nr = rows = cols = 0;
@ -108,6 +141,6 @@
+ leave(0);
+ }
+
fd = getfd(console);
settrivialscreenmap();
getoldunicodemap();

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed May 7 18:34:11 CEST 2008 - werner@suse.de
- Add description of option -i of showconsolefont (bnc#385200)
- Make showconsolefont option -i work together with option -C
- Add fbtest program and fbtest manual page
-------------------------------------------------------------------
Mon May 5 17:21:42 CEST 2008 - jw@suse.de

View File

@ -43,7 +43,7 @@ LOCALE_CHARMAP=`locale charmap`
LC_ALL=POSIX
MACHINE=`/bin/uname -m 2> /dev/null`
if [ "$MACHINE" = "sparc" -o "$MACHINE" = "sparc64" ]; then
if test "$MACHINE" = "sparc" -o "$MACHINE" = "sparc64" ; then
# Test if we have a serial console.
(test -c /dev/tty1 && > /dev/tty1 ) > /dev/null 2>&1 || exit 0
fi
@ -65,7 +65,7 @@ KTABLE=${KTABLE##*/}
#
# first search the wanted keytable.
#
if [ $MACHINE = ppc -o $MACHINE = ppc64 ]; then
if test $MACHINE = ppc -o $MACHINE = ppc64 ; then
test -f /proc/cpuinfo || mount -n -t proc proc /proc 2>/dev/null
while read line; do
case "$line" in
@ -232,6 +232,20 @@ function set_kbdrate ()
setleds -D $LEDOPT < $tty
done
}
function console_font_height ()
{
if test -x /sbin/fbtest && /sbin/fbtest -C $1 ; then
echo 16
else
set -- $(IFS=x /bin/showconsolefont -i -C $1 2> /dev/null)
if test -n "$2" ; then
echo $2
else
echo 8
fi
fi
}
#
rc_reset
case "$1" in
@ -379,30 +393,6 @@ case "$1" in
# do not mess up console
unset CONSOLE_FONT
fi
## bnc#164378
if test "$CONSOLE_FONT" = "default"; then
if test -z "$CONSOLE_FONT_HEIGHT" -o "$CONSOLE_FONT_HEIGHT" = "auto" ; then
if test -x /sbin/fbset && /sbin/fbset -s > /dev/null 2>&1 ; then
CONSOLE_FONT_HEIGHT=16
else
for tty in $KBD_TTY; do
# Showconsolefont tries to open a device
test "${tty##*/}" = "${tty}" && tty=/dev/$tty
vidmode=$(/bin/showconsolefont -i < $tty 2> /dev/null)
break
done
if test -z "$vidmode" ; then
CONSOLE_FONT_HEIGHT=8
else
vidmode=${vidmode#*x}
vidmode=${vidmode%x*}
CONSOLE_FONT_HEIGHT=$vidmode
fi
unset vidmode
fi
fi
fi
# setfont
if test -d ${KBDBASE}/consolefonts -a \
-n "$CONSOLE_FONT" -a "$CONSOLE_FONT" != "YAST_ASK"
@ -430,7 +420,7 @@ case "$1" in
else
CONSOLE_MAGIC="";
fi
if test -x /bin/setfont ; then
if test -x /bin/setfont -a -n "$CONSOLE_FONT" ; then
echo "Loading console font $CONSOLE_FONT $UMAP $SMAP $PRINTABLE_MAGIC"
for tty in $KBD_TTY; do
# The chvt is not needed for SuSE kernels
@ -440,7 +430,7 @@ case "$1" in
test "${tty##*/}" = "${tty}" && tty=/dev/$tty
if test "$CONSOLE_FONT" = "default" ; then
/bin/setfont -C $tty -$CONSOLE_FONT_HEIGHT $UMAP $SMAP
/bin/setfont -C $tty -$(console_font_height $tty) $UMAP $SMAP
else
/bin/setfont -C $tty $CONSOLE_FONT $UMAP $SMAP
fi

View File

@ -17,7 +17,7 @@ License: GPL v2 or later
Group: System/Console
AutoReqProv: on
Version: 1.12
Release: 176
Release: 178
Summary: Keyboard and Font Utilities
Source: ftp://ftp.win.tue.nl/pub/home/aeb/linux-local/utils/kbd/%{name}-%{version}.tar.bz2
Source1: kbd_fonts.tar.bz2
@ -29,6 +29,8 @@ Source6: kbd.fillup.nonpc
Source8: sysconfig.console
Source9: sysconfig.keyboard
Source10: testutf8.c
Source11: fbtest.c
Source12: fbtest.8
Source42: convert-kbd-mac.sed
Source43: repack_kbd.sh
Patch: kbd-%{version}.diff
@ -125,6 +127,7 @@ done
./configure --prefix=/ --datadir=%{kbd} --mandir=%{_mandir}
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Os"
gcc $RPM_OPT_FLAGS -o testutf8 $RPM_SOURCE_DIR/testutf8.c
gcc $RPM_OPT_FLAGS -o fbtest $RPM_SOURCE_DIR/fbtest.c
%install
mkdir -p $RPM_BUILD_ROOT/bin
@ -237,7 +240,9 @@ cat %SOURCE6 >> $FILLUP_DIR/sysconfig.keyboard
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/getkeycodes.8*
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/setkeycodes.8*
%endif
install -m 755 ./testutf8 $RPM_BUILD_ROOT/bin/
install -m 755 testutf8 $RPM_BUILD_ROOT/bin/
install -m 755 fbtest $RPM_BUILD_ROOT/sbin/
install -m 644 %SOURCE12 $RPM_BUILD_ROOT/%{_mandir}/man8/
%find_lang %{name}
%post
@ -261,6 +266,7 @@ install -m 755 ./testutf8 $RPM_BUILD_ROOT/bin/
%dir %{kbd}
%{kbd}
/sbin/rckbd
/sbin/fbtest
/bin/chvt
/bin/openvt
/bin/deallocvt
@ -318,6 +324,7 @@ install -m 755 ./testutf8 $RPM_BUILD_ROOT/bin/
%doc %{_mandir}/man8/resizecons.8.gz
%endif
%doc %{_mandir}/man8/setfont.8.gz
%doc %{_mandir}/man8/fbtest.8.gz
%doc %{_mandir}/man1/openvt.1.gz
%doc %{_mandir}/man1/unicode_start.1.gz
%doc %{_mandir}/man1/unicode_stop.1.gz
@ -327,6 +334,10 @@ rm -rf $RPM_BUILD_ROOT
#rm -rf $RPM_BUILD_DIR/kbd-%{version}
%changelog
* Wed May 07 2008 werner@suse.de
- Add description of option -i of showconsolefont (bnc#385200)
- Make showconsolefont option -i work together with option -C
- Add fbtest program and fbtest manual page
* Mon May 05 2008 jw@suse.de
- added fix for bnc#164378 from werner.
* Fri Apr 25 2008 jw@suse.de