Package: input-utils
Version: 0.0.20050727-2

Hi,

I'm experimenting with some custom keymaps using the input utilities downloaded from:
http://dl.bytesex.org/cvs-snapshots/input-20051128-143821.tar.gz
(but this also applies to the debian 20050727 version)

Everything works great except that there seems to be an off-by-one error which prevents me from setting the last key in the codeset.

The error can be seen in the output as well:

drevil:~/input2/input# ./input-kbd 0
/dev/input/event0
  bustype : BUS_I2C
  vendor  : 0x0
  product : 0x0
  version : 0
  name    : "i2c IR (Hauppauge)"
  phys    : "i2c-0/0-0018/ir0"
  bits ev : EV_SYN EV_KEY

map: 128 keys, size: 127/128
0x0000 =  11  # KEY_0
...
0x007e = 126  # KEY_RIGHTMETA

The size param there looks wonky and I'm not able to set the key for 0x007f

Looking at input-kbd.c, line 34:

       for (map->size = 0; map->size < 65536; map->size++) {
               entry.scancode = map->size;
               entry.keycode  = KEY_RESERVED;
               rc = ioctl(fd, EVIOCGKEYCODE, &entry);
               if (rc < 0) {
                       map->size--;
                       break;
               }
               if (map->size >= map->alloc) {

the "map->size--" line looks incorrect since scancodes from, and including, zero have been tested, it seems that it should not be decreased.

So I removed that line and recompiled....lo and behold:

drevil:~/input2/input# ./input-kbd 0
/dev/input/event0
  bustype : BUS_I2C
  vendor  : 0x0
  product : 0x0
  version : 0
  name    : "i2c IR (Hauppauge)"
  phys    : "i2c-0/0-0018/ir0"
  bits ev : EV_SYN EV_KEY

map: 128 keys, size: 128/128
0x0000 =  11  # KEY_0
...
0x007e = 126  # KEY_RIGHTMETA
0x007f = 127  # KEY_COMPOSE


--
David Härdeman

Reply via email to