Denys Vlasenko wrote:
> On Tuesday 04 November 2008 16:03, Roy Marples wrote:
>> On Tuesday 04 November 2008 14:58:30 Roy Marples wrote:
>>> So, in an attempt yet again to get OpenRC to boot cleanly using busybox
>>> here's a patch that enables -C device for kbd_mode and setfont. The patch
>>> is done so extending similar support for other console tools is fairly
>>> trivial.
>
> setfont has it already:
So it has.
My bad for not checking svn.
> As for kbd_mode, googling for "man kbd_mode" shows that kbd_mode
> has no -C option. I am somewhat opposed to adding our own
> options. This OpenRC thing - does it really use "kbd_mode -C TTY"?
> What is their kbd_mode (what "kbd_mode --version"
> and "kbd_mode --help" say)?
Yes, it uses kbd_mode -C TTY
It's not in the man page, but it is in the sources.
It does not support any long options, but the package is kbd-1.14.1
> OTOH, logically, -C TTY makes sense for kbd_mode, loadkmap...
Well, I just care about kbd_mode :)
This new patch applies a similar fix for setfont to kbd_mode.
This deviates from the upstream variant of "find a console fd" when -C
is not given, but this works for all real world scenarios I can think of.
uberpc busybox-1.12.1 # ./scripts/bloat* ../*orig/busybox ./busybox
function old new delta
kbd_mode_main 245 275 +30
packed_usage 24130 24147 +17
static.KD_xxx 5 7 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 49/0) Total: 49
bytes
Thanks
Roy
Index: console-tools/kbd_mode.c
===================================================================
--- console-tools/kbd_mode.c (revision 23959)
+++ console-tools/kbd_mode.c (working copy)
@@ -22,17 +22,21 @@
SCANCODE = (1 << 0),
ASCII = (1 << 1),
MEDIUMRAW = (1 << 2),
- UNICODE = (1 << 3)
+ UNICODE = (1 << 3),
+ OPT_C = (1 << 4)
};
- static const char KD_xxx[] ALIGN1 = "saku";
- opt = getopt32(argv, KD_xxx);
- fd = get_console_fd_or_die();
+ const char *tty = CURRENT_TTY;
+ static const char KD_xxx[] ALIGN1 = "sakuC:";
+ opt = getopt32(argv, KD_xxx, &tty);
+ opt &= ~OPT_C;
+ fd = xopen(tty, opt ? O_WRONLY : O_RDONLY);
+
if (!opt) { /* print current setting */
const char *mode = "unknown";
int m;
- ioctl(fd, KDGKBMODE, &m);
+ xioctl(fd, KDGKBMODE, &m);
if (m == K_RAW)
mode = "raw (scancode)";
else if (m == K_XLATE)
Index: include/usage.h
===================================================================
--- include/usage.h (revision 23959)
+++ include/usage.h (working copy)
@@ -2019,14 +2019,15 @@
" [ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]" \
#define kbd_mode_trivial_usage \
- "[-a|k|s|u]"
+ "[-C device] [-a|k|s|u]"
#define kbd_mode_full_usage "\n\n" \
"Report or set the keyboard mode\n" \
"\nOptions set mode:" \
- "\n -a Default (ASCII)" \
- "\n -k Medium-raw (keyboard)" \
- "\n -s Raw (scancode)" \
- "\n -u Unicode (utf-8)" \
+ "\n -C device Device to use (default /dev/tty)" \
+ "\n -a Default (ASCII)" \
+ "\n -k Medium-raw (keyboard)" \
+ "\n -s Raw (scancode)" \
+ "\n -u Unicode (utf-8)" \
#define kill_trivial_usage \
"[-l] [-SIG] PID..."
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox