Last change
on this file since 3817 was 3320, checked in by Bruno Cornec, 10 years ago |
- Re-add (thanks git BTW) the 2.2.9 branch which had been destroyed in
the move to 3.0
|
-
Property svn:eol-style
set to
native
|
File size:
1010 bytes
|
Rev | Line | |
---|
[3320] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * setkeycodes
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 1994-1998 Andries E. Brouwer <aeb@cwi.nl>
|
---|
| 6 | *
|
---|
| 7 | * Adjusted for BusyBox by Erik Andersen <andersen@codepoet.org>
|
---|
| 8 | *
|
---|
| 9 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
| 10 | */
|
---|
| 11 | #include "libbb.h"
|
---|
| 12 |
|
---|
| 13 | /* From <linux/kd.h> */
|
---|
| 14 | struct kbkeycode {
|
---|
| 15 | unsigned scancode, keycode;
|
---|
| 16 | };
|
---|
| 17 | enum {
|
---|
| 18 | KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
|
---|
| 19 | };
|
---|
| 20 |
|
---|
| 21 | int setkeycodes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
---|
| 22 | int setkeycodes_main(int argc, char **argv)
|
---|
| 23 | {
|
---|
| 24 | int fd;
|
---|
| 25 | struct kbkeycode a;
|
---|
| 26 |
|
---|
| 27 | if (!(argc & 1) /* if even */ || argc < 2) {
|
---|
| 28 | bb_show_usage();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | fd = get_console_fd_or_die();
|
---|
| 32 |
|
---|
| 33 | while (argv[1]) {
|
---|
| 34 | int sc = xstrtoul_range(argv[1], 16, 0, 0xe07f);
|
---|
| 35 | if (sc >= 0xe000) {
|
---|
| 36 | sc -= 0xe000;
|
---|
| 37 | sc += 0x0080;
|
---|
| 38 | }
|
---|
| 39 | a.scancode = sc;
|
---|
| 40 | a.keycode = xatou_range(argv[2], 0, 255);
|
---|
| 41 | ioctl_or_perror_and_die(fd, KDSETKEYCODE, &a,
|
---|
| 42 | "can't set SCANCODE %x to KEYCODE %d",
|
---|
| 43 | sc, a.keycode);
|
---|
| 44 | argv += 2;
|
---|
| 45 | }
|
---|
| 46 | return EXIT_SUCCESS;
|
---|
| 47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.