dumpkmap/loadkmap misses handling of K_ALLOCATED and K_NOSUCHMAP
Denys Vlasenko
vda.linux at googlemail.com
Thu Sep 19 15:55:09 UTC 2013
On Tue, Sep 17, 2013 at 3:09 AM, John Spencer
<maillist-busybox at barfooze.de> wrote:
> using this debug patch
>
> --- a/console-tools/loadkmap.c
> +++ b/console-tools/loadkmap.c
> @@ -67,7 +67,10 @@ int loadkmap_main(int argc UNUSED_PARAM, char **argv)
> ke.kb_index = j;
> ke.kb_table = i;
> ke.kb_value = ibuff[j];
> - ioctl(fd, KDSKBENT, &ke);
> + if(ioctl(fd, KDSKBENT, &ke))
> + dprintf(2, "warning: failed to set
> key slot %zu,%zu to %d, reason: %s\n",
> + i, j, ke.kb_value, strerror(errno));
> +
> }
> }
> }
>
>
> one can see that loadkmap does not handle the value K_ALLOCATED == 638
> correctly. when we dump and load the kmap multiple times, the number of
> errors increase.
>
> if we begin with
> loadkeys /share/keymaps/i386/qwertz/de_CH-latin1.map.gz (loadkeys from
> kbd-1.15.3)
> dumpkmap > test.kmap
> loadkmap < test.kmap
> warning: failed to set key slot 6,0 to 638, reason: Invalid argument
> dumpkmap > test.kmap
> loadkmap < test.kmap
> warning: failed to set key slot 6,0 to 638, reason: Invalid argument
> warning: failed to set key slot 9,0 to 638, reason: Invalid argument
> warning: failed to set key slot 10,0 to 638, reason: Invalid argument
>
> unfortunately both kernel source code and kbd source is undocumented when
> they deal with K_ALLOCATED and K_NOSUCHMAP, so i am uncertain on how to fix
> it.
Maybe just a comment will do?
/*
* Note: table[idx:0] can contain special value
* K_ALLOCATED (marks allocated tables in kernel).
* dumpkmap saves the value as-is; but attempts
* to load it here fail, since it isn't a valid
* key value: it is K(KT_SPEC,126) == 2<<8 + 126,
* whereas last valid KT_SPEC is
* K_BARENUMLOCK == K(KT_SPEC,19).
* So far we just ignore these errors:
*/
ioctl(fd, KDSKBENT, &ke);
More information about the busybox
mailing list