diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-19 17:15:54 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-19 17:15:54 +0200 |
commit | 2e068e725ce693afe5e89e10feaa9f24bef5f789 (patch) | |
tree | 5266908451c76ca64b896c1956bdc9f5deee57d8 | |
parent | dc1fd2e52aa7d24fd609399e94b78c8c4dd79229 (diff) | |
download | busybox-w32-2e068e725ce693afe5e89e10feaa9f24bef5f789.tar.gz busybox-w32-2e068e725ce693afe5e89e10feaa9f24bef5f789.tar.bz2 busybox-w32-2e068e725ce693afe5e89e10feaa9f24bef5f789.zip |
setkeycodes: fix handling of 0exx scancodes
function old new delta
setkeycodes_main 143 130 -13
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | console-tools/setkeycodes.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index b7851016a..b6a9a32af 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c | |||
@@ -21,7 +21,7 @@ enum { | |||
21 | int setkeycodes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 21 | int setkeycodes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
22 | int setkeycodes_main(int argc, char **argv) | 22 | int setkeycodes_main(int argc, char **argv) |
23 | { | 23 | { |
24 | int fd, sc; | 24 | int fd; |
25 | struct kbkeycode a; | 25 | struct kbkeycode a; |
26 | 26 | ||
27 | if (!(argc & 1) /* if even */ || argc < 2) { | 27 | if (!(argc & 1) /* if even */ || argc < 2) { |
@@ -30,17 +30,17 @@ int setkeycodes_main(int argc, char **argv) | |||
30 | 30 | ||
31 | fd = get_console_fd_or_die(); | 31 | fd = get_console_fd_or_die(); |
32 | 32 | ||
33 | while (argc > 2) { | 33 | while (argv[1]) { |
34 | a.keycode = xatou_range(argv[2], 0, 127); | 34 | int sc = xstrtoul_range(argv[1], 16, 0, 0xe07f); |
35 | a.scancode = sc = xstrtoul_range(argv[1], 16, 0, 255); | 35 | if (sc >= 0xe000) { |
36 | if (a.scancode > 127) { | 36 | sc -= 0xe000; |
37 | a.scancode -= 0xe000; | 37 | sc += 0x0080; |
38 | a.scancode += 128; | ||
39 | } | 38 | } |
39 | a.scancode = sc; | ||
40 | a.keycode = xatou_range(argv[2], 0, 255); | ||
40 | ioctl_or_perror_and_die(fd, KDSETKEYCODE, &a, | 41 | ioctl_or_perror_and_die(fd, KDSETKEYCODE, &a, |
41 | "can't set SCANCODE %x to KEYCODE %d", | 42 | "can't set SCANCODE %x to KEYCODE %d", |
42 | sc, a.keycode); | 43 | sc, a.keycode); |
43 | argc -= 2; | ||
44 | argv += 2; | 44 | argv += 2; |
45 | } | 45 | } |
46 | return EXIT_SUCCESS; | 46 | return EXIT_SUCCESS; |