atkbdc: Add additional heurstic for Chromebook keyboards

It turns out that that heurstic used to determine if we have a Google
coreboot, and thus have the i8042 emulation bugs, is incorrect. At least
one Acer "Peppy" Chromebook has an issue because Acer space'd out the
smbios.bios.version string we're using as part of the heuristic. So, if
the version starts with a space, then enable the workarounds if the
smbios.bios.reldate is 2018 or earlier. While not perfect, it should be
a reasonable dividing line and still allow newer core boot-based
machines that aren't Chromebooks to not have the workaround.

Tested by:	Matthias Apitz
Sponsored by:	Netflix
MFC After:	3 days (14.0 candiate)
This commit is contained in:
Warner Losh 2023-09-08 20:18:33 -06:00
parent 5657e065bc
commit 4cd94c8afb

View file

@ -147,6 +147,7 @@ atkbdc_getquirks(void)
char *maker = kern_getenv("smbios.system.maker");
char *product = kern_getenv("smbios.system.product");
char *version = kern_getenv("smbios.bios.version");
char *reldate = kern_getenv("smbios.bios.reldate");
for (i = 0; i < nitems(quirks); i++)
if (QUIRK_STR_EQUAL(quirks[i].bios_vendor, bios_vendor) &&
@ -154,6 +155,16 @@ atkbdc_getquirks(void)
QUIRK_STR_EQUAL(quirks[i].product, product) &&
QUIRK_STR_MATCH(quirks[i].version, version))
return (quirks[i].quirk);
/*
* Some Chromebooks don't conform to the google comment above so do the
* Chromebook workaround for all <= 2018 coreboot systems that have a
* 'blank' version. At least one Acer "Peppy" chromebook has this issue,
* with a reldate of 08/13/2014.
*/
if (QUIRK_STR_EQUAL("coreboot", bios_vendor) &&
(version != NULL && *version == ' ') &&
(reldate != NULL && strlen(reldate) >= 10 && strcmp(reldate + 6, "2018") <= 0))
return (CHROMEBOOK_WORKAROUND);
return (0);
}