On Sat, 12 Oct 2024 11:32:02 +0200, Miod Vallat <[email protected]> wrote: > > Does the following diff also fix the problem for you? > > Index: hidkbd.c > =================================================================== > RCS file: /OpenBSD/src/sys/dev/hid/hidkbd.c,v > retrieving revision 1.14 > diff -u -p -r1.14 hidkbd.c > --- hidkbd.c 1 Sep 2024 03:08:56 -0000 1.14 > +++ hidkbd.c 12 Oct 2024 09:31:15 -0000 > @@ -81,7 +81,7 @@ const u_int8_t hidkbd_trtab[256] = { > 0x1c, 0x01, 0x0e, 0x0f, 0x39, 0x0c, 0x0d, 0x1a, /* 28 - 2f */ > 0x1b, 0x2b, 0x2b, 0x27, 0x28, 0x29, 0x33, 0x34, /* 30 - 37 */ > 0x35, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, /* 38 - 3f */ > - 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xaa, 0x46, /* 40 - 47 */ > + 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xb7, 0x46, /* 40 - 47 */ > 0x7f, 0xd2, 0xc7, 0xc9, 0xd3, 0xcf, 0xd1, 0xcd, /* 48 - 4f */ > 0xcb, 0xd0, 0xc8, 0x45, 0xb5, 0x37, 0x4a, 0x4e, /* 50 - 57 */ > 0x9c, 0x4f, 0x50, 0x51, 0x4b, 0x4c, 0x4d, 0x47, /* 58 - 5f */
I had discovered that the same problem was fixed in NetBSD in 2009: https://github.com/NetBSD/src/commit/edeb84e77a4277c9cc1470db7c51460adee28854. So, I have included their changes in the diff below. This version fixes the Prtc button on my USB keyboard, and also fixes a bug with the mute button on the embedded keyboard. The bug: when I press it, it feels that it emmits more than one event (I never had dig into it), which leads to switching mute ON -> OFF -> ON in the loop, which was a bit irrotected. Index: sys/dev/hid/hidkbd.c =================================================================== RCS file: /cvs/src/sys/dev/hid/hidkbd.c,v retrieving revision 1.14 diff -u -p -r1.14 hidkbd.c --- sys/dev/hid/hidkbd.c 1 Sep 2024 03:08:56 -0000 1.14 +++ sys/dev/hid/hidkbd.c 12 Oct 2024 23:25:05 -0000 @@ -81,7 +81,7 @@ const u_int8_t hidkbd_trtab[256] = { 0x1c, 0x01, 0x0e, 0x0f, 0x39, 0x0c, 0x0d, 0x1a, /* 28 - 2f */ 0x1b, 0x2b, 0x2b, 0x27, 0x28, 0x29, 0x33, 0x34, /* 30 - 37 */ 0x35, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, /* 38 - 3f */ - 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xaa, 0x46, /* 40 - 47 */ + 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xb7, 0x46, /* 40 - 47 */ 0x7f, 0xd2, 0xc7, 0xc9, 0xd3, 0xcf, 0xd1, 0xcd, /* 48 - 4f */ 0xcb, 0xd0, 0xc8, 0x45, 0xb5, 0x37, 0x4a, 0x4e, /* 50 - 57 */ 0x9c, 0x4f, 0x50, 0x51, 0x4b, 0x4c, 0x4d, 0x47, /* 58 - 5f */ @@ -565,9 +565,17 @@ hidkbd_decode(struct hidkbd *kbd, struct c = hidkbd_trtab[key & CODEMASK]; if (c == NN) continue; - if (c & 0x80) - cbuf[j++] = 0xe0; - cbuf[j] = c & 0x7f; + if (c == 0x7f) { + /* pause key */ + cbuf[j++] = 0xe1; + cbuf[j++] = 0x1d; + cbuf[j-1] |= (key & RELEASE) ? 0x80 : 0; + cbuf[j] = 0x45; + } else { + if (c & 0x80) + cbuf[j++] = 0xe0; + cbuf[j] = c & 0x7f; + } if (key & RELEASE) cbuf[j] |= 0x80; DPRINTFN(1,("hidkbd_decode: raw = %s0x%02x\n", -- wbr, Kirill
