On Thu, May 03, 2018 at 05:23:18PM +0000, Miod Vallat wrote:
> sys/dev/pckbc/pckbd.c introduces a buglet, where the value computed for
> local variable `table' in pckbd_set_xtscancode() in the non-translating
> case, is overwritten by accident.
>
> Unfortunately, this means that the keyboard ends up using a scancode set
> which is not the one expected by the driver, and hilarity ensues, such
> as key up events not translated correctly, and neither ctrl or caps
> lock.
>
> Unfortunately this breaks at least gsckbc(4/hppa), which is a controller
> where you can't plug a DIN keyboard so a "modern" PS/2 keyboard is
> required, and that logic can be shunt.
>
> This is very inconvenient, as most of the hppa machines where the X
> server works are gsckbc machines, and 6.3 can't be installed on them
> because of this bug (but then, noone seems to have noticed, so this is
> hardly relevant).
>
> Simple fix below.
A report this fixes the problme indeed came by on misc@
Imo this should be committed.
-Otto
>
> Index: pckbd.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/dev/pckbc/pckbd.c,v
> retrieving revision 1.44
> diff -u -p -r1.44 pckbd.c
> --- pckbd.c 6 Jan 2018 18:51:20 -0000 1.44
> +++ pckbd.c 2 May 2018 18:58:28 -0000
> @@ -214,7 +214,7 @@ int
> pckbd_set_xtscancode(pckbc_tag_t kbctag, pckbc_slot_t kbcslot,
> struct pckbd_internal *id)
> {
> - int table;
> + int table = 3;
>
> if (pckbc_xt_translation(kbctag)) {
> #ifdef DEBUG
> @@ -247,7 +247,7 @@ pckbd_set_xtscancode(pckbc_tag_t kbctag,
> }
>
> /* keep falling back until we hit a table that looks usable. */
> - for (table = 3; table >= 1; table--) {
> + for (; table >= 1; table--) {
> u_char cmd[2];
> #ifdef DEBUG
> printf("pckbd: trying table %d\n", table);