diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-20 18:14:13 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-20 18:14:13 +0000 |
commit | eef6077d7efe7c1b76f88f406379a47cee24729c (patch) | |
tree | 1b1d607b204e4ff7d50eb3f7dead753834b3d8a2 /console-tools/loadfont.c | |
parent | b8d1a4cd5f686ee95f6cf13634cba1f96e382f26 (diff) | |
download | busybox-w32-eef6077d7efe7c1b76f88f406379a47cee24729c.tar.gz busybox-w32-eef6077d7efe7c1b76f88f406379a47cee24729c.tar.bz2 busybox-w32-eef6077d7efe7c1b76f88f406379a47cee24729c.zip |
setfont: use ioctl(KDFONTOP), it honours -C tty
Diffstat (limited to 'console-tools/loadfont.c')
-rw-r--r-- | console-tools/loadfont.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 4eb88e93d..8caeb3c4c 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
@@ -10,6 +10,28 @@ | |||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | #include <sys/kd.h> | 11 | #include <sys/kd.h> |
12 | 12 | ||
13 | #ifndef KDFONTOP | ||
14 | #define KDFONTOP 0x4B72 | ||
15 | struct console_font_op { | ||
16 | unsigned op; /* KD_FONT_OP_* */ | ||
17 | unsigned flags; /* KD_FONT_FLAG_* */ | ||
18 | unsigned width, height; | ||
19 | unsigned charcount; | ||
20 | unsigned char *data; /* font data with height fixed to 32 */ | ||
21 | }; | ||
22 | |||
23 | #define KD_FONT_OP_SET 0 /* Set font */ | ||
24 | #define KD_FONT_OP_GET 1 /* Get font */ | ||
25 | #define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, | ||
26 | data points to name / NULL */ | ||
27 | #define KD_FONT_OP_COPY 3 /* Copy from another console */ | ||
28 | |||
29 | #define KD_FONT_FLAG_OLD 0x80000000 /* Invoked via old interface */ | ||
30 | #define KD_FONT_FLAG_DONT_RECALC 1 /* Don't call adjust_height() */ | ||
31 | /* (Used internally for PIO_FONT support) */ | ||
32 | #endif /* KDFONTOP */ | ||
33 | |||
34 | |||
13 | enum { | 35 | enum { |
14 | PSF_MAGIC1 = 0x36, | 36 | PSF_MAGIC1 = 0x36, |
15 | PSF_MAGIC2 = 0x04, | 37 | PSF_MAGIC2 = 0x04, |
@@ -40,6 +62,25 @@ static void do_loadfont(int fd, unsigned char *inbuf, int unit, int fontsize) | |||
40 | for (i = 0; i < fontsize; i++) | 62 | for (i = 0; i < fontsize; i++) |
41 | memcpy(buf + (32 * i), inbuf + (unit * i), unit); | 63 | memcpy(buf + (32 * i), inbuf + (unit * i), unit); |
42 | 64 | ||
65 | { /* KDFONTOP */ | ||
66 | struct console_font_op cfo; | ||
67 | |||
68 | cfo.op = KD_FONT_OP_SET; | ||
69 | cfo.flags = 0; | ||
70 | cfo.width = 8; | ||
71 | cfo.height = unit; | ||
72 | cfo.charcount = fontsize; | ||
73 | cfo.data = (void*)buf; | ||
74 | #if 0 | ||
75 | if (!ioctl_or_perror(fd, KDFONTOP, &cfo, "KDFONTOP ioctl failed (will try PIO_FONTX)")) | ||
76 | goto ret; /* success */ | ||
77 | #else | ||
78 | xioctl(fd, KDFONTOP, &cfo); | ||
79 | #endif | ||
80 | } | ||
81 | |||
82 | #if 0 | ||
83 | /* These ones do not honour -C tty (they set font on current tty regardless) */ | ||
43 | #if defined(PIO_FONTX) && !defined(__sparc__) | 84 | #if defined(PIO_FONTX) && !defined(__sparc__) |
44 | { | 85 | { |
45 | struct consolefontdesc cfd; | 86 | struct consolefontdesc cfd; |
@@ -49,11 +90,12 @@ static void do_loadfont(int fd, unsigned char *inbuf, int unit, int fontsize) | |||
49 | cfd.chardata = buf; | 90 | cfd.chardata = buf; |
50 | 91 | ||
51 | if (!ioctl_or_perror(fd, PIO_FONTX, &cfd, "PIO_FONTX ioctl failed (will try PIO_FONT)")) | 92 | if (!ioctl_or_perror(fd, PIO_FONTX, &cfd, "PIO_FONTX ioctl failed (will try PIO_FONT)")) |
52 | goto ret; /* success */ | 93 | goto ret; /* success */ |
53 | } | 94 | } |
54 | #endif | 95 | #endif |
55 | xioctl(fd, PIO_FONT, buf); | 96 | xioctl(fd, PIO_FONT, buf); |
56 | ret: | 97 | ret: |
98 | #endif /* 0 */ | ||
57 | free(buf); | 99 | free(buf); |
58 | } | 100 | } |
59 | 101 | ||