Home | History | Annotate | only in /src/sys/dev/pckbport
History log of /src/sys/dev/pckbport
RevisionDateAuthorComments
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 13-Mar-2004  bjh21 branches: 1.1.4;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file Makefile was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.15 02-Aug-2021  andvar fix various typos in comments and log messages.
 1.14 10-Feb-2020  ryoon Introduce hw.alps.touchpad_movement_threshold to better button area clicks
 1.13 10-Feb-2020  ryoon Fix typo in sysctl node name
 1.12 28-May-2019  msaitoh branches: 1.12.4;
s/recieve/receive/
 1.11 16-Mar-2019  ryoon Support more ALPS V2 devices

* The V2 devices found in Toshiba dynabook satellite B551/D and
dynabook SS RX1/T8E.
 1.10 19-Jun-2018  uwe branches: 1.10.2;
Make the error message from pms_alps_probe_init() an error again now
that we don't misidentify almost anything as an ALPS device. Reset if
E6 check failed as well.
 1.9 19-Jun-2018  uwe Don't pass response buffer to the reset command since we are not
interested in it (pckbport_poll_cmd() is smart enough).
 1.8 19-Jun-2018  uwe If the first byte of E7 signature is not 0x73, it's not an ALPS
device, so don't complain we failed to initialize it. Still need a
reset, b/c the E7 check will be interpreted as normal commands by a
normal device.
 1.7 19-Jun-2018  uwe When E6 signature is checked, ignore pressed buttons.
 1.6 19-Jun-2018  uwe Use PMS_SEND_DEV_STATUS for E9 instead of PMS_GET_SCALE (also defined
as E9). This is more readable and is congruent with other drivers.
Same object code is generated.
 1.5 03-Jun-2018  jakllsch Move two probe-time aprint_errors to debug and verbose level instead.

These two are regularly happening within qemu, and would muddle up the
aprint error counter otherwise.
 1.4 16-Aug-2017  nat branches: 1.4.2; 1.4.4; 1.4.6;
Remove extra newline.
 1.3 16-Aug-2017  nat If ALPS probe fails, send a PMS_RESET.
Restores functionality on a wrong version ALPS touchpad.

Addresses PR kern/52489.

This patch was prepared by/committed on behalf of maya@.
 1.2 15-Aug-2017  ryoon Do not print ALPS related message when generic PS/2 case
 1.1 13-Aug-2017  christos PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices
 1.4.6.1 25-Jun-2018  pgoyette Sync with HEAD
 1.4.4.2 03-Dec-2017  jdolecek update from HEAD
 1.4.4.1 16-Aug-2017  jdolecek file alps.c was added on branch tls-maxphys on 2017-12-03 11:37:30 +0000
 1.4.2.2 28-Aug-2017  skrll Sync with HEAD
 1.4.2.1 16-Aug-2017  skrll file alps.c was added on branch nick-nhusb on 2017-08-28 17:52:26 +0000
 1.10.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.1 10-Jun-2019  christos Sync with HEAD
 1.12.4.1 29-Feb-2020  ad Sync with head.
 1.2 28-May-2019  msaitoh s/recieve/receive/
 1.1 13-Aug-2017  christos branches: 1.1.2; 1.1.4; 1.1.8;
PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices
 1.1.8.1 10-Jun-2019  christos Sync with HEAD
 1.1.4.2 03-Dec-2017  jdolecek update from HEAD
 1.1.4.1 13-Aug-2017  jdolecek file alpsreg.h was added on branch tls-maxphys on 2017-12-03 11:37:30 +0000
 1.1.2.2 28-Aug-2017  skrll Sync with HEAD
 1.1.2.1 13-Aug-2017  skrll file alpsreg.h was added on branch nick-nhusb on 2017-08-28 17:52:26 +0000
 1.1 13-Aug-2017  christos branches: 1.1.2; 1.1.4;
PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices
 1.1.4.2 03-Dec-2017  jdolecek update from HEAD
 1.1.4.1 13-Aug-2017  jdolecek file alpsvar.h was added on branch tls-maxphys on 2017-12-03 11:37:30 +0000
 1.1.2.2 28-Aug-2017  skrll Sync with HEAD
 1.1.2.1 13-Aug-2017  skrll file alpsvar.h was added on branch nick-nhusb on 2017-08-28 17:52:26 +0000
 1.6 25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.5 07-Jan-2012  jmcneill branches: 1.5.6; 1.5.10;
add support for elantech (v2) touchpads that report input pressure
 1.4 09-Sep-2011  jakllsch branches: 1.4.2; 1.4.6;
Replace pms_synaptics_send_command() and identical pms_elantech_send_command()
with pms_sliced_command(). Linux shows that this sequence can also be used by
"Logitech PS/2++" protocol as well.
 1.3 30-Dec-2008  jmcneill branches: 1.3.2; 1.3.4; 1.3.8; 1.3.10; 1.3.16;
Silence printf in common "device not found" error path.
 1.2 14-Dec-2008  jmcneill Remove debug printfs
 1.1 14-Dec-2008  jmcneill Add Elantech multi-touch driver.
 1.3.16.2 21-Apr-2010  matt sync to netbsd-5
 1.3.16.1 30-Dec-2008  matt file elantech.c was added on branch matt-nb5-mips64 on 2010-04-21 00:27:50 +0000
 1.3.10.4 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/elantech.c: revision 1.3
Silence printf in common "device not found" error path.
 1.3.10.3 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/elantech.c: revision 1.2
Remove debug printfs
 1.3.10.2 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/files.pckbport: revision 1.7
sys/dev/pckbport/elantech.c: revision 1.1
sys/dev/pckbport/elantechreg.h: revision 1.1
sys/dev/pckbport/elantechvar.h: revision 1.1
sys/dev/pckbport/pms.c: revision 1.27
sys/dev/pckbport/pmsvar.h: revision 1.8
Add Elantech multi-touch driver.
 1.3.10.1 30-Dec-2008  snj file elantech.c was added on branch netbsd-5 on 2009-09-13 22:07:47 +0000
 1.3.8.2 04-May-2009  yamt sync with head.
 1.3.8.1 30-Dec-2008  yamt file elantech.c was added on branch yamt-nfs-mp on 2009-05-04 08:13:14 +0000
 1.3.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.4.1 30-Dec-2008  skrll file elantech.c was added on branch nick-hppapmap on 2009-01-19 13:18:59 +0000
 1.3.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1 30-Dec-2008  mjf file elantech.c was added on branch mjf-devfs2 on 2009-01-17 13:29:07 +0000
 1.4.6.1 18-Feb-2012  mrg merge to -current.
 1.4.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.2.1 17-Apr-2012  yamt sync with head
 1.5.10.1 18-May-2014  rmind sync with head
 1.5.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1 14-Dec-2008  jmcneill branches: 1.1.2; 1.1.4; 1.1.8; 1.1.10; 1.1.16;
Add Elantech multi-touch driver.
 1.1.16.2 21-Apr-2010  matt sync to netbsd-5
 1.1.16.1 14-Dec-2008  matt file elantechreg.h was added on branch matt-nb5-mips64 on 2010-04-21 00:27:50 +0000
 1.1.10.2 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/files.pckbport: revision 1.7
sys/dev/pckbport/elantech.c: revision 1.1
sys/dev/pckbport/elantechreg.h: revision 1.1
sys/dev/pckbport/elantechvar.h: revision 1.1
sys/dev/pckbport/pms.c: revision 1.27
sys/dev/pckbport/pmsvar.h: revision 1.8
Add Elantech multi-touch driver.
 1.1.10.1 14-Dec-2008  snj file elantechreg.h was added on branch netbsd-5 on 2009-09-13 22:07:47 +0000
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 14-Dec-2008  yamt file elantechreg.h was added on branch yamt-nfs-mp on 2009-05-04 08:13:14 +0000
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 14-Dec-2008  skrll file elantechreg.h was added on branch nick-hppapmap on 2009-01-19 13:18:59 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 14-Dec-2008  mjf file elantechreg.h was added on branch mjf-devfs2 on 2009-01-17 13:29:07 +0000
 1.2 07-Jan-2012  jmcneill add support for elantech (v2) touchpads that report input pressure
 1.1 14-Dec-2008  jmcneill branches: 1.1.2; 1.1.4; 1.1.8; 1.1.10; 1.1.16; 1.1.24; 1.1.28;
Add Elantech multi-touch driver.
 1.1.28.1 18-Feb-2012  mrg merge to -current.
 1.1.24.1 17-Apr-2012  yamt sync with head
 1.1.16.2 21-Apr-2010  matt sync to netbsd-5
 1.1.16.1 14-Dec-2008  matt file elantechvar.h was added on branch matt-nb5-mips64 on 2010-04-21 00:27:50 +0000
 1.1.10.2 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/files.pckbport: revision 1.7
sys/dev/pckbport/elantech.c: revision 1.1
sys/dev/pckbport/elantechreg.h: revision 1.1
sys/dev/pckbport/elantechvar.h: revision 1.1
sys/dev/pckbport/pms.c: revision 1.27
sys/dev/pckbport/pmsvar.h: revision 1.8
Add Elantech multi-touch driver.
 1.1.10.1 14-Dec-2008  snj file elantechvar.h was added on branch netbsd-5 on 2009-09-13 22:07:47 +0000
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 14-Dec-2008  yamt file elantechvar.h was added on branch yamt-nfs-mp on 2009-05-04 08:13:14 +0000
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 14-Dec-2008  skrll file elantechvar.h was added on branch nick-hppapmap on 2009-01-19 13:18:59 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 14-Dec-2008  mjf file elantechvar.h was added on branch mjf-devfs2 on 2009-01-17 13:29:07 +0000
 1.10 22-Jul-2019  nakayama hvkbd requires pckbd_keydesctab in wskbdmap_mfii.c.
 1.9 13-Aug-2017  christos branches: 1.9.4;
PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices
 1.8 07-Sep-2011  jakllsch branches: 1.8.12; 1.8.30; 1.8.46;
options PMS_DISABLE_POWERHOOK has been obsolete for a while now,
remove what little still remains of it.
 1.7 14-Dec-2008  jmcneill Add Elantech multi-touch driver.
 1.6 06-Jan-2008  christos branches: 1.6.6; 1.6.10; 1.6.18; 1.6.20; 1.6.26;
defflag one moe variable.
 1.5 11-Dec-2005  christos branches: 1.5.46; 1.5.52; 1.5.60;
merge ktrace-lwp.
 1.4 04-May-2005  augustss branches: 1.4.2;
Make an new option PCKBD_CNATTACH_MAY_FAIL. When this option is set and no
keyboard is detected the pckbd keyboard is not used as the console.

Previously the pckbd keyboard was used as the console as soon as the
kernel had it configured into the kernel. This is far from ideal on a
machine that has no PS/2 keyboard, but a USB keyboard attached since the
(non-existant) PS/2 keyboard becomes the console instead of the USB keyboard.

For now this option will be off by default to be backwards compatible.
 1.3 18-Jan-2005  scw Address PR kern/28990 by making Synaptics Touchpad support contingent
on "options PMS_SYNAPTICS_TOUCHPAD" in the kernel config file. See
the PR for details on why this is necessary.

