CC'ed back the mailing list. Tested your patch. It works on my Chromebook. Le sam. 12 août 2023, 08:50, Miod Vallat <m...@online.fr> a écrit :
> > > Have you checked that the Chromebook EC 8042 emulation returns > 0xab/0x83 > > > to the 0xf2 command? > > > > > I've checked that it returns 0xab/0x83. > > Good! > > > I attach the updated patch here > > Can you give this other diff a try and report whether it works on your > Chromebook? > > Index: sys/dev/pckbc/pckbd.c > =================================================================== > RCS file: /OpenBSD/src/sys/dev/pckbc/pckbd.c,v > retrieving revision 1.50 > diff -u -p -r1.50 pckbd.c > --- sys/dev/pckbc/pckbd.c 25 Jul 2023 10:00:44 -0000 1.50 > +++ sys/dev/pckbc/pckbd.c 12 Aug 2023 06:49:00 -0000 > @@ -344,7 +344,7 @@ pckbdprobe(struct device *parent, void * > { > struct cfdata *cf = match; > struct pckbc_attach_args *pa = aux; > - u_char cmd[1], resp[1]; > + u_char cmd[1], resp[2]; > int res; > > /* > @@ -363,10 +363,40 @@ pckbdprobe(struct device *parent, void * > /* Reset the keyboard. */ > cmd[0] = KBC_RESET; > res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 1, resp, 1); > - if (res) { > + if (res != 0) { > #ifdef DEBUG > printf("pckbdprobe: reset error %d\n", res); > #endif > + } else if (resp[0] != KBR_RSTDONE) { > +#ifdef DEBUG > + printf("pckbdprobe: reset response 0x%x\n", resp[0]); > +#endif > + res = EINVAL; > + } > +#if defined(__i386__) || defined(__amd64__) > + if (res) { > + /* > + * The 8042 emulation on Chromebooks fails the reset > + * command but otherwise appears to work correctly. > + * Try a "get ID" command to give it a second chance. > + */ > + cmd[0] = KBC_GETID; > + res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, > + cmd, 1, 2, resp, 0); > + if (res != 0) { > +#ifdef DEBUG > + printf("pckbdprobe: getid error %d\n", res); > +#endif > + } else if (resp[0] != 0xab || resp[1] != 0x83) { > +#ifdef DEBUG > + printf("pckbdprobe: unexpected id 0x%x/0x%x\n", > + resp[0], resp[1]); > +#endif > + res = EINVAL; > + } > + } > +#endif > + if (res) { > /* > * There is probably no keyboard connected. > * Let the probe succeed if the keyboard is used > @@ -386,10 +416,6 @@ pckbdprobe(struct device *parent, void * > } > #endif > return (pckbd_is_console(pa->pa_tag, pa->pa_slot) ? 1 : 0); > - } > - if (resp[0] != KBR_RSTDONE) { > - printf("pckbdprobe: reset response 0x%x\n", resp[0]); > - return (0); > } > > /* > Index: sys/dev/pckbc/pckbdreg.h > =================================================================== > RCS file: /OpenBSD/src/sys/dev/pckbc/pckbdreg.h,v > retrieving revision 1.2 > diff -u -p -r1.2 pckbdreg.h > --- sys/dev/pckbc/pckbdreg.h 22 Oct 2003 09:44:22 -0000 1.2 > +++ sys/dev/pckbc/pckbdreg.h 12 Aug 2023 06:49:00 -0000 > @@ -12,6 +12,7 @@ > #define KBC_DISABLE 0xF5 /* as per KBC_SETDEFAULT, but also > disable key scanning */ > #define KBC_ENABLE 0xF4 /* enable key scanning */ > #define KBC_TYPEMATIC 0xF3 /* set typematic rate and delay */ > +#define KBC_GETID 0xF2 /* get keyboard ID (not supported > on AT kbd) */ > #define KBC_SETTABLE 0xF0 /* set scancode translation table > */ > #define KBC_MODEIND 0xED /* set mode indicators (i.e. LEDs) > */ > #define KBC_ECHO 0xEE /* request an echo from the > keyboard */ >