system/core
Revision | 6d2050820549ff6ec3ae8e5232b98db064f840b9 (tree) |
---|---|
Zeit | 2011-07-07 02:51:15 |
Autor | Kyle Evans <kevans@andr...> |
Commiter | Kyle Evans |
init: builtins: Update 'setkeycode'
Merge from gingerbread commit f815fcce7dfad2940d22846485478b8e18df4a3c.
Defer kc limit check to the kernel.
@@ -96,16 +96,6 @@ static int kbioctl(int cmd, void *data) | ||
96 | 96 | return ret; |
97 | 97 | } |
98 | 98 | |
99 | -static int setkey(struct kbentry *kbe) | |
100 | -{ | |
101 | - return kbioctl(KDSKBENT, kbe); | |
102 | -} | |
103 | - | |
104 | -static int setkeycode(struct kbkeycode *kbk) | |
105 | -{ | |
106 | - return kbioctl(KDSETKEYCODE, kbk); | |
107 | -} | |
108 | - | |
109 | 99 | static int __ifupdown(const char *interface, int up) |
110 | 100 | { |
111 | 101 | struct ifreq ifr; |
@@ -370,7 +360,7 @@ int do_setkey(int nargs, char **args) | ||
370 | 360 | kbe.kb_table = strtoul(args[1], 0, 0); |
371 | 361 | kbe.kb_index = strtoul(args[2], 0, 0); |
372 | 362 | kbe.kb_value = strtoul(args[3], 0, 0); |
373 | - return setkey(&kbe); | |
363 | + return kbioctl(KDSKBENT, &kbe); | |
374 | 364 | } |
375 | 365 | |
376 | 366 | int do_setkeycode(int nargs, char **args) |
@@ -378,18 +368,15 @@ int do_setkeycode(int nargs, char **args) | ||
378 | 368 | struct kbkeycode kbk; |
379 | 369 | unsigned int sc, kc; |
380 | 370 | sc = strtoul(args[1], 0, 0); |
381 | - if (sc > 127) { | |
371 | + if (sc >= 0xe000) { | |
382 | 372 | sc -= 0xe000; |
383 | 373 | sc += 128; |
384 | 374 | } |
385 | 375 | kc = strtoul(args[2], 0, 0); |
386 | - if (sc > 255 || kc > 127) { | |
387 | - ERROR("SCANCODE or KEYCODE out of range"); | |
388 | - return -1; | |
389 | - } | |
390 | 376 | kbk.scancode = sc; |
391 | 377 | kbk.keycode = kc; |
392 | - return setkeycode(&kbk); | |
378 | + /* sc, kc may be out of range, but we leave the testing to the kernel */ | |
379 | + return kbioctl(KDSETKEYCODE, &kbk); | |
393 | 380 | } |
394 | 381 | |
395 | 382 | int do_setprop(int nargs, char **args) |