While here, defflag PMS_DISABLE_POWERHOOK.
 1.2 24-Dec-2004  christos branches: 1.2.2;
PR/28774: Kentaro A. Kurahone: Add synaptics touchpad driver
 1.1 13-Mar-2004  bjh21 branches: 1.1.4;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.4.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.6 24-Jan-2005  skrll Sync with HEAD.
 1.1.4.5 17-Jan-2005  skrll Sync with HEAD.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file files.pckbport was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.2.2.1 29-Apr-2005  kent sync with -current
 1.4.2.1 21-Jan-2008  yamt sync with head
 1.5.60.1 08-Jan-2008  bouyer Sync with HEAD
 1.5.52.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.46.1 09-Jan-2008  matt sync with HEAD
 1.6.26.1 21-Apr-2010  matt sync to netbsd-5
 1.6.20.1 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/files.pckbport: revision 1.7
sys/dev/pckbport/elantech.c: revision 1.1
sys/dev/pckbport/elantechreg.h: revision 1.1
sys/dev/pckbport/elantechvar.h: revision 1.1
sys/dev/pckbport/pms.c: revision 1.27
sys/dev/pckbport/pmsvar.h: revision 1.8
Add Elantech multi-touch driver.
 1.6.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.10.1 04-May-2009  yamt sync with head.
 1.6.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.46.1 23-Jul-2019  martin Pull up following revision(s) (requested by nakayama in ticket #1305):

sys/dev/pckbport/files.pckbport: revision 1.10

hvkbd requires pckbd_keydesctab in wskbdmap_mfii.c.
 1.8.30.1 28-Aug-2017  skrll Sync with HEAD
 1.8.12.1 03-Dec-2017  jdolecek update from HEAD
 1.9.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.39 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.38 16-Jul-2023  christos From Vladimir 'phcoder' Serbinenko in tech-kern:

On at least some Chromebooks PS/2 reset command generates no
response and we end up reading garbage and disabling keyboard
support altogether even though that controller otherwise works
fine. Linux issues reset but ignores the reply and relies on
getid instead. So does Haiku. FreeB= SD assumes that all coreboot
systems have PS/2 which is wrong as it supports some MacBooks as
well. No idea what windows does but keyboard works there.

Also do some KNF while here.
 1.37 28-Oct-2022  riastradh pckbport(4): C99 initializers

No functional change intended.
 1.36 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.35 24-Apr-2021  thorpej branches: 1.35.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.34 23-Jul-2019  jmcneill branches: 1.34.12;
pckbd_cngetc: Set type=0 and return if no data is available
 1.33 11-Jun-2017  nat branches: 1.33.6;
New device wsbell - allows for a console beep for non pckbds (usb etc).
Works for platforms without pcppi - can work with spkr at audio and spkr
at pcppi.

To use add the following to your kernel config:
wsbell* at spkr? console?

Ok pgoyette@.
 1.32 16-Jul-2015  prlw1 Disambiguate debug message.
 1.31 15-Sep-2013  martin branches: 1.31.6;
Cosemetically "fix" the pckbd_attach() return value, so gcc can see the
value is used (no functional change)
 1.30 13-Oct-2012  jdc branches: 1.30.2;
Add two flags to keyboard/mouse attachment:
PCKBC_CANT_TRANSLATE for keyboards that cannot translate to XT scancodes
PCKBC_NEED_AUXWRITE for mice that don't probe first time
These flags can be set by the port-specific attachments.

Add the translation table and function to handle set 2 to set 1 keyboard
translation in software.

Based on OpenBSD sys/dev/ic/pckbc.c revisions 1.10, 1.16, 1.17, and
sys/dev/pckbc/pckbd.c revision 1.15, and 8042 scan code information at:

http://www.computer-engineering.org/ps2keyboard/

Note, that this changes the signature of pckbc_cnattach(), so ride the
kernel version bump for namei.
 1.29 24-Feb-2010  dyoung branches: 1.29.10; 1.29.20;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.28 08-Jan-2010  dyoung branches: 1.28.2;
Expand PMF_FN_* macros.
 1.27 16-Jul-2009  jakllsch Ignore scancodes E0 2A, E0 AA, E0 36, E0 B6 when decoding.
For the 10 keys on the editing keypad, these prefix/postfix
scancodes indicate the state of the Left Shift and Right Shift
keys and Num Lock indicator.

This change prevents a spurious WSCONS_EVENT_KEY_UP event upon
press as well as the corresponding WSCONS_EVENT_KEY_DOWN event
upon release.
 1.26 08-Mar-2009  ad use aprint_error
 1.25 11-Jun-2008  drochner branches: 1.25.4; 1.25.6; 1.25.10; 1.25.14;
remove a KBC_ENABLE call in the console poll method -- this was
just a workaround and is not necessary anymore
 1.24 28-Apr-2008  martin branches: 1.24.2; 1.24.4;
Remove clause 3 and 4 from TNF licenses
 1.23 15-Mar-2008  cube branches: 1.23.2; 1.23.4;
Use proper types.
 1.22 15-Mar-2008  cube Split device_t and softc for pckbd(4) and pms(4).
 1.21 29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.20 21-Feb-2008  joerg branches: 1.20.2; 1.20.6;
Ensure that the keyboard is enabled before polling it.
This allows pressing a key to reboot the machine.
 1.19 10-Jan-2008  dyoung Support pcppi(4) detachment.

Use device_t, device_private(). Get rid of a struct device * cast.
 1.18 09-Dec-2007  jmcneill branches: 1.18.2;
Merge jmcneill-pm branch.
 1.17 01-Dec-2007  jmcneill branches: 1.17.2; 1.17.4;
aprintify
 1.16 19-Oct-2007  ad branches: 1.16.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 04-Mar-2007  christos branches: 1.15.2; 1.15.14; 1.15.16; 1.15.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 16-Nov-2006  christos branches: 1.14.4;
__unused removal on arguments; approved by core.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.11 18-Jun-2006  christos branches: 1.11.4; 1.11.6;
Jared asked me to commit the powerhooks for this
 1.10 29-Mar-2006  thorpej branches: 1.10.2; 1.10.4;
Use device_private().
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
merge ktrace-lwp.
 1.8 29-May-2005  christos branches: 1.8.2;
avoid shadowed variable
 1.7 04-May-2005  augustss Make an new option PCKBD_CNATTACH_MAY_FAIL. When this option is set and no
keyboard is detected the pckbd keyboard is not used as the console.

Previously the pckbd keyboard was used as the console as soon as the
kernel had it configured into the kernel. This is far from ideal on a
machine that has no PS/2 keyboard, but a USB keyboard attached since the
(non-existant) PS/2 keyboard becomes the console instead of the USB keyboard.

For now this option will be off by default to be backwards compatible.
 1.6 29-Apr-2005  yamt tweak order of #include to avoid an array of incomplete type.
found by gcc4.
 1.5 01-Apr-2005  matt P.k.py lp.kcrgow ao mabf ru go oycnn dak. _n.iajf_ t.fxrapeov
Allprk.e xf jrp.v
 1.4 01-Apr-2005  gavan Due to the increasing rarity of legacy keyboards, switch to a more contemporary default
layout for PC style keyboards.
 1.3 27-Feb-2005  perry nuke trailing whitespace
 1.2 18-Mar-2004  bjh21 branches: 1.2.4; 1.2.10; 1.2.12;
ANSIfy, un-__P(), and generally KNF.
 1.1 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.2.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.10.1 29-Apr-2005  kent sync with -current
 1.2.4.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.4.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.5 28-Nov-2004  skrll Adapt to branch
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 18-Mar-2004  skrll file pckbd.c was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.8.2.8 17-Mar-2008  yamt sync with head.
 1.8.2.7 27-Feb-2008  yamt sync with head.
 1.8.2.6 21-Jan-2008  yamt sync with head
 1.8.2.5 07-Dec-2007  yamt sync with head
 1.8.2.4 27-Oct-2007  yamt sync with head.
 1.8.2.3 03-Sep-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.9.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.9.10.1 19-Apr-2006  elad sync with head.
 1.9.8.2 26-Jun-2006  yamt sync with head.
 1.9.8.1 01-Apr-2006  yamt sync with head.
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.10.2.1 19-Jun-2006  chap Sync with head.
 1.11.6.2 10-Dec-2006  yamt sync with head.
 1.11.6.1 22-Oct-2006  yamt sync with head
 1.11.4.1 18-Nov-2006  ad Sync with head.
 1.14.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.16.3 23-Mar-2008  matt sync with HEAD
 1.15.16.2 09-Jan-2008  matt sync with HEAD
 1.15.16.1 06-Nov-2007  matt sync with HEAD
 1.15.14.5 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.15.14.4 01-Dec-2007  jmcneill Sync with HEAD.
 1.15.14.3 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.15.14.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.14.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.15.2.1 23-Oct-2007  ad Sync with head.
 1.16.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.16.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.16.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.17.4.1 11-Dec-2007  yamt sync with head.
 1.17.2.1 26-Dec-2007  ad Sync with head.
 1.18.2.1 10-Jan-2008  bouyer Sync with HEAD
 1.20.6.4 29-Jun-2008  mjf Sync with HEAD.
 1.20.6.3 02-Jun-2008  mjf Sync with HEAD.
 1.20.6.2 03-Apr-2008  mjf Sync with HEAD.
 1.20.6.1 21-Feb-2008  mjf file pckbd.c was added on branch mjf-devfs2 on 2008-04-03 12:42:54 +0000
 1.20.2.1 24-Mar-2008  keiichi sync with head.
 1.23.4.4 11-Mar-2010  yamt sync with head
 1.23.4.3 18-Jul-2009  yamt sync with head.
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.2 17-Jun-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.4.1 18-Jun-2008  simonb Sync with head.
 1.24.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.25.14.1 21-Apr-2010  matt sync to netbsd-5
 1.25.10.2 23-Jul-2009  jym Sync with HEAD.
 1.25.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.6.1 30-Jan-2010  snj Pull up following revision(s) (requested by hubertf in ticket #1282):
sys/dev/pckbport/pckbd.c: revision 1.26
sys/dev/pckbport/pms.c: revision 1.28
use aprint_error
 1.25.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.28.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.29.20.3 03-Dec-2017  jdolecek update from HEAD
 1.29.20.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.20.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.29.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.10.1 30-Oct-2012  yamt sync with head
 1.30.2.1 18-May-2014  rmind sync with head
 1.31.6.2 28-Aug-2017  skrll Sync with HEAD
 1.31.6.1 22-Sep-2015  skrll Sync with HEAD
 1.33.6.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.34.12.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.35.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 16-Jul-2023  christos From Vladimir 'phcoder' Serbinenko in tech-kern:

On at least some Chromebooks PS/2 reset command generates no
response and we end up reading garbage and disabling keyboard
support altogether even though that controller otherwise works
fine. Linux issues reset but ignores the reply and relies on
getid instead. So does Haiku. FreeB= SD assumes that all coreboot
systems have PS/2 which is wrong as it supports some MacBooks as
well. No idea what windows does but keyboard works there.

Also do some KNF while here.
 1.3 06-Mar-2013  christos Deal with Foxconn NanoPC nT-i1250 returning BAT_FAIL and don't infinite loop
From OpenBSD.
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.120;
merge ktrace-lwp.
 1.1 13-Mar-2004  bjh21 branches: 1.1.4;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file pckbdreg.h was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.2.120.1 23-Jun-2013  tls resync from head
 1.2.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4 10-Jan-2008  dyoung Support pcppi(4) detachment.

Use device_t, device_private(). Get rid of a struct device * cast.
 1.3 11-Dec-2005  christos branches: 1.3.46; 1.3.52; 1.3.60;
merge ktrace-lwp.
 1.2 18-Mar-2004  bjh21 branches: 1.2.4; 1.2.18;
ANSIfy, un-__P(), and generally KNF.
 1.1 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.2.18.1 21-Jan-2008  yamt sync with head
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 18-Mar-2004  skrll file pckbdvar.h was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.3.60.1 10-Jan-2008  bouyer Sync with HEAD
 1.3.52.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.46.1 23-Mar-2008  matt sync with HEAD
 1.20 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.19 24-Apr-2021  thorpej branches: 1.19.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.18 10-Nov-2019  chs branches: 1.18.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.17 11-Jan-2014  jakllsch branches: 1.17.30;
KASSERT that cmd is non-NULL in more places, and in a place that previously
did not use KASSERT to do the same thing.
 1.16 06-Mar-2013  christos branches: 1.16.6;
fix debugging printf
 1.15 06-Mar-2013  christos Deal with Foxconn NanoPC nT-i1250 returning BAT_FAIL and don't infinite loop
From OpenBSD.
 1.14 09-Sep-2011  jakllsch branches: 1.14.2; 1.14.12;
const-ify input command buffer argument to
pckbport_poll_cmd and pckbport_enqueue_cmd.
 1.13 15-Mar-2008  cube Use proper types.
 1.12 15-Mar-2008  cube Split device_t and softc for pckbd(4) and pms(4).
 1.11 04-Jan-2008  ad branches: 1.11.2; 1.11.6;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.10 09-Jul-2007  ad branches: 1.10.8; 1.10.14; 1.10.20;
Initialize callouts before use.
 1.9 03-Sep-2006  bjh21 branches: 1.9.12; 1.9.14;
All ports that use the file do so through files.pckbport, so there's no
need to be cautious about including "pckbd.h". This has the side-effect
that ports using pckbd but not defining __HAVE_NWSCONS will now get pckbd
attached as console if they call pckbport_cnattach(), but I don't think
any such ports exist.
 1.8 18-Jun-2006  christos reset kbc as the comment said. from joerg.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8; 1.7.14; 1.7.16;
merge ktrace-lwp.
 1.6 25-Aug-2005  drochner kill a number of autoconf submatch functions which follow the
standard scheme:
if (<configured> != <wildcard> && <configured> != <real>)
then fail
else
ask device match function

This is handled by config_stdsubmatch() now.
 1.5 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.4 13-Sep-2004  drochner branches: 1.4.12;
a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.3 24-Mar-2004  drochner branches: 1.3.4;
remove license clauses 3 and 4 from my cpoyright notices
 1.2 18-Mar-2004  bjh21 ANSIfy, un-__P(), and generally KNF.
 1.1 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.3.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 24-Mar-2004  skrll file pckbport.c was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.4.12.5 17-Mar-2008  yamt sync with head.
 1.4.12.4 21-Jan-2008  yamt sync with head
 1.4.12.3 03-Sep-2007  yamt sync with head.
 1.4.12.2 30-Dec-2006  yamt sync with head.
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.7.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.7.14.1 22-Jun-2006  chap Complete a sync sys/ with head.
 1.7.8.2 14-Sep-2006  yamt sync with head.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.9.14.1 11-Jul-2007  mjf Sync with head.
 1.9.12.1 15-Jul-2007  ad Sync with head.
 1.10.20.1 08-Jan-2008  bouyer Sync with HEAD
 1.10.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.10.8.2 23-Mar-2008  matt sync with HEAD
 1.10.8.1 09-Jan-2008  matt sync with HEAD
 1.11.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.2.1 24-Mar-2008  keiichi sync with head.
 1.14.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.1 23-Jun-2013  tls resync from head
 1.14.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.6.1 18-May-2014  rmind sync with head
 1.17.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.18.10.1 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.19.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 09-Sep-2011  jakllsch const-ify input command buffer argument to
pckbport_poll_cmd and pckbport_enqueue_cmd.
 1.8 15-Mar-2008  cube Use proper types.
 1.7 15-Mar-2008  cube Split device_t and softc for pckbd(4) and pms(4).
 1.6 11-Dec-2005  christos branches: 1.6.46; 1.6.66; 1.6.70;
merge ktrace-lwp.
 1.5 22-Apr-2005  yamt branches: 1.5.2;
fix static/extern mismatch. found by gcc4.
 1.4 27-Feb-2005  perry nuke trailing whitespace
 1.3 24-Mar-2004  drochner branches: 1.3.4; 1.3.10; 1.3.12;
remove license clauses 3 and 4 from my cpoyright notices
 1.2 18-Mar-2004  bjh21 ANSIfy, un-__P(), and generally KNF.
 1.1 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.4.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 24-Mar-2004  skrll file pckbportvar.h was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.5.2.1 17-Mar-2008  yamt sync with head.
 1.6.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.66.1 24-Mar-2008  keiichi sync with head.
 1.6.46.1 23-Mar-2008  matt sync with HEAD
 1.42 07-Dec-2024  chs pms: support PS/2 mouse hot-plug

Detect the BAT (Basic Assurance Test) result value and reset
the driver state in this case.

ok martin@
 1.41 05-Sep-2023  mrg branches: 1.41.6;
panic on an condition that shouldn't be possible.

appease GCC 12.
 1.40 28-Oct-2022  riastradh pckbport(4): C99 initializers

No functional change intended.
 1.39 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.38 24-Apr-2021  thorpej branches: 1.38.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.37 13-Jul-2018  maya branches: 1.37.16;
Add comment elaborating what a sliced command is.
 1.36 13-Aug-2017  christos branches: 1.36.2; 1.36.4;
PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices
 1.35 09-Sep-2011  jakllsch branches: 1.35.12; 1.35.30;
Replace pms_synaptics_send_command() and identical pms_elantech_send_command()
with pms_sliced_command(). Linux shows that this sequence can also be used by
"Logitech PS/2++" protocol as well.
 1.34 08-Sep-2011  jakllsch Sprinkle static.
 1.33 08-Sep-2011  jakllsch Make whitespace more consistent.
 1.32 07-Sep-2011  jakllsch options PMS_DISABLE_POWERHOOK has been obsolete for a while now,
remove what little still remains of it.
 1.31 24-May-2011  joerg Use proper format string
 1.30 24-Feb-2010  dyoung branches: 1.30.2; 1.30.4;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.29 08-Jan-2010  dyoung branches: 1.29.2;
Expand PMF_FN_* macros.
 1.28 08-Mar-2009  ad use aprint_error
 1.27 14-Dec-2008  jmcneill branches: 1.27.2;
Add Elantech multi-touch driver.
 1.26 15-Mar-2008  cube branches: 1.26.4; 1.26.12; 1.26.14; 1.26.20;
Use proper types.
 1.25 15-Mar-2008  cube Split device_t and softc for pckbd(4) and pms(4).
 1.24 29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.23 28-Jan-2008  jmcneill branches: 1.23.2; 1.23.6;
Don't call do_enable on synaptics resume if !sc->sc_enabled
 1.22 09-Dec-2007  jmcneill Merge jmcneill-pm branch.
 1.21 01-Dec-2007  jmcneill branches: 1.21.2; 1.21.4;
aprintify
 1.20 19-Oct-2007  ad branches: 1.20.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 19-Jul-2007  dsl branches: 1.19.4; 1.19.6; 1.19.10; 1.19.12;
include sys/cdefs.h before opt_xxx.h
 1.18 09-Jul-2007  ad branches: 1.18.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 16-Nov-2006  christos branches: 1.16.4;
__unused removal on arguments; approved by core.
 1.15 12-Nov-2006  plunky Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.12 13-Sep-2006  christos branches: 1.12.2;
avoid empty if bodies.
 1.11 07-Jun-2006  kardel branches: 1.11.6;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.10 29-Mar-2006  thorpej branches: 1.10.2;
Use device_private().
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.6; 1.9.8; 1.9.10; 1.9.12;
merge ktrace-lwp.
 1.8 08-Nov-2005  rpaulo Add a fake entry in pms_protocols array to avoid an out-of-bounds
access in do_enable() if PMS_SYNAPTICS_TOUCHPAD and PMSDEBUG are both
defined.
 1.7 24-Oct-2005  jdolecek constify
 1.6 27-Feb-2005  perry branches: 1.6.4; 1.6.6;
nuke trailing whitespace
 1.5 27-Jan-2005  jmcneill Fix synaptics touchpad resume, from Kentaro A. Kurahone.
 1.4 18-Jan-2005  scw branches: 1.4.2;
Address PR kern/28990 by making Synaptics Touchpad support contingent
on "options PMS_SYNAPTICS_TOUCHPAD" in the kernel config file. See
the PR for details on why this is necessary.

While here, defflag PMS_DISABLE_POWERHOOK.
 1.3 24-Dec-2004  christos branches: 1.3.2;
PR/28774: Kentaro A. Kurahone: Add synaptics touchpad driver
 1.2 18-Mar-2004  bjh21 branches: 1.2.4;
ANSIfy, un-__P(), and generally KNF.
 1.1 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.2.4.10 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.4.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.8 04-Feb-2005  skrll Sync with HEAD.
 1.2.4.7 24-Jan-2005  skrll Sync with HEAD.
 1.2.4.6 17-Jan-2005  skrll Sync with HEAD.
 1.2.4.5 28-Nov-2004  skrll Adapt to branch
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 18-Mar-2004  skrll file pms.c was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.3.2.1 29-Apr-2005  kent sync with -current
 1.4.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.2.1 12-Feb-2005  yamt sync with head.
 1.6.6.1 26-Oct-2005  yamt sync with head
 1.6.4.8 17-Mar-2008  yamt sync with head.
 1.6.4.7 04-Feb-2008  yamt sync with head.
 1.6.4.6 21-Jan-2008  yamt sync with head
 1.6.4.5 07-Dec-2007  yamt sync with head
 1.6.4.4 27-Oct-2007  yamt sync with head.
 1.6.4.3 03-Sep-2007  yamt sync with head.
 1.6.4.2 30-Dec-2006  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.9.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.9.10.1 19-Apr-2006  elad sync with head.
 1.9.8.3 14-Sep-2006  yamt sync with head.
 1.9.8.2 26-Jun-2006  yamt sync with head.
 1.9.8.1 01-Apr-2006  yamt sync with head.
 1.9.6.2 22-Apr-2006  simonb Sync with head.
 1.9.6.1 04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 19-Jun-2006  chap Sync with head.
 1.11.6.1 18-Nov-2006  ad Sync with head.
 1.12.2.2 10-Dec-2006  yamt sync with head.
 1.12.2.1 22-Oct-2006  yamt sync with head
 1.16.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.5 23-Oct-2007  ad Sync with head.
 1.17.2.4 12-Oct-2007  ad Fix merge errors.
 1.17.2.3 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.17.2.2 10-Apr-2007  ad Nuke the deferred kthread creation stuff, as it's no longer needed.
Pointed out by thorpej@.
 1.17.2.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.18.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.19.12.2 19-Jul-2007  dsl include sys/cdefs.h before opt_xxx.h
 1.19.12.1 19-Jul-2007  dsl file pms.c was added on branch matt-mips64 on 2007-07-19 22:18:55 +0000
 1.19.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.19.6.3 23-Mar-2008  matt sync with HEAD
 1.19.6.2 09-Jan-2008  matt sync with HEAD
 1.19.6.1 06-Nov-2007  matt sync with HEAD
 1.19.4.6 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.19.4.5 01-Dec-2007  jmcneill Sync with HEAD.
 1.19.4.4 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.19.4.3 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.19.4.2 02-Oct-2007  joerg Fix build with PMS_DISABLE_POWERHOOK.
 1.19.4.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.20.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.20.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.21.4.1 11-Dec-2007  yamt sync with head.
 1.21.2.1 26-Dec-2007  ad Sync with head.
 1.23.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.23.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.2.1 24-Mar-2008  keiichi sync with head.
 1.26.20.1 21-Apr-2010  matt sync to netbsd-5
 1.26.14.2 30-Jan-2010  snj Pull up following revision(s) (requested by hubertf in ticket #1282):
sys/dev/pckbport/pckbd.c: revision 1.26
sys/dev/pckbport/pms.c: revision 1.28
use aprint_error
 1.26.14.1 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/files.pckbport: revision 1.7
sys/dev/pckbport/elantech.c: revision 1.1
sys/dev/pckbport/elantechreg.h: revision 1.1
sys/dev/pckbport/elantechvar.h: revision 1.1
sys/dev/pckbport/pms.c: revision 1.27
sys/dev/pckbport/pmsvar.h: revision 1.8
Add Elantech multi-touch driver.
 1.26.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.26.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.4.2 11-Mar-2010  yamt sync with head
 1.26.4.1 04-May-2009  yamt sync with head.
 1.27.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.30.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.2.1 31-May-2011  rmind sync with head
 1.35.30.1 28-Aug-2017  skrll Sync with HEAD
 1.35.12.1 03-Dec-2017  jdolecek update from HEAD
 1.36.4.1 10-Jun-2019  christos Sync with HEAD
 1.36.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.37.16.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.38.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.41.6.1 02-Aug-2025  perseant Sync with HEAD
 1.3 08-Feb-2011  cegger add PS/2 registers from synaptics spec:
PMS_RESET_WRAP_MODE, PMS_SET_WRAP_MODE, PMS_ACK, PMS_ERROR and PMS_RESEND

while here use #define<tab> consistently.
 1.2 11-Dec-2005  christos branches: 1.2.98; 1.2.104; 1.2.106;
merge ktrace-lwp.
 1.1 13-Mar-2004  bjh21 branches: 1.1.4;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file pmsreg.h was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.2.106.1 08-Feb-2011  bouyer Sync with HEAD
 1.2.104.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.98.1 05-Mar-2011  rmind sync with head
 1.12 13-Aug-2017  christos PR/52483: Ryo ONODERA: Add support for ALPS PS/2 pointing devices
 1.11 09-Sep-2011  jakllsch branches: 1.11.12; 1.11.30;
Replace pms_synaptics_send_command() and identical pms_elantech_send_command()
with pms_sliced_command(). Linux shows that this sequence can also be used by
"Logitech PS/2++" protocol as well.
 1.10 08-Sep-2011  jakllsch Cosmetic changes.
 1.9 07-Sep-2011  jakllsch options PMS_DISABLE_POWERHOOK has been obsolete for a while now,
remove what little still remains of it.
 1.8 14-Dec-2008  jmcneill Add Elantech multi-touch driver.
 1.7 15-Mar-2008  cube branches: 1.7.4; 1.7.12; 1.7.14; 1.7.20;
Use proper types.
 1.6 15-Mar-2008  cube Split device_t and softc for pckbd(4) and pms(4).
 1.5 09-Jul-2007  ad branches: 1.5.8; 1.5.24; 1.5.28;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.32;
merge ktrace-lwp.
 1.3 27-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 18-Jan-2005  scw branches: 1.2.2;
Address PR kern/28990 by making Synaptics Touchpad support contingent
on "options PMS_SYNAPTICS_TOUCHPAD" in the kernel config file. See
the PR for details on why this is necessary.

While here, defflag PMS_DISABLE_POWERHOOK.
 1.1 24-Dec-2004  christos branches: 1.1.2; 1.1.4;
PR/28774: Kentaro A. Kurahone: Add synaptics touchpad driver
 1.1.4.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.3 24-Jan-2005  skrll Sync with HEAD.
 1.1.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.1.4.1 24-Dec-2004  skrll file pmsvar.h was added on branch ktrace-lwp on 2005-01-17 19:31:51 +0000
 1.1.2.1 29-Apr-2005  kent sync with -current
 1.2.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.4.2 17-Mar-2008  yamt sync with head.
 1.3.4.1 03-Sep-2007  yamt sync with head.
 1.4.32.1 11-Jul-2007  mjf Sync with head.
 1.4.30.1 09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.5.28.2 17-Jan-2009  mjf Sync with HEAD.
 1.5.28.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.24.1 24-Mar-2008  keiichi sync with head.
 1.5.8.1 23-Mar-2008  matt sync with HEAD
 1.7.20.1 21-Apr-2010  matt sync to netbsd-5
 1.7.14.1 13-Sep-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #943):
sys/dev/pckbport/files.pckbport: revision 1.7
sys/dev/pckbport/elantech.c: revision 1.1
sys/dev/pckbport/elantechreg.h: revision 1.1
sys/dev/pckbport/elantechvar.h: revision 1.1
sys/dev/pckbport/pms.c: revision 1.27
sys/dev/pckbport/pmsvar.h: revision 1.8
Add Elantech multi-touch driver.
 1.7.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.4.1 04-May-2009  yamt sync with head.
 1.11.30.1 28-Aug-2017  skrll Sync with HEAD
 1.11.12.1 03-Dec-2017  jdolecek update from HEAD
 1.84 19-Jul-2024  mlelstv hw.synaptics.aux_mid_button_scroll translates vertical movements
of an aux device (like a trackpoint) into a scroll event when
the middle mouse button is pressed.

Make this work with either the middle mouse button of the main
device (buttonmask 0x02) or the middle mouse button of the aux
device (buttonmask 0x40).

Fixes PR 58435.
 1.83 18-Apr-2024  mlelstv branches: 1.83.2;
Renamed border/boundary variables to better describe their use.
Fix edge default values, factor out percentage calculation for more consistent
values. Use device_printf/DPRINTF to show errors instead of aprint variants.
Print raw input for debugging.

Correct capability parsing. Old devices were probed with nonexistent
commands and then used undefined boundary values that made them unusuable.

Fixes PR 57874.
 1.82 05-Sep-2023  mrg panic on an condition that shouldn't be possible.

appease GCC 12.
 1.81 28-Sep-2022  nia branches: 1.81.4;
synaptics: Lower scale factor to give less sluggish mouse performance
on modern displays.
 1.80 17-Sep-2022  mlelstv - synaptics_filter_policy no longer generates movements from stale data.
- button boundary is now computed consistently.
- multi finger operation now works for MULTI_FINGER and MULTI_FINGER_REPORT.

Fixes PR kern/56476 and probably kern/56998.
 1.79 31-May-2022  andvar fix various typos in comments, documentation and messages.
 1.78 04-Apr-2022  blymn Use the original right boundary when calculating the vertical scroll
region so the boundary does not creep left on each subsequent setting.
Thanks to Martin@ for the report.
 1.77 01-Apr-2022  blymn Fix regression introduced when fixing PR kern/56613 and related tweaks

* A trackpad with external buttons needs to mask a number of lower bits
of the X and Y coordinates IFF a button is down. This was not being
done so a button held down looked like an out of range packet and
was therefore dropped.

* Now that trackpads are probed for their boundaries make the emulated
button boundary settable by a percentage, also allow the right and
bottom boundaries to be adjusted by a percentage to allow for
horizontal and vertical scroll regions.
 1.76 03-Mar-2022  blymn Fix for PR kern/56613

* For trackpads that report max and min coordinates, retrieve these and
use them as the boundaries instead of the hard coded limits.
* Drop packets that are have x/y values that are outside the limits of
the trackpad. Some trackpads report a stream of low values in some
situations that cause cursor jumping.
 1.75 04-Dec-2021  nia synaptics: Fix tracking of extended buttons.

- Ensure that packets are processed whenever any button change
occurs, instead of just processing packets when there is movement
or trackpad finger activity
- Only transfer the state of the "extended buttons" to the button
masks when actual changes occur OR a button is being held down.

With this patch, my middle mouse button no longer gets "stuck down",
but proper press/release tracking and dragging behavior is preserved.

Thanks to blymn for pointers.
 1.74 03-Dec-2021  andvar fix various typos in comments, log messages and documentation.
 1.73 21-Oct-2021  blymn Significant update to the synaptics touchpad driver.

* Accumulate packets for primary, secondary, finger count packets
before handing off to pms_synaptics_process_packet. This means
that both primary and, possibly, secondary finger locations will
be processed at the same time. Previously the processing each
packet as it arrived.

* Fix the secondary finger position reporting, there was an off by
one in the shifts when decoding which effectively halved the
reported position.

* For a clickpad, make the emulated button region "dead" so that finger
movements in this region are ignored. This makes it easier to click
a button without accidentally repositioning the cursor. There is a
sysctl variable "button_region_movement_enable" that will allow
these finger movements to be reported if this is desirable.

* Reset the finger ballistics when the number of fingers changes. This
stops the annoying position jumps when a second finger touch is added
to or removed from the touchpad.

* Add a level argument to the DPRINTF macro so one can choose their
level of debug spam via the debug sysctl variable.
 1.72 28-Sep-2021  nia synaptics: use the new WSCONS_EVENT_(H|V)SCROLL event types
to implement two-finger scrolling. remove non-functional code for
detecting reported finger width.
 1.71 30-May-2021  riastradh synaptics(4): New sysctl knob for debug output.

Set hw.synaptics.debug=1 to re-enable it; the compile-time DIAGNOSTIC
option was inappropriate for this.
 1.70 01-Oct-2020  nia branches: 1.70.6; 1.70.8;
synaptics: Emulate scrolling when the middle button is held with TrackPoints

idea stolen from various other operating systems.

this configurable with a sysctl in case somebody wants to hold the middle
button, e.g. with old window managers that close menus when a button is
released.
 1.69 01-Oct-2020  nia erect a signpost for weary travellers
 1.68 01-Oct-2020  nia comment was likely true in 2007 but no longer reflects the reality of hw
 1.67 14-May-2020  nia synaptics: Don't reset the device multiple times in succession

Cherrypicked from a patch from an anonymous contributor.
 1.66 28-Apr-2020  jmcneill pms_synaptics_enable: no need to send PMS_DEV_ENABLE here because
pms_enable does this for us. Seems to resolve issues with my trackpoint
not working immediately after starting X on ThinkPad X260.
 1.65 27-Apr-2020  jmcneill Extended buttons are reported separate from touchpad buttons, so track
button press / release state separate from touch events.
 1.64 31-Mar-2020  nia synaptics: Maintain the left/right buttons when up/down are remapped

Reported on current-users by Mandacarú Cascavel
 1.63 27-Mar-2020  nia synaptics: Revert changes that broke gestures in cases where they worked.

It seems I have to figure out another way to make scrolling work for me.
 1.62 16-Mar-2020  nia synaptics: Increase default scale_z for more precise scrolling
 1.61 15-Mar-2020  nia synaptics: Check for single-finger event jitter in all cases.

I now have smooth two-finger scrolling.
 1.60 14-Mar-2020  nia synaptics: Detect multiple fingers outside the gesture period

I suspect this code doesn't make any sense if we want two-finger scrolling
 1.59 14-Mar-2020  nia synaptics: Automatically scroll when multiple fingers are detected

This will mean we automatically get two-finger scrolling on multitouch
pads.

This works, but the scrolling is janky. Why does it eventually move the
mouse cursor (only one finger detected, but two are still there), and why
does it jump up slightly?
 1.58 14-Mar-2020  nia synaptics: fix syntax
 1.57 14-Mar-2020  nia synaptics: Allow the max_speed sysctls to be set
 1.56 14-Mar-2020  nia synaptics: Set up_down_emulation=3 by default.

It's a less surprising default for modern hardware.
 1.55 14-Mar-2020  nia synaptics: Make up_down_emulation useful for single-button clickpads

On devices such as the Thinkpad X250, the clickpad can be pressed
to generate mouse button events 1 and 2. There are also additional
physical buttons which the pms(4) driver recognizes as "up/down" buttons
(mouse buttons 3 and 4). Allow these to be remapped to buttons 1 and 2
and used like normal touchpad buttons with the following sysctl:

# sysctl -w hw.synaptics.up_down_emulation=3

While here, adjust the existing "middle button emulation"
(hw.synaptics.up_down_emulation=1) so it works with single-button
clickpads.

XXX: 3 may be a more useful default than the current default,
depending on hardware availability of touchpads with "up/down buttons".

Update the documentation accordingly.
 1.54 25-Feb-2020  ryoon Messages in pms_synaptics_input() should not start with "pms_input"

Use "pms_synaptics_input" instead for another 2 messages.
 1.53 25-Feb-2020  ryoon Messages in pms_synaptics_input() should not start with "pms_input"

Use "pms_synaptics_input" instead.
 1.52 25-Feb-2020  ryoon Do not enter extended W mode conditional for non extended W mode device

Even without extended W mode, sp_w can be 2. This causes
"invalid extended w mode N" warning messages.
Restrict extended W mode conditional for hardwares with extended W
support.

Tested with Synaptics 6.2 device on Panasonic CF-Y8, however it does
not work with X.
 1.51 25-Feb-2020  ryoon Remove a trailing tab.
 1.50 05-Jul-2019  mlelstv branches: 1.50.2; 1.50.4;
Resynchronizing the input stream could infinitely wait when the touchpad
is in the wrong (relative) mode. The detection of relative mode is never
reached.

Limit the resynchronization to 6 bytes, then trigger a reset.
 1.49 02-Jun-2019  blymn Changes based on code from an anonymous contributor. This should make
trackpads work for Thinkpads. Also adds code to handle externally
connected buttons (synaptics parlance), the first five are mapped to
mouse buttons 1-5. The rest are currently not reported but could be
decoded if required.
 1.48 22-Apr-2019  blymn Modify driver to use bits(3) to extract capabilities. Thanks to
Anon Ymous for the fix.
 1.47 21-Apr-2019  blymn Fix minor comment nit.
 1.46 04-Dec-2018  blymn * Increase the default scaling of the two finger scroll to make it
less sensitive
* Fix range check for hw.synaptics.scale_z so it can be set with sysctl
 1.45 28-Nov-2018  blymn * Increase minimum finger width to prevent entering scroll mode erroneously
* Attempt to clarify what the sysctl variables for finger scroll do
* Add hysteresis to validity check so changing it does not get rejected

Thanks to Martin Husemann and Michael van Elst for reporting the issues.
 1.44 06-Nov-2018  blymn Add double finger scroll feature. If the detected width is between a
defined range then report y movement as z-axis. Effectively emulating
a mouse scroll wheel.
 1.43 06-Nov-2018  blymn Fix clamping of deltas so it works for both positive and negative deltas.
 1.42 14-Jul-2018  maya Send the 'magic reverse engineered sequence' with a single sliced command,
don't wait for individual ACKs. Fixes kern/53444.

While here:
- use better descriptive names for functions
- use a function for the extended write command
- add macro for number from the old synaptics documentation
- don't get the resp from the command sequence if we're going to ignore
it anyway

most from uwe.
 1.41 03-Jun-2018  christos branches: 1.41.2;
restore \n printing.
 1.40 03-Jun-2018  christos use a more data-driven :-) approach to avoid cut-n-pasted code.
 1.39 03-Jun-2018  ryoon Enable Synaptics multifinger capability (Extended W mode)

Magic parameters are taken from
https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/.
Tested on HP ProBook 4630s, Lenovo E530, VAIO Pro 11 and HP Spectre x360 ae.
 1.38 30-May-2018  ryoon Remove double and trailing whitespaces
 1.37 29-May-2018  ryoon Remove trailing tab
 1.36 05-Dec-2017  jmcneill branches: 1.36.2;
Add hw.synaptics.movement_enable sysctl. Default value is 1, but if set
to 0 disables movement events from the touchpad.

While here, fixup a few sysctl nodenum comparisons in
pms_sysctl_synaptics_verify to compare against node numbers instead of
values.
 1.35 07-Nov-2017  ryoon Return res in non-synaptics case like before. Fix ALPS case
 1.34 06-Nov-2017  blymn Add two finger support and middle/right button emulation.
 1.33 04-Mar-2015  christos Fix clickpad button detection (From Rhialto)
 1.32 23-May-2014  christos branches: 1.32.2; 1.32.4;
PR/48831: J�rg Grundmann: Synaptics Touch pad (ClickPad) and
Klick-by-tap-gestures do not work
 1.31 25-Feb-2014  pooka branches: 1.31.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.30 03-Jun-2012  dsl branches: 1.30.2; 1.30.4;
Remove a couple of (void *) casts added in the previous commin.
They aren't needed here (script error).
 1.29 02-Jun-2012  dsl Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.28 10-Sep-2011  jakllsch branches: 1.28.2;
Correct and improve some comments. Collect unused variables. Add a define.
 1.27 09-Sep-2011  jakllsch Replace pms_synaptics_send_command() and identical pms_elantech_send_command()
with pms_sliced_command(). Linux shows that this sequence can also be used by
"Logitech PS/2++" protocol as well.
 1.26 29-Jan-2011  cegger use aprint_debug_dev and get rid of SYNAPTICSDEBUG
 1.25 15-Nov-2010  uebayasi branches: 1.25.2; 1.25.4;
wakeup needs sys/proc.h.
 1.24 21-Mar-2010  plunky send the SET_SCALE11 command before the 'sliced' command as per the
Linux driver (and elantech(4)), via PR kern/42853
 1.23 21-Mar-2010  plunky Extended capability probes can confuse the passthrough device,
reset the touchpad on enable to cure that.
 1.22 21-Mar-2010  plunky some definitions from the Linux driver (via PR kern/42853)
 1.21 30-Apr-2008  ad branches: 1.21.10; 1.21.20; 1.21.22;
Make various bits of debug code compile again.
 1.20 15-Mar-2008  cube branches: 1.20.2; 1.20.4;
Split device_t and softc for pckbd(4) and pms(4).
 1.19 28-Jan-2008  jmcneill branches: 1.19.2; 1.19.6;
Change synaptics 'unusual delay' printf to aprint_debug. I'm tired of
seeing it over and over again.
 1.18 28-Jan-2008  jmcneill De-noisify resume handler.
 1.17 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.16 19-Oct-2007  ad branches: 1.16.2; 1.16.4; 1.16.6; 1.16.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 25-Mar-2007  mlelstv branches: 1.15.8; 1.15.10; 1.15.14;
add missing W coordinate
 1.14 25-Mar-2007  mlelstv Handle events from passthrough devices like the Thinkpad 'Navistick'.
 1.13 16-Nov-2006  christos branches: 1.13.2; 1.13.4; 1.13.8; 1.13.10; 1.13.12;
__unused removal on arguments; approved by core.
 1.12 12-Nov-2006  plunky Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.11 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.10 07-Jun-2006  kardel branches: 1.10.6; 1.10.8;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.9 24-Dec-2005  perry branches: 1.9.4; 1.9.6; 1.9.8; 1.9.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 26-Oct-2005  rpaulo s/SYNAPTICS_DEBUG/SYNAPTICSDEBUG/ to keep consistency.
 1.6 20-Jun-2005  atatat branches: 1.6.2; 1.6.4;
Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone. Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
 1.5 27-Feb-2005  perry nuke trailing whitespace
 1.4 18-Jan-2005  scw branches: 1.4.2;
Address PR kern/28990 by making Synaptics Touchpad support contingent
on "options PMS_SYNAPTICS_TOUCHPAD" in the kernel config file. See
the PR for details on why this is necessary.

While here, defflag PMS_DISABLE_POWERHOOK.
 1.3 02-Jan-2005  scw branches: 1.3.2; 1.3.4;
Major re-write of the recently-committed Synaptics Touchpad driver,
prompted by jittery and/or random movement during tap gestures, lack
of edge motion, and a general desire to make use of the extra features
available with the native protocol.

- Ditch the kernel thread; it was overkill for the small amount of
processing required to deal with touchpad events.

- If we fail to probe a Synaptics touchpad, issue a RESET command
to ensure that whatever device is out there is left in a sane
state (thanks to Reinoud Zandijk for the hint).

- Completely re-write gesture support.

- Put the touchpad in 80 packets per second mode and count them so
they can be used to time gesture durations (instead of using
mono_time).

- Enhance up/down button support with options to use them to emulate
the middle button or Z-axis events (like a traditional wheel mouse).

- Add 'edge motion'. If a drag gesture is in progress, and the reported
finger position moves to the touchpad's border region, continue
to report movement events at a fixed rate as if the finger carried
on moving in the same direction. This restores some functionality
usually provided by the touchpad's firmware in PS/2 mode.

- Filter successive movement events to reduce jitter. When scaling
movement events, fold the remainder into the next event to prevent
loss of information during slow/small finger movements. Pointer
movement is now much more refined.

- Add support for touchpads which can report more than one finger on
the pad simultaneously. Optionally use this feature for middle/right
button emulation (i.e. tap two fingers to emulate middle button).
This feature is disabled by default (for now) to avoid surprise
pasting of clipboard text. ;-)
 1.2 28-Dec-2004  christos - cleanup some debugging stuff.
- don't create the sysctl nodes if we don't have a synaptics pad.
 1.1 24-Dec-2004  christos PR/28774: Kentaro A. Kurahone: Add synaptics touchpad driver
 1.3.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.4.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.3 24-Jan-2005  skrll Sync with HEAD.
 1.3.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.3.4.1 02-Jan-2005  skrll file synaptics.c was added on branch ktrace-lwp on 2005-01-17 19:31:51 +0000
 1.3.2.1 29-Apr-2005  kent sync with -current
 1.4.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.4.1 02-Nov-2005  yamt sync with head.
 1.6.2.7 17-Mar-2008  yamt sync with head.
 1.6.2.6 04-Feb-2008  yamt sync with head.
 1.6.2.5 21-Jan-2008  yamt sync with head
 1.6.2.4 27-Oct-2007  yamt sync with head.
 1.6.2.3 03-Sep-2007  yamt sync with head.
 1.6.2.2 30-Dec-2006  yamt sync with head.
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.9.14.1 19-Jun-2006  chap Sync with head.
 1.9.8.1 26-Jun-2006  yamt sync with head.
 1.9.6.2 24-Apr-2006  kardel remove int s; (for spl level) as time counter conversion makes
that obsolete.
 1.9.6.1 04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.8.2 10-Dec-2006  yamt sync with head.
 1.10.8.1 22-Oct-2006  yamt sync with head
 1.10.6.1 18-Nov-2006  ad Sync with head.
 1.13.12.1 29-Mar-2007  reinoud Pullup to -current
 1.13.10.1 11-Jul-2007  mjf Sync with head.
 1.13.8.2 23-Oct-2007  ad Sync with head.
 1.13.8.1 10-Apr-2007  ad Sync with head.
 1.13.4.1 15-Apr-2007  yamt sync with head.
 1.13.2.1 01-Apr-2007  bouyer Pull up following revision(s) (requested by mlelstv in ticket #550):
sys/dev/pckbport/synaptics.c: revisions 1.14, 1.15
Handle events from passthrough devices like the Thinkpad
'Navistick'.
add missing W coordinate
 1.15.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.10.3 23-Mar-2008  matt sync with HEAD
 1.15.10.2 09-Jan-2008  matt sync with HEAD
 1.15.10.1 06-Nov-2007  matt sync with HEAD
 1.15.8.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.16.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.16.6.1 11-Dec-2007  yamt sync with head.
 1.16.4.1 26-Dec-2007  ad Sync with head.
 1.16.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.19.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.19.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.2.1 24-Mar-2008  keiichi sync with head.
 1.20.4.2 11-Aug-2010  yamt sync with head.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.22.2 05-Mar-2011  rmind sync with head
 1.21.22.1 30-May-2010  rmind sync with head
 1.21.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.21.10.1 20-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1383):
sys/dev/pckbport/synapticsreg.h: revision 1.6
sys/dev/pckbport/synaptics.c: revision 1.22
sys/dev/pckbport/synaptics.c: revision 1.23
sys/dev/pckbport/synaptics.c: revision 1.24
some definitions from the Linux driver (via PR kern/42853)
Extended capability probes can confuse the passthrough device,
reset the touchpad on enable to cure that.
send the SET_SCALE11 command before the 'sliced' command as per the
Linux driver (and elantech(4)), via PR kern/42853
 1.25.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.25.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30.4.1 18-May-2014  rmind sync with head
 1.30.2.2 03-Dec-2017  jdolecek update from HEAD
 1.30.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.2.1 10-Aug-2014  tls Rebase.
 1.32.4.1 06-Apr-2015  skrll Sync with HEAD
 1.32.2.1 21-Mar-2015  snj Pull up following revision(s) (requested by nonaka in ticket #629):
sys/dev/pckbport/synaptics.c: revision 1.33
Fix clickpad button detection (From Rhialto)
 1.36.2.4 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.36.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.36.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.36.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.41.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.41.2.1 10-Jun-2019  christos Sync with HEAD
 1.50.4.1 29-Feb-2020  ad Sync with head.
 1.50.2.8 30-Dec-2021  martin Pull up following revision(s) (requested by riastradh in ticket #1397):

sys/dev/pckbport/synaptics.c: revision 1.71

synaptics(4): New sysctl knob for debug output.

Set hw.synaptics.debug=1 to re-enable it; the compile-time DIAGNOSTIC
option was inappropriate for this.
 1.50.2.7 08-Oct-2020  martin Pull up following revision(s) (requested by nia in ticket #1100):

sys/dev/pckbport/synaptics.c: revision 1.69
sys/dev/pckbport/synaptics.c: revision 1.70
share/man/man4/pms.4: revision 1.38

erect a signpost for weary travellers

synaptics: Emulate scrolling when the middle button is held with TrackPoints
idea stolen from various other operating systems.

this configurable with a sysctl in case somebody wants to hold the middle
button, e.g. with old window managers that close menus when a button is
released.
 1.50.2.6 20-Jun-2020  martin Pull up following revision(s) (requested by nia in ticket #954):

sys/dev/pckbport/synaptics.c: revision 1.67

synaptics: Don't reset the device multiple times in succession
Cherrypicked from a patch from an anonymous contributor.
 1.50.2.5 29-Apr-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #865):

sys/dev/pckbport/synaptics.c: revision 1.66

pms_synaptics_enable: no need to send PMS_DEV_ENABLE here because
pms_enable does this for us. Seems to resolve issues with my trackpoint
not working immediately after starting X on ThinkPad X260.
 1.50.2.4 28-Apr-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #863):

sys/dev/pckbport/synaptics.c: revision 1.65
sys/dev/pckbport/synapticsvar.h: revision 1.10

Extended buttons are reported separate from touchpad buttons, so track
button press / release state separate from touch events.
 1.50.2.3 02-Apr-2020  martin Pull up following revision(s) (requested by nia in ticket #818):

sys/dev/pckbport/synaptics.c: revision 1.64

synaptics: Maintain the left/right buttons when up/down are remapped
Reported on current-users by Mandacar� Cascavel
 1.50.2.2 30-Mar-2020  martin Pull up following revision(s) (requested by nia in ticket #810):

sys/dev/pckbport/synaptics.c: revision 1.57
sys/dev/pckbport/synaptics.c: revision 1.58

synaptics: Allow the max_speed sysctls to be set
synaptics: fix syntax
 1.50.2.1 30-Mar-2020  martin Pull up following revision(s) (requested by nia in ticket #809):

sys/dev/pckbport/synaptics.c: revision 1.55
sys/dev/pckbport/synaptics.c: revision 1.56
share/man/man4/pms.4: revision 1.35
share/man/man4/pms.4: revision 1.36

synaptics: Make up_down_emulation useful for single-button clickpads

On devices such as the Thinkpad X250, the clickpad can be pressed
to generate mouse button events 1 and 2. There are also additional
physical buttons which the pms(4) driver recognizes as "up/down" buttons
(mouse buttons 3 and 4). Allow these to be remapped to buttons 1 and 2
and used like normal touchpad buttons with the following sysctl:

While here, adjust the existing "middle button emulation"
(hw.synaptics.up_down_emulation=1) so it works with single-button
clickpads.

XXX: 3 may be a more useful default than the current default,
depending on hardware availability of touchpads with "up/down buttons".

Update the documentation accordingly.

synaptics: Set up_down_emulation=3 by default.

It's a less surprising default for modern hardware.
 1.70.8.1 31-May-2021  cjep sync with head
 1.70.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.81.4.1 22-Jun-2024  martin Pull up following revision(s) (requested by gutteridge in ticket #718):

sys/dev/pckbport/synaptics.c: revision 1.83

Renamed border/boundary variables to better describe their use.

Fix edge default values, factor out percentage calculation for more
consistent
values. Use device_printf/DPRINTF to show errors instead of aprint
variants.

Print raw input for debugging.

Correct capability parsing. Old devices were probed with nonexistent
commands and then used undefined boundary values that made them
unusuable.

Fixes PR 57874.
 1.83.2.1 02-Aug-2025  perseant Sync with HEAD
 1.14 10-Nov-2024  mlelstv Define 'query resolution' command and submodel capability field.
 1.13 03-Mar-2022  blymn branches: 1.13.10;

Fix for PR kern/56613

* For trackpads that report max and min coordinates, retrieve these and
use them as the boundaries instead of the hard coded limits.
* Drop packets that are have x/y values that are outside the limits of
the trackpad. Some trackpads report a stream of low values in some
situations that cause cursor jumping.
 1.12 02-Jun-2019  blymn Changes based on code from an anonymous contributor. This should make
trackpads work for Thinkpads. Also adds code to handle externally
connected buttons (synaptics parlance), the first five are mapped to
mouse buttons 1-5. The rest are currently not reported but could be
decoded if required.
 1.11 22-Apr-2019  blymn Modify driver to use bits(3) to extract capabilities. Thanks to
Anon Ymous for the fix.
 1.10 14-Jul-2018  maya Send the 'magic reverse engineered sequence' with a single sliced command,
don't wait for individual ACKs. Fixes kern/53444.

While here:
- use better descriptive names for functions
- use a function for the extended write command
- add macro for number from the old synaptics documentation
- don't get the resp from the command sequence if we're going to ignore
it anyway

most from uwe.
 1.9 06-Nov-2017  blymn branches: 1.9.2; 1.9.4;
Add two finger support and middle/right button emulation.
 1.8 23-May-2014  christos PR/48831: J�rg Grundmann: Synaptics Touch pad (ClickPad) and
Klick-by-tap-gestures do not work
 1.7 10-Sep-2011  jakllsch branches: 1.7.12; 1.7.26;
Correct and improve some comments. Collect unused variables. Add a define.
 1.6 21-Mar-2010  plunky some definitions from the Linux driver (via PR kern/42853)
 1.5 17-Jan-2007  uwe branches: 1.5.44; 1.5.56; 1.5.66; 1.5.68;
Don't call queries "PS/2 commands", it's confusing.
Add queries to read mode and model id (not used yet).
Fix SYNAPTICS_CAP_EXTNUM - it's 3 bits [14:12], not 2.
 1.4 11-Dec-2005  christos branches: 1.4.20;
merge ktrace-lwp.
 1.3 27-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 02-Jan-2005  scw branches: 1.2.2; 1.2.4; 1.2.6;
Major re-write of the recently-committed Synaptics Touchpad driver,
prompted by jittery and/or random movement during tap gestures, lack
of edge motion, and a general desire to make use of the extra features
available with the native protocol.

- Ditch the kernel thread; it was overkill for the small amount of
processing required to deal with touchpad events.

- If we fail to probe a Synaptics touchpad, issue a RESET command
to ensure that whatever device is out there is left in a sane
state (thanks to Reinoud Zandijk for the hint).

- Completely re-write gesture support.

- Put the touchpad in 80 packets per second mode and count them so
they can be used to time gesture durations (instead of using
mono_time).

- Enhance up/down button support with options to use them to emulate
the middle button or Z-axis events (like a traditional wheel mouse).

- Add 'edge motion'. If a drag gesture is in progress, and the reported
finger position moves to the touchpad's border region, continue
to report movement events at a fixed rate as if the finger carried
on moving in the same direction. This restores some functionality
usually provided by the touchpad's firmware in PS/2 mode.

- Filter successive movement events to reduce jitter. When scaling
movement events, fold the remainder into the next event to prevent
loss of information during slow/small finger movements. Pointer
movement is now much more refined.

- Add support for touchpads which can report more than one finger on
the pad simultaneously. Optionally use this feature for middle/right
button emulation (i.e. tap two fingers to emulate middle button).
This feature is disabled by default (for now) to avoid surprise
pasting of clipboard text. ;-)
 1.1 24-Dec-2004  christos PR/28774: Kentaro A. Kurahone: Add synaptics touchpad driver
 1.2.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.4.3 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.2.4.1 02-Jan-2005  skrll file synapticsreg.h was added on branch ktrace-lwp on 2005-01-17 19:31:51 +0000
 1.2.2.1 29-Apr-2005  kent sync with -current
 1.3.4.1 26-Feb-2007  yamt sync with head.
 1.4.20.1 01-Feb-2007  ad Sync with head.
 1.5.68.1 30-May-2010  rmind sync with head
 1.5.66.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.5.56.1 20-Nov-2010  riz Pull up following revision(s) (requested by plunky in ticket #1383):
sys/dev/pckbport/synapticsreg.h: revision 1.6
sys/dev/pckbport/synaptics.c: revision 1.22
sys/dev/pckbport/synaptics.c: revision 1.23
sys/dev/pckbport/synaptics.c: revision 1.24
some definitions from the Linux driver (via PR kern/42853)
Extended capability probes can confuse the passthrough device,
reset the touchpad on enable to cure that.
send the SET_SCALE11 command before the 'sliced' command as per the
Linux driver (and elantech(4)), via PR kern/42853
 1.5.44.1 11-Aug-2010  yamt sync with head.
 1.7.26.1 10-Aug-2014  tls Rebase.
 1.7.12.2 03-Dec-2017  jdolecek update from HEAD
 1.7.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.4.1 10-Jun-2019  christos Sync with HEAD
 1.9.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.13.10.1 02-Aug-2025  perseant Sync with HEAD
 1.14 01-Apr-2022  blymn Fix regression introduced when fixing PR kern/56613 and related tweaks

* A trackpad with external buttons needs to mask a number of lower bits
of the X and Y coordinates IFF a button is down. This was not being
done so a button held down looked like an out of range packet and
was therefore dropped.

* Now that trackpads are probed for their boundaries make the emulated
button boundary settable by a percentage, also allow the right and
bottom boundaries to be adjusted by a percentage to allow for
horizontal and vertical scroll regions.
 1.13 03-Mar-2022  blymn Fix for PR kern/56613

* For trackpads that report max and min coordinates, retrieve these and
use them as the boundaries instead of the hard coded limits.
* Drop packets that are have x/y values that are outside the limits of
the trackpad. Some trackpads report a stream of low values in some
situations that cause cursor jumping.
 1.12 21-Oct-2021  blymn Significant update to the synaptics touchpad driver.

* Accumulate packets for primary, secondary, finger count packets
before handing off to pms_synaptics_process_packet. This means
that both primary and, possibly, secondary finger locations will
be processed at the same time. Previously the processing each
packet as it arrived.

* Fix the secondary finger position reporting, there was an off by
one in the shifts when decoding which effectively halved the
reported position.

* For a clickpad, make the emulated button region "dead" so that finger
movements in this region are ignored. This makes it easier to click
a button without accidentally repositioning the cursor. There is a
sysctl variable "button_region_movement_enable" that will allow
these finger movements to be reported if this is desirable.

* Reset the finger ballistics when the number of fingers changes. This
stops the annoying position jumps when a second finger touch is added
to or removed from the touchpad.

* Add a level argument to the DPRINTF macro so one can choose their
level of debug spam via the debug sysctl variable.
 1.11 30-Jun-2021  blymn Fix hardcoded size for total_patckets array in synaptics_softc, it
needs to be SYN_MAX_FINGERS because the driver expects it to be.
 1.10 27-Apr-2020  jmcneill branches: 1.10.6;
Extended buttons are reported separate from touchpad buttons, so track
button press / release state separate from touch events.
 1.9 02-Jun-2019  blymn branches: 1.9.2;
Changes based on code from an anonymous contributor. This should make
trackpads work for Thinkpads. Also adds code to handle externally
connected buttons (synaptics parlance), the first five are mapped to
mouse buttons 1-5. The rest are currently not reported but could be
decoded if required.
 1.8 06-Nov-2018  blymn Add double finger scroll feature. If the detected width is between a
defined range then report y movement as z-axis. Effectively emulating
a mouse scroll wheel.
 1.7 06-Nov-2017  blymn branches: 1.7.2; 1.7.4;
Add two finger support and middle/right button emulation.
 1.6 23-May-2014  christos PR/48831: J�rg Grundmann: Synaptics Touch pad (ClickPad) and
Klick-by-tap-gestures do not work
 1.5 10-Sep-2011  jakllsch branches: 1.5.12; 1.5.26;
Correct and improve some comments. Collect unused variables. Add a define.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 27-Feb-2005  perry nuke trailing whitespace
 1.2 02-Jan-2005  scw branches: 1.2.2; 1.2.4; 1.2.6;
Major re-write of the recently-committed Synaptics Touchpad driver,
prompted by jittery and/or random movement during tap gestures, lack
of edge motion, and a general desire to make use of the extra features
available with the native protocol.

- Ditch the kernel thread; it was overkill for the small amount of
processing required to deal with touchpad events.

- If we fail to probe a Synaptics touchpad, issue a RESET command
to ensure that whatever device is out there is left in a sane
state (thanks to Reinoud Zandijk for the hint).

- Completely re-write gesture support.

- Put the touchpad in 80 packets per second mode and count them so
they can be used to time gesture durations (instead of using
mono_time).

- Enhance up/down button support with options to use them to emulate
the middle button or Z-axis events (like a traditional wheel mouse).

- Add 'edge motion'. If a drag gesture is in progress, and the reported
finger position moves to the touchpad's border region, continue
to report movement events at a fixed rate as if the finger carried
on moving in the same direction. This restores some functionality
usually provided by the touchpad's firmware in PS/2 mode.

- Filter successive movement events to reduce jitter. When scaling
movement events, fold the remainder into the next event to prevent
loss of information during slow/small finger movements. Pointer
movement is now much more refined.

- Add support for touchpads which can report more than one finger on
the pad simultaneously. Optionally use this feature for middle/right
button emulation (i.e. tap two fingers to emulate middle button).
This feature is disabled by default (for now) to avoid surprise
pasting of clipboard text. ;-)
 1.1 24-Dec-2004  christos PR/28774: Kentaro A. Kurahone: Add synaptics touchpad driver
 1.2.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.4.3 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.2.4.1 02-Jan-2005  skrll file synapticsvar.h was added on branch ktrace-lwp on 2005-01-17 19:31:52 +0000
 1.2.2.1 29-Apr-2005  kent sync with -current
 1.5.26.1 10-Aug-2014  tls Rebase.
 1.5.12.2 03-Dec-2017  jdolecek update from HEAD
 1.5.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.4.1 10-Jun-2019  christos Sync with HEAD
 1.7.2.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.9.2.1 28-Apr-2020  martin Pull up following revision(s) (requested by jmcneill in ticket #863):

sys/dev/pckbport/synaptics.c: revision 1.65
sys/dev/pckbport/synapticsvar.h: revision 1.10

Extended buttons are reported separate from touchpad buttons, so track
button press / release state separate from touch events.
 1.10.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.36 24-May-2025  nia wskbd(4): Define USB and PS/2 keymaps for KB_PL

This is the de-facto standard "Polish programmers" QWERTY keyboard,
what X11 simply calls "Polish". It's a simple variation of US QWERTY
with some extra characters when right alt is pressed.

Defining this layout is slightly optimistic, since even with latin-2
fonts loaded and the appropriate locale set, wscons seems to struggle
to input most of these characters.

Regardless, this allows the supposedly supported "pl" encoding
to not fail loading with an error message, and allows X11 to
auto-detect the keyboard layout (defining KB_PL and as an alias of
KB_US also accomplishes this goal), with room for proper UTF-8
support in the future.

PR port-amd64/57234 "# wsconsctl -k -w encoding=pl" *should* work.
PR kern/57844 wscons doesn't support encoding=pl contrary to wskbd(4) man page
PR install/58405 Selecting Polish keyboard type in sysinst is useless
 1.35 22-Sep-2021  nia branches: 1.35.10;
wscons: add definitions for BÉPO, a standardized, Dvorak-style optimized
keyboard layout for French
 1.34 11-May-2021  nia wscons: add support for the Neo 2 German keyboard layout

Neo is an optimized layout for German and English, similar to
Dvorak for English. It can be used to type most Latin-based languages
and has separate layers for symbols and directional commands.
 1.33 13-Jul-2020  nia branches: 1.33.6; 1.33.8;
Canadian French keyboard layout for ukbd/pckbd
 1.32 13-Jul-2020  nia Add keyboard layout for Latin American Spanish to ukbd/pckbd
 1.31 12-Jul-2020  nia Add Icelandic keyboard layout to ukbd/pckbd.
 1.30 12-Jul-2020  nia Add Estonian layout as a variation of Swedish for ukbd and pckbd
 1.29 12-Jul-2020  nia Bring br.nodead closer to X11
 1.28 12-Jul-2020  nia Add support for the Brazilian keyboard layout to pckbd and ukbd.

This is significantly different from the European Portugese layout,
and was pieced together from Wikipedia, X11 layout files, and to
some extent with trial and error.

Thanks to lun-4 for helping test this.

PR kern/44570
 1.27 11-Jan-2020  nia Support the combination of KB_SWAPCTRLCAPS and UK layout.
 1.26 19-Feb-2018  maya branches: 1.26.4; 1.26.10; 1.26.12;
Add Turkish keyboard layout.

from berte in PR kern/53011.
 1.25 14-Jul-2014  mbalmer branches: 1.25.20;
Add a belgian keyboard layout, based on the french keyboard layout.
Fixes PR install/46871.
 1.24 11-Jun-2014  riastradh Nuke trailing whitespace.
 1.23 13-Oct-2012  jdc branches: 1.23.10;
Add the extra keys found on the Tadpole SPARCle to the keysym list.
 1.22 22-Jul-2011  christos branches: 1.22.2; 1.22.8; 1.22.12;
fixes from gilbert dot fernandes at orange dot fr
 1.21 22-Jul-2011  christos fixes from OpenBSD
 1.20 22-Jul-2011  christos PR/35473: Wigcher Spanninga: Add Dutch keyboard support to wscons
 1.19 28-Jul-2009  ahoka Add hungarian qwertz keyboard layout.
 1.18 13-Jun-2009  tonnerre Add support for Swiss german kezboard to wskbd.

Contributed by Marc Balmer.
 1.17 06-Apr-2009  mkirby Add a Czech (QWERTY) keyboard layout, and teach wscons about latin 2 characters.

Original code from Lubomir Kundrak, adapted to current and cleaned up by me.

Fixes PR kern/16216

ok agc@ jdc@
 1.16 03-Feb-2009  ghen branches: 1.16.2;
Enable Colemak altgr keys.
 1.15 21-May-2008  ghen branches: 1.15.6; 1.15.8;
Add support for the Colemak keyboard layout variant, see http://colemak.com
 1.14 28-Apr-2008  martin branches: 1.14.2;
Remove clause 3 and 4 from TNF licenses
 1.13 06-Jan-2008  christos branches: 1.13.6; 1.13.8; 1.13.10;
defflag one moe variable.
 1.12 09-Dec-2007  jmcneill branches: 1.12.2;
Merge jmcneill-pm branch.
 1.11 01-Apr-2006  christos branches: 1.11.12; 1.11.26; 1.11.32; 1.11.34; 1.11.40; 1.11.44; 1.11.46;
Greek console keymap from Eye of the Beholder
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
merge ktrace-lwp.
 1.9 05-May-2005  abs branches: 1.9.2;
Fix for portuguese keymap '4' and '+' keys, from Rui Paulo
 1.8 24-Apr-2005  abs Fix for Portuguese keymap from Rui Paulo
 1.7 27-Feb-2005  perry branches: 1.7.2;
nuke trailing whitespace
 1.6 11-Jan-2005  uwe branches: 1.6.2; 1.6.4;
Add KB_ES | KB_MACHDEP placeholder for Jornada 680/690 Spanish (ABE).
 1.5 04-Oct-2004  hubertf Add & document WSKBD_USONLY: In order to strip down the space usage of wscons,
all keymaps except the US english one can be removed from the kernel
with this option, which results in a space gain of about 10kB.

XXX it would be nice if we could strip down more kernel facilities
 1.4 14-Aug-2004  mycroft Allow keypad PgUp/PgDn to scroll as well.
 1.3 08-Aug-2004  christos by popular demand, bind the scroll keys by default.
 1.2 17-Mar-2004  uwe branches: 1.2.2; 1.2.4;
Add KB_FR | KB_MACHDEP placeholder. Need it for the Jornada 680/690
French (ABF) keyboard layout (to be enabled soon).
 1.1 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.2.4.10 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.4.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.8 17-Jan-2005  skrll Sync with HEAD.
 1.2.4.7 19-Oct-2004  skrll Sync with HEAD
 1.2.4.6 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.5 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.4 25-Aug-2004  skrll Sync with HEAD.
 1.2.4.3 12-Aug-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 17-Mar-2004  skrll file wskbdmap_mfii.c was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.2.2.2 22-Aug-2004  tron branches: 1.2.2.2.2;
Pull up revision 1.4 (requested by recht in ticket #774):
Allow keypad PgUp/PgDn to scroll as well.
 1.2.2.1 22-Aug-2004  tron Pull up revision 1.3 (requested by recht in ticket #774):
by popular demand, bind the scroll keys by default.
 1.2.2.2.2.1 16-May-2005  riz Pull up revisions 1.8-1.9 (requested by abs in ticket #1506):
Fix for Portuguese keymap from Rui Paulo

Fix for portuguese keymap '4' and '+' keys, from Rui Paulo
 1.6.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.2.1 29-Apr-2005  kent sync with -current
 1.7.2.2 09-May-2005  tron Pull up revision 1.9 (requested by abs in ticket #268):
Fix for portuguese keymap '4' and '+' keys, from Rui Paulo
 1.7.2.1 09-May-2005  tron Pull up revision 1.8 (requested by abs in ticket #268):
Fix for Portuguese keymap from Rui Paulo
 1.9.2.2 21-Jan-2008  yamt sync with head
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.10.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.10.10.1 19-Apr-2006  elad sync with head.
 1.10.8.1 11-Apr-2006  yamt sync with head
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.46.1 11-Dec-2007  yamt sync with head.
 1.11.44.1 26-Dec-2007  ad Sync with head.
 1.11.40.1 18-Feb-2008  mjf Sync with HEAD.
 1.11.34.1 09-Jan-2008  matt sync with HEAD
 1.11.32.1 03-Aug-2007  jmcneill Pull in power management changes from private branch.
 1.11.26.1 04-Sep-2008  skrll Sync with netbsd-4.
 1.11.12.1 08-Jun-2008  bouyer Pull up following revision(s) (requested by ghen in ticket #1155):
sys/dev/wscons/wsksymdef.h: revision 1.61
x11/bin/xkbcomp/symbols/pc/Makefile: revision 1.5
sys/dev/sun/wskbdmap_sun.c: revision 1.15
x11/bin/xkbcomp/symbols/Makefile: revision 1.6
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.15
share/man/man4/pckbd.4: revision 1.15
distrib/sets/lists/xbase/mi: revision 1.57
sys/dev/usb/ukbdmap.c: revision 1.20
distrib/sets/lists/xbase4/mi: revision 1.21
xsrc/xfree/xc/programs/xkbcomp/symbols/colemak: revision 1.1
xsrc/xfree/xc/programs/xkbcomp/symbols/pc/colemak: revision 1.1
Add support for the Colemak keyboard layout variant, see http://colemak.com
 1.12.2.1 08-Jan-2008  bouyer Sync with HEAD
 1.13.10.4 19-Aug-2009  yamt sync with head.
 1.13.10.3 20-Jun-2009  yamt sync with head
 1.13.10.2 04-May-2009  yamt sync with head.
 1.13.10.1 16-May-2008  yamt sync with head.
 1.13.8.2 04-Jun-2008  yamt sync with head
 1.13.8.1 18-May-2008  yamt sync with head.
 1.13.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.8.6 08-Aug-2014  msaitoh Pull up following revision(s) (requested by mbalmer in ticket #1915):
sys/dev/usb/ukbdmap.c: revision 1.29
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.25
Add a belgian keyboard layout, based on the french keyboard layout.
Fixes PR install/46871.
 1.15.8.5 15-Nov-2009  snj Pull up following revision(s) (requested by mbalmer in ticket #1144):
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.18
Add support for Swiss german kezboard to wskbd.
Contributed by Marc Balmer.
 1.15.8.4 01-Nov-2009  bouyer Apply patch, requested by ahoka in ticket #1111:
sys/dev/pckbport/wskbdmap_mfii.c patch
sys/dev/wscons/wsksymdef.h patch
sys/dev/wscons/wskbdutil.c patch
Add hungarian keyboard layout.
 1.15.8.3 28-Oct-2009  bouyer Back out ticket #1111, it breaks the build.
 1.15.8.2 27-Oct-2009  bouyer Apply patch, requested by ahoka in ticket #1111:
sys/dev/pckbport/wskbdmap_mfii.c: patch
Add hungarian keyboard layout
 1.15.8.1 16-Feb-2009  snj branches: 1.15.8.1.4;
Pull up following revision(s) (requested by ghen in ticket #427):
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.16
sys/dev/usb/ukbdmap.c: revision 1.22
Enable Colemak altgr keys.
 1.15.8.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.15.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.15.6.1 03-Mar-2009  skrll Sync with HEAD.
 1.16.2.2 23-Jul-2009  jym Sync with HEAD.
 1.16.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.22.8.1 07-Aug-2014  msaitoh Pull up following revision(s) (requested by mbalmer in ticket #1099):
sys/dev/usb/ukbdmap.c: revision 1.29
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.25
Add a belgian keyboard layout, based on the french keyboard layout.
Fixes PR install/46871.
 1.22.2.1 30-Oct-2012  yamt sync with head
 1.23.10.1 10-Aug-2014  tls Rebase.
 1.25.20.1 11-Apr-2018  martin Pull up following revision(s) (requested by maya in ticket #735):

sys/dev/wscons/wsksymdef.h: revision 1.67
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.26

Add Turkish keyboard layout.

from berte in PR kern/53011.
 1.26.12.1 17-Jan-2020  ad Sync with head.
 1.26.10.2 13-Jul-2020  martin Pull up following revision(s) (requested by nia in ticket #1002):

sys/dev/wscons/wsksymdef.h: revision 1.68
sys/dev/wscons/wsksymdef.h: revision 1.69
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.28
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.29
sys/dev/hid/hidkbdmap.c: revision 1.10
share/man/man4/pckbd.4: revision 1.23
share/man/man4/wskbd.4: revision 1.18
share/man/man4/wskbd.4: revision 1.19
share/man/man4/pckbd.4: revision 1.25
sys/dev/wscons/wsksymdef.h: revision 1.70
sys/dev/wscons/wsksymdef.h: revision 1.71
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.30
sys/dev/wscons/wsksymdef.h: revision 1.72
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.31
sys/dev/wscons/wsksymdef.h: revision 1.73
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.32
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.33
sys/dev/hid/hidkbdmap.c: revision 1.4
sbin/wsconsctl/wsconsctl.8: revision 1.30
sys/dev/hid/hidkbdmap.c: revision 1.5
etc/wscons.conf: revision 1.20
sys/dev/hid/hidkbdmap.c: revision 1.6
etc/wscons.conf: revision 1.21
sys/dev/hid/hidkbdmap.c: revision 1.7
sys/dev/hid/hidkbdmap.c: revision 1.8
sys/dev/hid/hidkbdmap.c: revision 1.9

Add support for the Brazilian keyboard layout to pckbd and ukbd.

This is significantly different from the European Portugese layout,
and was pieced together from Wikipedia, X11 layout files, and to
some extent with trial and error.

Thanks to lun-4 for helping test this.

PR kern/44570
Update lists of keyboard layouts to add Turkish and Brazilian

Bring br.nodead closer to X11

Add Estonian layout as a variation of Swedish for ukbd and pckbd

Add KB_TR for uhid keyboards (it was PS/2 only, this seems wrong)

Add Icelandic keyboard layout to ukbd/pckbd.

Add keyboard layout for Latin American Spanish to ukbd/pckbd

Canadian French keyboard layout for ukbd/pckbd

Clarify that KB_TR is the "Q" layout - there's two standards for Turkish.

Move description of keyboard layouts to wskbd.4, add newer layouts

Previously, the best reference was pckbd.4. This does not make much
sense to read if you are on, say, an evbarm device with only USB.
wsconsctl.8 contained a vaguer description of supported language names,
which isn't very useful because you can't pass full language names
to the command. Point readers to wskbd.4 instead.

Note in the wskbd.4 page that while all layouts are generally supported
by pckbd(4) and ukbd(4), older keyboard interfaces might only support
a subset.

wskbd.4: Add KB_LA

Point readers at wskbd.4
 1.26.10.1 21-Jan-2020  martin Pull up following revision(s) (requested by nia in ticket #635):

sys/dev/pckbport/wskbdmap_mfii.c: revision 1.27
share/man/man4/pckbd.4: revision 1.22
sys/dev/hid/hidkbdmap.c: revision 1.2

Support the combination of KB_SWAPCTRLCAPS and UK layout.
Note some more layouts that work with KB_SWAPCTRLCAPS.
 1.26.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.33.8.1 31-May-2021  cjep sync with head
 1.33.6.1 13-May-2021  thorpej Sync with HEAD.
 1.35.10.1 02-Aug-2025  perseant Sync with HEAD
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.70; 1.2.72; 1.2.74;
merge ktrace-lwp.
 1.1 13-Mar-2004  bjh21 branches: 1.1.4;
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Mar-2004  skrll file wskbdmap_mfii.h was added on branch ktrace-lwp on 2004-08-03 10:50:14 +0000
 1.2.74.1 16-May-2008  yamt sync with head.
 1.2.72.1 18-May-2008  yamt sync with head.
 1.2.70.1 02-Jun-2008  mjf Sync with HEAD.

RSS XML Feed