Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/console-tools/setkeycodes.c

    r1765 r2725  
    77 * Adjusted for BusyBox by Erik Andersen <andersen@codepoet.org>
    88 *
    9  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    1010 */
    11 
    12 //#include <sys/ioctl.h>
    1311#include "libbb.h"
    1412
    1513/* From <linux/kd.h> */
    1614struct kbkeycode {
    17     unsigned int scancode, keycode;
     15    unsigned scancode, keycode;
    1816};
    1917enum {
     
    2119};
    2220
    23 int setkeycodes_main(int argc, char** argv);
    24 int setkeycodes_main(int argc, char** argv)
     21int setkeycodes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     22int setkeycodes_main(int argc, char **argv)
    2523{
    26     int fd, sc;
     24    int fd;
    2725    struct kbkeycode a;
    2826
    29     if (argc % 2 != 1 || argc < 2) {
     27    if (!(argc & 1) /* if even */ || argc < 2) {
    3028        bb_show_usage();
    3129    }
    3230
    33     fd = get_console_fd();
     31    fd = get_console_fd_or_die();
    3432
    35     while (argc > 2) {
    36         a.keycode = xatoul_range(argv[2], 0, 127);
    37         a.scancode = sc = xstrtoul_range(argv[1], 16, 0, 255);
    38         if (a.scancode > 127) {
    39             a.scancode -= 0xe000;
    40             a.scancode += 128;
     33    while (argv[1]) {
     34        int sc = xstrtoul_range(argv[1], 16, 0, 0xe07f);
     35        if (sc >= 0xe000) {
     36            sc -= 0xe000;
     37            sc += 0x0080;
    4138        }
     39        a.scancode = sc;
     40        a.keycode = xatou_range(argv[2], 0, 255);
    4241        ioctl_or_perror_and_die(fd, KDSETKEYCODE, &a,
    43             "failed to set SCANCODE %x to KEYCODE %d",
     42            "can't set SCANCODE %x to KEYCODE %d",
    4443            sc, a.keycode);
    45         argc -= 2;
    4644        argv += 2;
    4745    }
Note: See TracChangeset for help on using the changeset viewer.