This is a port of the essential bits of those two commits from DragonFlyBSD:
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ad8b9749306613f2978808b43fe5e56019aeeb0f
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7f3d8d5546c701eceefe4437a49ffa6f01c7aa09
which allows probing and using the in-built keyboard of the Acer C720 Chromebook (and
potentially other Chromebooks). I made sure to keep comments.
Commit log entries from the original commits (by Matt Dillon):
- Fix a broken conditional that was preventing init_keyboard() from ever being called.
- Reorder the sequence of code in init_keyboard(), placing the soft-reset command first and adding a SETLEDS command later on.
- My chromebook (Acer C720) required that a SETLEDS command be sent to the keyboard before it will send any keystrokes to us, for some reason.
- Chromebooks (Acer C720 at least) appear to be using a BIOS emulator for the i8042 which gets really unhappy if the keyboard port is disabled, even temporarily.
- The original FreeBSD code disables and enables the keyboard port all the time, and even sends discrete disable commands (instead of just trusting that the command register flags will do the job). In addition, the PSM probe code may also disable the keyboard port temporarily while enabling and messing with the AUX port.
- Remove these actions. The keyboard probe will now only disable the keyboard port during the probe and init_keyboard() call, which then proceeds to issue sufficient commands to the keyboard to wake it up again. The PSM probe now no longer touches the keyboard port disable/interrupt bits. At all. Theoetically it should not be necessary to disable the keyboard port while probing the aux port.
- The saved command_mask in the softc is no longer used, remove it.
- It is unclear whether the controller properly prioritizes data returned from controller commands in-front of the data returned from the keyboard or aux ports. However, as it stands now, we cannot safely disable the data from the ports while issuing controller commands and waiting for controller command responses so...