History log of /freebsd-current/sys/dev/atkbdc/psm.c
Revision Date Author Comments
# 2bcef59d 19-Sep-2023 Gleb Smirnoff <glebius@FreeBSD.org>

psm: recognize post-IBM trackpoints on Thinkpads

Newer Thinkpads come with trackpoints from different vendors. They
are mostly compatible with the original one. Not sure all features
are going to work, but at least this fixes resume operation.

Tested on: Thinkpad X1 Carbon 7th Gen
Reviewed by: wulf, imp
Diffrential Revision: https://reviews.FreeBSD.org/D41871


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 7eb8fbfb 02-Aug-2023 Gordon Bergling <gbe@FreeBSD.org>

psm(4): Fix a typo in a source code comment

- s/diable/disable/

MFC after: 3 days


# 5173c996 13-Feb-2023 Mateusz Guzik <mjg@FreeBSD.org>

psm: ansify

Sponsored by: Rubicon Communications, LLC ("Netgate")


# 4a0db5e2 17-Nov-2022 Vladimir Kondratyev <wulf@FreeBSD.org>

evdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interface

of psm(4), ums(4) and sysmouse(4) drivers.
EVIOCGRAB ioctl execution on /dev/input/event# device node gains
exclusive access to this device to caller. It is used mostly for
development purposes and remote control software. See e.g.
https://reviews.freebsd.org/D30020 which is the reason of creation
of this change.

MFC after: 2 weeks
Tested by: corvink
Differential revision: https://reviews.freebsd.org/D30542


# 1c1e8836 06-May-2022 John Baldwin <jhb@FreeBSD.org>

atkbd/psm: Remove unused devclass arguments to DRIVER_MODULE.


# a6c09f20 21-Apr-2022 John Baldwin <jhb@FreeBSD.org>

psm: Swap the unit member in the softc for a device_t.

This entails various changes to make this driver more "modern"
(new-bus vs pre-new-bus) using device_log() and device_printf() rather
than psm%d. It also fixes the device_busy/unbusy calls to use sc->dev
directly rather than looking the device_t up via the devclass and
unit.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D35006


# 9b0eb550 06-Apr-2022 John Baldwin <jhb@FreeBSD.org>

psm: Remove write-only variables.


# bedf31ad 09-Sep-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Disable KVM switch "jitter" clamping for absolute touchpads.

r123442 introduced solution for clamping of PS/2 mice jitter when using
a KVM. Solution is to buffer mouse packets for 0.050ms if mouse activity
has not been seen for more than 0.5 seconds. Then flush that data to driver
if no validation errors found or drop the entire queue otherwise.

While it works well with relative devices it has issues with absolute ones
Depending on history buffering may results in delaying of the touch front
edge for 0.050ms that affects gesture processing (tap detection).

As absolute touchpads usually are built-in devices we can safely disable
bufferization and KVM jitter clamping to avoid such a delays.

MFC after: 2 weeks


# 744fcd5a 02-Sep-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

psm: Use evdev autorelease feature for Synaptics and Elantech drivers

MFC after: 2 weeks


# c21171af 02-Sep-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

psm: Enable touch-tracking for late Synaptics PS/2 touchpads.

They are true multitouch internally but Synaptics PS/2 protocol
limitations do not all allow to export touch identificators.

MFC after: 2 weeks


# f5998d20 14-Jul-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Probe Synaptics touchpad with active multiplexing mode enabled

if it is only multiplexed device. Also enable syncbit checks for them.
This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop.

Reported by: Tomasz "CeDeROM" CEDRO <tomek_AT_cedro_DOT_info>
MFC after: 1 month
PR: 253279
Differential revision: https://reviews.freebsd.org/D28502


# 5af73ad5 30-Nov-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

evdev: Remove useless "initial value" parameter from evdev_support_abs()

It can not be used for setting of state of multitouch events.
If necessary, use evdev_push_event() instead of it.


# 2ac1c192 22-Dec-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Always initialize Synaptics touchpad report range with defaults

Otherwise libinput refuses to recoginize some Synaptics touchpads with
"kernel bug: device has min == max on ABS_X" message in Xorg.log.

PR: 251149
Reported-by: Jens Grassel <freebsd-ports@jan0sch.de>
Tested-by: Jens Grassel <freebsd-ports@jan0sch.de>
MFC-after: 2 weeks


# b33ba834 19-Nov-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Disable AUX multiplexer probing on all Lenovo laptops.

Rudimentary AUX multiplexing support was added to kernel to make possible
touchpad initialization on some HP EliteBook laptops with trackpoint.

Disable multiplexer probing on all Lenovo laptops now as they use touchpad
pass-through port rather than AUX multiplexer to connect trackpoint and
at least two model (X120e and X121e) is known for getting PS/2 AUX port
dysfunctional after switching back to hidden multiplexing mode.

AUX MUX probing can be reenabled with setting of hw.psm.mux_disabled loader
tunable to 0.

PR: 249987
Reported by: jwb
MFC after: 2 weeks


# bf479e13 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

atkbdc: clean up empty lines in .c and .h files


# ec45be6c 01-Jun-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

[psm] Workaround active PS/2 multiplexor hang

which happens on some laptops after returning to legacy multiplexing mode
at initialization stage.

PR: 242542
Reported by: Felix Palmen <felix@palmen-it.de>
MFC after: 1 week


# 8137fb2e 01-Jun-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

[psm] Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled

PR: 246117
Reported by: Alexander Sieg <ports@xanderio.de>
MFC after: 1 week


# 1130dff9 26-Apr-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Fix wrong key-release event occuring after trackpoint use.

Some models of laptops e.g. "X1 Carbon 3rd Gen Thinkpad" have LRM buttons
wired as so called "Synaptic touchpads extended buttons" rather thah real
trackpoint buttons. Handle this case with merging of events from both
sources.

PR: 245877
Reported by: Raichoo <raichoo@googlemail.com>
MFC after: 1 week


# 7029da5c 26-Feb-2020 Pawel Biernacki <kaktus@FreeBSD.org>

Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718


# e88f22ff 04-Feb-2020 Kyle Evans <kevans@FreeBSD.org>

psm: use make_dev_s instead of make_dev

This most importantly reduces duplication, but it also removes any potential
race with usage of dev->si_drv1 since it's now set prior to the device being
constructed enough to be accessible.


# ee20e060 04-Feb-2020 Kyle Evans <kevans@FreeBSD.org>

psm: release resources on attach failure

In exactly 1/3 cases we'll release resources on failure; touch up the other
two to do so as well.


# 6d3c9bee 31-Dec-2019 Kyle Evans <kevans@FreeBSD.org>

psm: properly check for atkbdc_open failure

atkbdc_open can return NULL if the unit's out of bounds or the softc isn't
setup. Check it to be safe.


# 5a037b11 15-Jun-2019 Philip Paeps <philip@FreeBSD.org>

Add macOS-like three finger drag trackpad gesture to psm(4)

Submitted by: Yan Ka Chiu <nyan@myuji.xyz>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20648


# 2dd9a967 10-Jun-2019 Niclas Zeising <zeising@FreeBSD.org>

psm(4): Enable touchpads and trackpads by default

Enable synaptics and elantech touchpads, as well as IBM/Lenovo TrackPoints
by default, instead of having users find and toggle a loader tunable.
This makes things like two finger scroll and other modern features work out
of the box with X. By enabling these settings by default, we get a better
desktop experience in X, since xserver and evdev can make use of the more
advanced synaptics and elantech features.

Reviewed by: imp, wulf, 0mp
Approved by: imp
Sponsored by: B3 Init (zeising)
Differential Revision: https://reviews.freebsd.org/D20507


# 6c53fea7 08-Jun-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add extra sanity checks to Elantech trackpoint packet parser.

Add strict checks for unused bit states in Elantech trackpoint packet
parser to filter out spurious events produces by some hardware which
are detected as trackpoint packets. See comment on r328191 for example.

Tested by: Andrey Kosachenko <andrey.kosachenko@gmail.com>


# 8fa46200 08-Jun-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Fix Elantech trackpoint support.

Sign bits for X and Y motion data were taken from wrong places.

PR: 238291
Reported by: Andrey Kosachenko <andrey.kosachenko@gmail.com>
Tested by: Andrey Kosachenko <andrey.kosachenko@gmail.com>
MFC after: 2 weeks


# 3b11e3b6 03-Jun-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add natural scrolling support to sysmouse protocol

This change enables natural scrolling with two finger scroll enabled
and when user is using a trackpad (mouse and trackpoint are not affected).
Depending on trackpad model it can be activated with setting of
hw.psm.synaptics.natural_scroll or hw.psm.elantech.natural_scroll sysctl
values to 1.

Evdev protocol is not affected by this change too. Tune userland client
e.g. libinput to enable natural scrolling in that case.

Submitted by: nyan_myuji.xyz
Reviewed by: wulf
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20447


# 9a554d09 02-Jun-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add Elantech touchpad IC type 15 found on Thinkpad L480 laptops

PR: 238291
Submitted by: Andrey Kosachenko <andrey.kosachenko@gmail.com>
MFC after: 2 weeks


# e2e050c8 19-May-2019 Conrad Meyer <cem@FreeBSD.org>

Extract eventfilter declarations to sys/_eventfilter.h

This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions. The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended). Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped.


# bf33f20d 20-Apr-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): give names to synaptics commands

Submitted by: Ben LeMasurier <ben@crypt.ly>
MFC after: 2 weeks


# 0c8a9084 20-Apr-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): respect tap_disabled configuration with enabled Extended support

This fixes a bug where, even when hw.psm.tap_enabled=0, touchpad taps
were processed.
tap_enabled has three states: unconfigured, disabled, and enabled (-1, 0, 1).
To respect PR kern/139272, taps are ignored only when explicity disabled.

Submitted by: Ben LeMasurier <ben@crypt.ly> (initial version)
MFC after: 2 weeks


# 51319286 20-Apr-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): do not process gestures when palm is present

Ignoring of gesture processing when the palm is detected helps to reduce
some of the erratic pointer behavior.

This fixes regression introduced in r317814

Reported by: Ben LeMasurier <ben@crypt.ly>
MFC after: 2 weeks


# 232e4318 20-Apr-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add support for 4 and 5 finger touches in synaptics driver

While 4-th and 5-th finger positions are not exported through PS/2
interface, total number of touches is reported by MT trackpads.

MFC after: 2 weeks


# 5bff3b69 18-Jan-2019 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): detect Lenovo top-button clickpads

libinput has special handling for Lenovo ThinkPad *40 series, where it
treats clicks on the top button area as if they came from the TrackPoint:
https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html

Detect these devices and set the corresponding evdev property.

Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18676


# 80203cce 24-Nov-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add minimal support for active AUX port multiplexers

Active PS/2 multiplexing is a method for attaching up to four PS/2
pointing devices to a computer. Enabling of multiplexed mode allows
commands to be directed to individual devices using routing prefixes.
Multiplexed mode reports input with each byte tagged to identify
its source. This method differs from one currently supported by psm(4)
where so called guest device (trackpoint) is attached to special
interface located on the host device (touchpad) and latter performs
guest protocol conversion to special encapsulation packet format.

At present time active PS/2 multiplexing is used in some models of
HP laptops e.g. EliteBook 8560w, 9470m. Enabling of absolute operation
mode on such touchpads is connected with following problems:
1. Touchpad's port priority is lower than trackpoint's. That blocks
information queries thus prevents touchpad detection and configuration.
2. Touchpad and trackpoint have different protocol packet sizes and
sync bytes.

As PS/2 usage is on decline only minimal possible set of changes to
support Synaptics touchpad and generic mouses is implemented.
Active multiplexing mode is enabled only at probe stage to scan through
attached PS/2 devices to query and configure Synaptics touchpad.
After touchpad has been configured, mux is switched back to legacy
(hidden multiplexing) mode to perform normal interrupt-driven input
data processing. Overflow bit values rather than tags are used to
separate packets produced by different devices. Switching back to
legacy mode allows to avoid psm(4) and atkbd(4) rework to support
4 instances of mouse driver.

Note: While in hidden multiplexing mode KBC does some editing of the
packet stream. It remembers the button bits from the last packet
received from each device, and replaces the button bits of every
packet with the logical OR of all devices’ most recent button bits.
This sort of button crosstalk results in spurious button events
which are inhibitted with various tricks. E.g. trackpoint middle
button events are suppressed while trackpad surface is touched and
touchpad left and right button events are suppressed if corresponding
trackpoint buttons are pressed.

PR: 231058
Reported by: Michael Figiel <mifigiel@gmail.com>
Tested by: Michael Figiel <mifigiel@gmail.com>
MFC after: 2 weeks


# 51243092 24-Nov-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

Revert r328640: Add kludge for 0x46 identity middle byte Synaptics touchpads.

It appeared that "0x46 identity middle byte" response is caused by so called
"Active PS/2 multiplexing controller" presence. Support for it will be added
in next commit.


# 911aed94 13-Aug-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

evdev: remove soft context from evdev methods parameter list.

Now softc should be retrieved from struct edvev * pointer
with evdev_get_softc() helper.

wmt(4) is a sample of driver that support both KPI.

Reviewed by: hselasky, gonzo
Differential Revision: https://reviews.freebsd.org/D16614


# 67580198 10-Jun-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

Drop MOUSE_GETVARS and MOUSE_SETVARS ioctls support.

These ioctls are not documented and only stubbed in a few drivers: mse(4),
psm(4) and syscon's sysmouse(4). The only exception is MOUSE_GETVARS
implemented in psm(4)

Given the fact that they were introduced 20 years ago and implementation
has never been completed, remove any related code.

PR: 228718 (exp-run)
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D15726


# 34388a40 30-May-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Correct argument for evdev_push_rel().

This is a regression issue after r319162.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies


# 015ab098 06-Mar-2018 Conrad Meyer <cem@FreeBSD.org>

psm(4): Initialize variables before use

dxp/dyp could have been used uninitialized in the subsequent debugging log
invocation.

Reported by: Coverity
Sponsored by: Dell EMC Isilon


# 893daee6 28-Feb-2018 Conrad Meyer <cem@FreeBSD.org>

psm(4): Always initialize used values in debug print

'status' array passed to get_mouse_status() is usually uninitialized by
callers.

Fully populating it with values in get_mouse_status() can fail due to
read_aux_data().

Additionally, nothing in API constrains 'len' to be >= 3. In practice,
every caller passes three, so perhaps that argument should just be removed.
Refactoring is a larger change, though.

Remove use of potentially uninitialized values by:
1. Only printing 3 debug statuses if the passed array was at least
'len' >= 3;
2. Populating 'status' array up to first three elements, if read_aux_data()
failed.

No functional change intended.

Reported by: Coverity
Sponsored by: Dell EMC Isilon


# 74a53bd1 04-Feb-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Fix panic occuring soon after PS/2 packet has been rejected by
synaptics or elantech sanity checker.

After packet has been rejected contents of packet buffer is not cleared
with setting of inputbytes counter to 0. So when this packet buffer is
filled again being an element of circular queue, new data appends to old
data rather than overwrites it. This leads to packet buffer overflow
after 10 rounds.

Fix it with setting of packet's inputbytes counter to 0 after rejection.

While here add extra logging of rejected packets.

PR: 222667 (for reference)
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>
MFC after: 1 week


# f20ad0fa 31-Jan-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

psm: Add a kludge to support 0x46 identity middle byte Synaptics touchpads

Most synaptics touchpads return 0x47 in middle byte in responce to identify
command as stated in p.4.4 of "Synaptics PS/2 TouchPad Interfacing Guide".
But some devices e.g. found on HP EliteBook 9470m return 0x46 here.
Allow them to be identified as Synaptics as well as 0x47.
ExtendedQueries return incorrect data on such a touchpads so we ignore
their result and set conservative defaults.

PR: 222667
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>
Approved by: gonzo


# f451e005 31-Jan-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Reduce psm watchdog verbosity

Modern touchpads do not issue interrupts on inactivity so "lost interrupt"
message became annoying spam nowadays. This change quiets the message
if debug.psm.loglevel=5 (or less) is set in /boot/loader.conf

Approved by: gonzo


# 7d1460a4 31-Jan-2018 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add support for HP EliteBook 1040 ForcePads.

ForcePads do not have any physical buttons, instead they detect click
based on finger pressure. Forcepads erroneously report button click
if there are 2 or more fingers on the touchpad breaking multifinger
gestures. To workaround this start reporting a click only after
4 consecutive single touch packets has been received. Skip these packets
in case more contacts appear.

PR: 223369
Reported by: Neel Chauhan <neel@neelc.org>
Tested by: Neel Chauhan <neel@neelc.org>
Reviewed by: gonzo
Approved by: gonzo


# d6b66397 28-Jan-2018 Warner Losh <imp@FreeBSD.org>

Add ISA PNP tables to ISA drivers. Fix a few incidental comments.
ACPI ISA PBP tables not tagged, there's bigger issues with them.


# 90b0eb9b 20-Jan-2018 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

psm: Log syncmask[1], not syncmask[0] twice

MFC after: 1 week


# b9b766ae 20-Jan-2018 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

psm: Don't try to detect trackpoint packets if the Elantech device has none

This fixes a panic when `EVDEV_SUPPORT` is enabled: if a trackpoint
packet was detected but there was no trackpoint, we still tried to emit an
evdev event even though the associated relative evdev device (`evdev_r`)
was not initialized.

PR: 225339
MFC after: 1 week


# 9402bd96 20-Jan-2018 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

psm: Skip sync check when `PSM_CONFIG_NOCHECKSYNC` is set

In psmprobe(), we set the initial `syncmask` to the vendor default value
if the `PSM_CONFIG_NOCHECKSYNC` bit is unset. However, we currently only
set it for the Elantech touchpad later in psmattach(), thus `syncmask`
is always configured.

Now, we check `PSM_CONFIG_NOCHECKSYNC` and skip sync check if it is set.
This fixes Elantech touchpad support for units which have `hascrc` set.

To clarify that, when we log the `syncmask` and `syncbits` fields, also
mention if they are actually used.

Finally, when we set `PSM_CONFIG_NOCHECKSYNC`, clear `PSM_NEED_SYNCBITS`
flag.

PR: 225338
MFC after: 1 week


# 8352f326 19-Oct-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Add sanity checks to Synaptics touchpad driver resolution parser.

This fixes "Kernel has only x or y resolution, not both" libinput error.

Reported by: Ivan <bsd@abinet.ru>
Tested by: Ivan <bsd@abinet.ru>
Approved by: gonzo (mentor)
MFC after: 2 weeks


# 0f780042 29-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

psm: add support for evdev protocol

Both relative and absolute multitouch modes are supported.
To enable psm(4) evdev support one should:
1. Add `device evdev` and `options EVDEV_SUPPORT` to kernel config file
2. Add hw.psm.elantech_support=1 or hw.psm.synaptics_support=1 to
/boot/loader.conf for activation of absolute mode on touchpads
3. Add kern.evdev.rcpt_mask=12 to /etc/sysctl.conf to enable psm event
sourcing and disable sysmouse

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10265
Tested by: wulf, Jan Kokemueller (Lenovo devs)


# ae3b1e4a 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Reduce synaptics touch sensitivity

Increase hw.psm.synaptics.min_pressure default value from 16 to 32
to nearly match Linux driver (30-35 hysteresis loop).
This makes libinput tap detection more reliable.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks


# bc2b1516 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): Remove sys/libkern.h header inclusion

It is already included via sys/systm.h

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# 21cb8f62 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Set predefined logical touchpad sizes for several ancient Elan hw v.2
models. This change is based on Linux driver.
Determine logical trace size. It used for calculation of touch sizes
in surface units for MT-protocol type B evdev reports.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# 6c85d7cb 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Report 3-rd and 4-th fingers as first finger for Elan hw v.2 and v.3 as
Linux does. It should not affect gesture processing in current state as it
ignores finger coords on 3-finger tap detection but it should make evdev
reports looking more Linux-alike.

Reviewed by: gonzo
Approved by: gonzo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# eb658543 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Enable palm detection on two finger touches for multitouch trackpads.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# 848714bc 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

psm(4): reduce cursor jumping on palm detection

This is done with discarding pointer movements rather then mouse packets

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# 8a98c8c4 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Adjust Elantech palm width threshold to nearly match synaptics defaults

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# 51de77dd 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Reduce default tap_min_queue size for Elan touchpads

Elan hw v.4 touchpads often sends touchpad release packet right after
touchpad touch one. Most probably this happens due to PS/2 limited bandwith.
Reducing of tap_min_queue size to 1 makes multifinger tap detection
more reliable in this case.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# 933ef2d3 04-May-2017 Vladimir Kondratyev <wulf@FreeBSD.org>

Fix triple-finger taps reported as double-finger for Elan hw v.4 touchpads

Wait for all advertised head packets after status packet have been received.
This fixes rare but quite annoying issue in Elan hw v.4 touchpads support
when triple-finger taps are reported as double-finger taps under several
circumstances.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266


# f3bae0ea 14-Feb-2017 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

[psm] Fix calculation for clickpad softbuttons at the top

On laptops like the ThinkPad X240, ClickPad buttons are located at the
top. The hw.psm.synaptics.softbuttons_y sysctl was supposed to allow this
by setting the value to a negative one (e.g. -1700). However, the
condition was wrong (double negative), and doing that placed the buttons
in an unreachable area.

PR: 216342
Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 1 week


# dcc414b8 01-Nov-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

[psm] Fix choosing wrong mode for synaptic device + trackpoint

With guest trackpoint present trackpoint probing switched synaptics
device to absolute mode with different protocol instead of keeping it
in relative mode.

PR: 213757
Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru>
MFC after: 1 week


# 0901b577 05-Oct-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Fix extended buttons support on synaptic clickpad

Fix regression introduced by r306355 on synaptic clickpads with
extended buttons (buttons stopped working)

PR: 205690
Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru>


# 37d0ac15 04-Oct-2016 Gleb Smirnoff <glebius@FreeBSD.org>

Fix indentation.

CID: 1363671


# da464e71 29-Sep-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Replace explicit TUNABLE_INT to sysctl with CTLFLAG_TUN

- Replace tunables-only hw.psm.synaptics_support, hw.psm.trackpoint_support,
and hw.psm.elantech_support with respective sysctls declared with
CTLFLAG_TUN. It simplifies checking them in userland, also makes them
easier to get discovered by user
- Get rid of debug.psm.loglevel and hw.psm.tap_enabled TUNABLE_INT
declaration by adding CTLFLAG_TUN to read/write sysctls that were
already declared for these tunables.

Suggested by: jhb


# 0fe98e8f 26-Sep-2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>

Add Elantech trackpad support

Elantech trackpads are found in some laptops like the Asus UX31E. They
are "synaptics compatible" but use a slightly different protocol.

Elantech hardware support is not enabled by default and just like
Synaptic or TrackPoint devices it should be enabled by setting
tunable, in this case hw.psm.elantech_support, to non-zero value

PR: 205690
Submitted by: Vladimir Kondratyev <wulf@cicgroup.ru>
MFC after: 1 week


# 453130d9 02-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


# 73a1170a 19-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: use our nitems() macro when it is avaliable through param.h.

No functional change, only trivial cases are done in this sweep,
Drivers that can get further enhancements will be done independently.

Discussed in: freebsd-current


# b6d2c99a 14-Dec-2015 Andrew Turner <andrew@FreeBSD.org>

When exiting two-finger scroll the Synaptics device may report a jump in
absolute position. This seems to be correlated with only removing a single
finger. To work around this report no movement on from the first packet
when the user exits scrolling.


# 3bf6d939 18-Jun-2015 Rui Paulo <rpaulo@FreeBSD.org>

Synaptics: fix a problem with trackpoint passthrough.

There was a inconsistency which led to enable passthrough commands
being interpreted as actual touchpad commands.

Submitted by: Jan Kokemüller <jan.kokemueller at gmail.com>
MFC after: 1 week


# a57b51f9 16-Jun-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Fix miss from r284320.

Coverity: 1018895


# b63720c6 12-Jun-2015 Gleb Smirnoff <glebius@FreeBSD.org>

Unbreak mouse on resume on Thinkpads when hw.psm.trackpoint_support=0,
which is default. It was broken in r281441.

It appears that set_trackpoint_parameters() call on resume disables the
mouse. So, we need not call it on resume if hw.psm.trackpoint_support=0.

The problem is that the probe functions are used both for probing and
for reiniting on resume. And the absense of the softc parameter is used
as a mark to distinguish reinit and probe, which is quite ugly. At the
same time the softc parameter is needed to call set_trackpoint_parameters().

o Change the arguments of probefunc_t to always supply the softc, and
use additional enum argument to tell probing from initing.
o Don't call set_trackpoint_parameters() from global doinitialize(),
instead call it from the enable_trackpoint() only.
o In enable_synaptics() call enable_trackpoint() in both probe and
reinit cases.

Together with: Jan Kokemüller <jan.kokemueller gmail.com>


# 017d4859 10-May-2015 Rui Paulo <rpaulo@FreeBSD.org>

synaptics: more support for semi-MT trackpads.

Several improvements to the Synaptics driver to support
semi-multitouch trackpads and some other fixes:

- Two finger scrolling support for "semi-MT" touchpads. Those include
many of the older Synaptics touchpads before "true" multitouch support
(indicated by capMultiFinger). Semi-MT touchpads can report a second
finger position, but the X or Y coordinate may be swapped with some
coordinate of the first finger. This is a result of how the hardware
works internally. Therefore, all that can be reliably extracted is the
bounding box of the two finger positions. Semi-MT touchpads can be
recognized by the capAdvancedGestures capability bit. After setting the
mode byte, advanced gestures mode has to be enabled. Then, data packets
compatible with the capMultiFinger format are sent, so the same two
finger scrolling code can be leveraged. Enabling advanced gestures mode
on true multitouch touchpads should be harmless. Linux seems to always
enable advanced gestures mode.

- Put mode setting logic into own functions synaptics_preferred_mode()
and synaptics_set_mode() to have this in one place.
synaptics_passthrough_on() and synaptics_passthrough_off() currently
always use 0xc1 as the mode byte, which may be wrong for touchpads that
don't have capExtended.

- Expose X and Y resolution of touchpad to userland. Also expose minimum
and maximum X and Y coordinates. This is useful for programs in
userspace that read raw PSM packets (with PSM_LEVEL_NATIVE enabled) and
need to interpret the coordinates.

- Also send "extended w mode" packets (see section 3.2.9 of
511-000275-01_RevB.pdf) to userspace if PSM_LEVEL_NATIVE is enabled.
This is useful for userspace programs/drivers such as
xf86-input-synaptics that can handle these packets.

- Fix parsing of nExtendedQueries, and request extended/continued
capability bits depending on this value.

- capReportsMax, capClearPad, capAdvancedGestures and capCoveredPad must
be extracted from status[0] and not status[2], I think.

Submitted by: Jan Kokemüller jan.kokemueller at gmail.com


# 1321d68d 18-Apr-2015 Rui Paulo <rpaulo@FreeBSD.org>

Synaptics: don't report the middle button when clickPad is used.

On trackpads that had support for both, we were sending two button
events when the trackpad was pressed.

Tested by: Jakob Alvermark <jakob at alvermark.net>
MFC after: 1 week


# e6ef49ea 11-Apr-2015 Rui Paulo <rpaulo@FreeBSD.org>

Add support for controlling the trackpoint when Synaptics is enabled.

To accomplish this, we must put the Synaptics hardware in passthrough
mode when talking to the trackpoint.

I only performed minor style modifications.

Submitted by: Jan Kokemüller <jan.kokemueller at gmail.com>
MFC after: 1 week


# e1971180 11-Apr-2015 Rui Paulo <rpaulo@FreeBSD.org>

Improve Synaptics support for newer touchpads.

Enable two finger scrolling by default and disable the edge scrolling if
the touchpad has no physical zone for it. Disable directional scrolling
by default to avoid using extended buttons as scroll buttons.

Add support for ClickPad. On Lenovo laptops, this is the button
reported when one presses the touchpad.

While there, fix a problem where the extended buttons were not reporting
the button release event correctly: we need to save the state of the
buttons and report it to sysmouse until we receive a packet from the
touchpad indicating the button has been released. This makes it
possible to use an extended button to resize a window. On Lenovo
laptops, the major buttons are actually reported as extended buttons.

Tested by: many (current@)
MFC after: 1 week


# c282164d 05-Apr-2015 Rui Paulo <rpaulo@FreeBSD.org>

psm: print newer Synaptics Touchpad capabilities.


# 6c176113 14-Feb-2015 Michael Gmelin <grembo@FreeBSD.org>

Quirk based support of Chromebook keyboard found in Acer C720

This probably supports other devices based on SeaBIOS, which need
to be added to the smbios based quirks table.

The functionality has been ported from DragonFlyBSD and adapted
to FreeBSD's more general purpose environment.

Devices not covered by a quirk shouldn't be affected at all. Thanks
to jhb and kostikbel for reviewing the code.

Reviewed by: kostikbel, jhb
Approved by: jhb, kostikbel
Differential Revision: https://reviews.freebsd.org/D1802


# 4c8d7275 04-Sep-2013 Eitan Adler <eadler@FreeBSD.org>

Revert r255152:

It turns out that synaptics_support was turned off by default
because its probing method is too intrusive not because it was unstable.

Once this is fixed it should be enabled once again.

Reported by: delphij, jkim


# 79d98ecd 02-Sep-2013 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

psm: Add support for middle and extended buttons on Synaptics touchpads

PR: kern/170834
Submitted by: Brandon Gooch <jamesbrandongooch@gmail.com>
Tested by: Artyom Mirgorodskiy <artyom.mirgorodsky@gmail.com>
MFC after: 1 month


# abcdcce1 02-Sep-2013 Eitan Adler <eadler@FreeBSD.org>

synaptics and trackpoint support are stable enough to be on by default.

Eventually both options should be removed.

Reviewed by: dumbbell


# 634cf355 13-May-2013 Jung-uk Kim <jkim@FreeBSD.org>

Remove a bogus re-assignment.

MFC after: 3 days


# 78260bb3 18-Mar-2013 Jung-uk Kim <jkim@FreeBSD.org>

List TrackPoint device before generic model.


# 569d8f7e 18-Mar-2013 Jung-uk Kim <jkim@FreeBSD.org>

Add preliminary support for IBM/Lenovo TrackPoint.

PR: kern/147237 (based on the initial patch for 8.x)
Tested by: glebius (device detection and suspend/resume)
MFC after: 1 month


# 778dcb1c 18-Dec-2012 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

psm: Support detection of Synaptics touchpad v7.5 and above

Starting with firmware v7.5, the "Read TouchPad Modes" ($01) and "Read
Capabilities" ($02) commands changed: previously constant bytes now
carry variable information.

We now compare those bytes to expected constants only for firmware prior
to v7.5.

Tested by: Zeus Panchenko <zeus@gnu.org.ua>
MFC after: 1 week


# 26f370d0 20-Sep-2012 Kevin Lo <kevlo@FreeBSD.org>

Fix typo: s/protocl/protocol


# ecbb462c 07-Sep-2012 John Baldwin <jhb@FreeBSD.org>

Use callout(9) instead of timeout(9) to manage timers.


# f9be5550 27-Mar-2012 Jung-uk Kim <jkim@FreeBSD.org>

- Do not clobber softc when psm(4) is reintialized.
- Make INITAFTERSUSPEND flag independent of HOOKRESUME flag.
- Automatically set INITAFTERSUSPEND flag when ALPS GlidePoint is detected.
- Always probe Synaptics Touchpad. Allow MOUSE_SYN_GETHWINFO ioctl and
automatically set INITAFTERSUSPEND flag when a supported device is detected,
regardless of "hw.psm.synaptics_support" tunable setting.
- Update psm(4) to reflect the above changes.
- Remove long-time defunct SYNCHACK flag while I am in the neighborhood.

MFC after: 1 month


# 6472ac3d 07-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# 2f29acd7 16-Dec-2010 John Baldwin <jhb@FreeBSD.org>

- When moving the IRQ resource from the psmcpnp device to the psm device,
delete the IRQ resource from the psmcpnp device completely.
- Don't allocate the IRQ resource shared. It is not a shareable interrupt
on ISA. The bus driver can set RF_SHAREABLE if the IRQ is actually
shareable on a non-ISA bus.


# d2014f51 18-Nov-2010 John Baldwin <jhb@FreeBSD.org>

Various small typos and grammar nits in comments.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 1901fd2f 09-Sep-2010 Ed Schouten <ed@FreeBSD.org>

Let psm(4) use si_drv1 to refer to its softc.


# b469a438 18-Dec-2009 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Add new "hw.psm.tap_enabled" tunable and sysctl.

This tunable allows one to enable (1) or disable (0) gestures like tap
and tap-hold on Synaptics TouchPad when the Extended mode isn't enabled
(ie. "hw.psm.synaptics_support" not set).

By default, the value is -1 in order to keep the current behaviour of
not enabling/disabling gestures explicitly.

PR: kern/139272
Submitted by: David Horn <dhorn2000 AT gmail DOT com>
Reviewed by: David Horn <dhorn2000 AT gmail DOT com>


# 247db074 20-Aug-2009 John Baldwin <jhb@FreeBSD.org>

MFC 196403: Temporarily revert the new-bus locking for 8.0 release.

Approved by: re (kib)


# a56fe095 20-Aug-2009 John Baldwin <jhb@FreeBSD.org>

Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by: re (kib), attilio


# 444b9186 02-Aug-2009 Attilio Rao <attilio@FreeBSD.org>

Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by: ed, hps, jhb, imp, mav, scottl
No answer by: ariff, thompsa, yongari
Tested by: pho,
G. Trematerra <giovanni dot trematerra at gmail dot com>,
Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by: Yahoo! Incorporated
Approved by: re (ksmith)


# 910ac6da 16-Mar-2009 Robert Noland <rnoland@FreeBSD.org>

Teach psm about O_ASYNC

This makes Xorg happy if you aren't using moused.

MFC after: 3 days


# c9d986fe 17-Dec-2008 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Synaptics touchpads must be reinitialized after suspend/resume.

This fixes touchpad resume on Asus EeePC among others.

Submitted by: rpaulo


# e3c46ebb 16-Dec-2008 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Rephrase and/or fix some comments in Synaptics touchpad initialization
function.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 19ff29fb 14-Oct-2008 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Rewrite Synaptics touchpads support with the following goals in mind:
o better quality of the movement smoothing
o more features such as tap-hold and virtual scrolling

Support must still be enabled with this line in your /boot/loader.conf:
hw.psm.synaptics_support="1"

The following sysctls were removed:
hw.psm.synaptics.low_speed_threshold
hw.psm.synaptics.min_movement
hw.psm.synaptics.squelch_level

An overview of this new driver and a short documentation about the added
sysctls is available on the wiki:
http://wiki.freebsd.org/SynapticsTouchpad


# 6bfa9a2d 27-Sep-2008 Ed Schouten <ed@FreeBSD.org>

Replace all calls to minor() with dev2unit().

After I removed all the unit2minor()/minor2unit() calls from the kernel
yesterday, I realised calling minor() everywhere is quite confusing.
Character devices now only have the ability to store a unit number, not
a minor number. Remove the confusion by using dev2unit() everywhere.

This commit could also be considered as a bug fix. A lot of drivers call
minor(), while they should actually be calling dev2unit(). In -CURRENT
this isn't a problem, but it turns out we never had any problem reports
related to that issue in the past. I suspect not many people connect
more than 256 pieces of the same hardware.

Reviewed by: kib


# ad291f81 25-Jul-2008 Tom Rhodes <trhodes@FreeBSD.org>

Fill in sysctl descriptions.

Approved by: philip


# be384017 01-Jun-2008 Philip Paeps <philip@FreeBSD.org>

Try to detect a Synaptics touchpad before IntelliMouse. Some touchpads will
pretend to be IntelliMouse (which have a few more features than generic mice)
causing the IntelliMouse probe to work and the Synaptics code never to be
called.

This should not break "real" IntelliMouse because the Synaptics detection code
is fairly specific.

PR: kern/120833
Submitted by: Eygene Ryabinkin <rea-fbsd -at- codelabs.ru>
MFC after: 1 week


# fb4865e7 08-Apr-2008 Jung-uk Kim <jkim@FreeBSD.org>

Clean up and fix style(9) nits.


# ff0af72c 08-Apr-2008 Jung-uk Kim <jkim@FreeBSD.org>

- Add write(2) support for psm(4) in native operation level. Now arbitrary
commands can be written to /dev/psm%d and status can be read back from it.
- Reflect the change in psm(4) and bump version for ports.

MFC after: 1 week


# b1d8472a 25-Feb-2008 Rink Springer <rink@FreeBSD.org>

Some PS/2 mice (at least the A4Tech X-7xx) need to be set to Intelli mode
first before they can be set to Explorer mode.

PR: kern/118578
Submitted by: Andriy Gapon <avg@icyb.net.ua> (I added some comments)
Reviewed by: philip
MFC after: 1 month


# 60a35d3a 16-Jun-2007 Matt Jacob <mjacob@FreeBSD.org>

Initialize mouse resolution to zero if converting from
OLD to NEW.


# ef544f63 22-Feb-2007 Paolo Pisati <piso@FreeBSD.org>

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


# 5a10830e 03-Feb-2007 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Synaptics TouchPad seems to go back to Relative Mode after the call
to set_controller_command_byte() call; by issueing a Read Mode Byte
command, the touchpad is in Absolute Mode again.

This problem occursed at least on Asus V6V laptops.


# 7810d9c6 18-Dec-2006 Giorgos Keramidas <keramida@FreeBSD.org>

Spell "Kensington Thinking Mouse" correctly.


# 3e7c5fe5 15-Mar-2006 Takanori Watanabe <takawata@FreeBSD.org>

Add ALPS glide point ID and some compatibility IDs.

PR: kern/75008


# dcde7cd5 05-Jan-2006 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

Fix a bug in Synaptics Touchapd support where psm(4) will enter an infinite
loop if it receives an out of sync packet.

Reviewed by: mux (mentor)
MFC after: 4 days


# f4e98881 03-Dec-2005 Ruslan Ermilov <ru@FreeBSD.org>

Fix -Wundef.


# 520b6353 10-Jun-2005 Marius Strobl <marius@FreeBSD.org>

- Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) source
files after they were repo-copied to sys/dev/atkbdc. The sources of
atkbdc(4) and its children were moved to the new location in preparation
for adding an EBus front-end to atkbdc(4) for use on sparc64; i.e. in
order to not further scatter them over the whole tree which would have
been the result of adding atkbdc_ebus.c in e.g. sys/sparc64/ebus. Another
reason for the repo-copies was that some of the sources were misfiled,
e.g. sys/isa/atkbd_isa.c wasn't ISA-specific at all but for hanging
atkbd(4) off of atkbdc(4) and was renamed to atkbd_atkbdc.c accordingly.
Most of sys/isa/psm.c, i.e. expect for its PSMC PNP part, also isn't
ISA-specific.
- Separate the parts of atkbdc_isa.c which aren't actually ISA-specific
but are shareable between different atkbdc(4) bus front-ends into
atkbdc_subr.c (repo-copied from atkbdc_isa.c). While here use
bus_generic_rl_alloc_resource() and bus_generic_rl_release_resource()
respectively in atkbdc_isa.c instead of rolling own versions.
- Add sparc64 MD bits to atkbdc(4) and atkbd(4) and an EBus front-end for
atkbdc(4). PS/2 controllers and input devices are used on a couple of
Sun OEM boards and occur on either the EBus or the ISA bus. Depending on
the board it's either the only on-board mean to connect a keyboard and
mouse or an alternative to either RS232 or USB devices.
- Wrap the PSMC PNP part of psm.c in #ifdef DEV_ISA so it can be compiled
without isa(4) (e.g. for EBus-only machines). This ISA-specific part
isn't separated into its own source file, yet, as it requires more work
than was feasible for 6.0 in order to do it in a clean way. Actually
philip@ is working on a rewrite of psm(4) so a more comprehensive
clean-up and separation of hardware dependent and independent parts is
expected to happen after 6.0.

Tested on: i386, sparc64 (AX1105, AXe and AXi boards)
Reviewed by: philip


# df616c90 10-Jan-2005 Philip Paeps <philip@FreeBSD.org>

Make life for owners of Synaptics Touchpads more pleasant :-)

o Implement a shiny new algorithm to keep track of finger movement at
slow speeds. This dramatically reduces the level of questionable
language from users trying to resize windows.

o Properly catch the many extra buttons and dials which manufacturers
are known to screw onto Synaptics touchpad controllers. Currently,
up to seven buttons are known to work, more should work too.

o Add a number of sysctls allowing one to tune the driver to taste in
a simple way:

# Should the extra buttons act as axes or as middle button
hw.psm.synaptics.directional_scrolls

# These control the 'stickiness' at low speeds
hw.psm.synaptics.low_speed_threshold
hw.psm.synaptics.min_movement
hw.psm.synaptics.squelch_level

PR: kern/75725
Submitted by: Jason Kuri <jay@oneway.com>
MFC after: 1 month


# 9fd851bb 03-Jan-2005 Philip Paeps <philip@FreeBSD.org>

Reduce diffs to work in progress before checking in serious changes.

o Move the sysctls under debug.psm.* and hw.psm.* making them a bit
clearer and more consistent with other drivers.

o Remove the debug.psm_soft_timeout sysctl. It was introduced many
moons ago in r1.64 but never referenced anywhere.

o Introduce hw.psm.tap_threshold and hw.psm.tap_timeout to control
the behaviour of taps on touchpads. People might like to fiddle
with these if tapping seems to slow or too fast for them.

o Add debug.psm.loglevel as a tunable so that verbosity can be set
easily at boot-time (to watch probes and such) without having to
compile a kernel with options PSM_DEBUG=N.


# 34ed91b4 29-Sep-2004 Philip Paeps <philip@FreeBSD.org>

Introduce a tunable to disable support for Synaptics touchpads. A number of
people have reported problems (stickyness, aiming difficulty) which is proving
difficult to fix, so this will default to disable until sometime after 5.3R.

To enable Synaptics support, set the 'hw.psm.synaptics_support=1' tunable.

MT5 candidate.

Approved by: njl


# 5fb0f527 27-Aug-2004 Justin T. Gibbs <gibbs@FreeBSD.org>

Improve sync recovery algorithm:
o Remove PSM_SYNCERR_THRESHOLD1. This value specified how many sync
errors were required before the mouse is re-initialised.
Re-initialisation is now done after (packetsize * 2) sync errors as
things aren't likely to improve after that.

o Reset lastinputerror when re-initialisation occurs. We don't want
to continue to drop data after re-initialisation.

o Count the number of failed packets independently of the syncerrors
statistic. syncerrors is useful for recovering sync within a single
packet. pkterrors allows us to detect when the mouse changes its
packet mode due to some external event (e.g. KVM switch).

o Reinitialize the mouse if we see more than psmpkterrthresh errors
during the validation period. The validation period begins as soon
as a sync error is detected and continues until psmerrsecs/msecs
time has elapsed. The defaults for these two values force a reset
if we see two packet errors in a 2 second period. This allows rapid
detection of packet framing errors caused by the mouse changing packet
modes.

o Export psmpkterrthresh as a sysctl

o Export psmloglevel as a sysctl.

o Enable more debugging code to be enabled at runtime via psmloglevel.

o Simplify verbose conditioned loging by using a VLOG macro.

o Add several comments describing the sync recovery algorithm of
this driver.

Large Portions by: Brian Somers <brian@Awfulhak.org>
Inspired and Frustrated by: Belkin KVMs
Reviewed by: njl, philip


# e55a65d0 17-Aug-2004 Justin T. Gibbs <gibbs@FreeBSD.org>

Defer the capture of the "expected sync bits" until the first "normal"
data packet is received from the mouse. In the case of many KVM's,
this avoids a bug in their mouse emulation that sends back incorrect
sync when you explicitly request a data packet from the mouse. Without
this change, you must force the driver into stock PS/2 mode or be flooded
with a never ending stream of "out of sync" messages on these KVMs.

Approved by: re


# 5459a006 16-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Don't initialize static variables to 0 (C should just take care of that).

Spotted by: njl


# 8547e74f 16-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Update support for Synaptics Touchpads (Volume V)

o Add (long awaited) support for guest devices

Submitted by: Arne Schwabe <arne@rfc2549.org>
Approved by: njl (in a former revision)


# c4dbfe38 07-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Assume a finger of regular width when no width value is reported by
the touchpad (which happens when it has no extended capabilities).

Spotted by: dhw
Forgotten by: philip


# 1b5dd3ae 07-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Update support for Synaptics Touchpads (Volume IV)

o Change the motion calculation to result in
a more reasonable speed of motion

This should fix the 'aiming' problems people have reported. It also
mitigates (but doesn't completely solve) the 'stalling' problems at
very low speeds.

Tested by: many subscribers to -current
Approved by: njl


# bc1418f6 07-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Update support for Synaptics Touchpads (Volume III)

o Catch 'taps' as button presses

o One finger sends button1, two fingers send button3,
three fingers send button2 (double-click)

Tested by: many subscribers to -current
Approved by: njl


# 7589cb5c 07-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Update support for Synaptics Touchpads (Volume II)

o Handle the 'up/down' buttons some touchpads have as
a z-axis (scrollwheel) as recommended by the specs

o Report the buttons as button4 and button5 instead
of button2 and button4, button2 can be emulated by
pressing button1 and button3 simultaneously. This
allows one to use the two extra buttons for other
purposes if one so desires.

Tested by: many subscribers to -current
Approved by: njl


# 4079d722 07-Aug-2004 Philip Paeps <philip@FreeBSD.org>

Update support for Synaptics Touchpads (Volume I)

o Clean up whitespace and comments in the
enable_synaptics() probing function

o Only use (and rely on) the extended capability
bits when we are told they actually exist

o Partly ignore the (possibly dated?) part of the
specification about the mode byte so that we
can support 'guest devices' too.

Tested by: many subscribers to -current
Approved by: njl


# a4cdf60c 29-Jul-2004 Nate Lawson <njl@FreeBSD.org>

Add support for the Synaptics Touchpad mouse driver. I reworked the
submitted version with style cleanups and changes to comments. I also
modified the ioctl interface. This version only has one ioctl (to get
the Synaptics-specific config parameters) since this is the only
information a user might want.

Submitted by: Arne Schwabe <arne -at- rfc2549.org>


# d49311a7 16-Jul-2004 Maxime Henrion <mux@FreeBSD.org>

Ignore more strange return values of the test_aux_port() function,
because some notebooks (apparently Compaq, Toshiba and Acer ones)
erroneously return 2 or 3 there.

PR: kern/61482, kern/54188
Submitted by: Ulf Lilleengen <lulf@kerneled.org>,
Victor Balada Diaz <victor@alf.dyndns.ws>
MFC after: 3 days


# 89c9c53d 16-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


# 0335702b 17-Apr-2004 Maxime Henrion <mux@FreeBSD.org>

Don't check for device_get_softc() returning NULL, it can't happen.


# 44e421c9 04-Apr-2004 Mark Murray <markm@FreeBSD.org>

Put a bunch of output that us really only useful in a debug
scenario into #ifdef DEBUG. This makes my cluster with Belkin
KVM switch completely usable, even if the KVM switch and mouse
get a bit confused sometimes.

Without this, when the mouse gets confused, all sorts of crud
gets spammed all over the screen. With this, the mouse may appear
dead for a second or three, but it recovers silently.


# 5f96beb9 17-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# dc08ffec 21-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Device megapatch 4/6:

Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.


# c9c7976f 21-Feb-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Device megapatch 1/6:

Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.


# de75fd6d 11-Dec-2003 Alfred Perlstein <alfred@FreeBSD.org>

Significantly reduce the "jitter" that is typical for PS/2 mice
when using a KVM.

There is no actual solution possible, but this gets us pretty close.

Typically when switching back to a FreeBSD box and moving the mouse
wild data is produced, because the protocol's validation/checksum
system is extremely weak it is impossible to determine that we're
out of sync before dropping several bogus packets to user land.

The actual solution that appears to offer the best clamping of
jitter is to buffer the mouse packets if we've not seen mouse
activity for more than .5 seconds. Then waiting to flush that data
for 1/20th of a second. If within that 20th of a second we get any
packets that do fail the weak test we drop the entire queue and
back off accepting data from the mouse for 2 seconds and then repeat
the whole deal.

You can still get _some_ jitter, notably if you switch to the FreeBSD
box, then move the mouse just enough to generate one or two packets.
Those packets may be bogus, but may still pass the validity check.

One way to finally kill the problem once and for all is to check
the initial packets for "wild" values. Typically one sees packets
in the +/-60 range during normal operation, however when bogus data
is generated it's typically near the outer range of +/-120 or more,
those packets would be a good candidate for dropping or clamping.

I've been running with this for several weeks now and it has
significantly helped me stay sane even with a piece of junk Belkin
KVM causing wild jitter each and every time I switch.

Lastly I'd like to note that my experience with Windows shows me that
somehow the Microsoft PS/2 driver typically avoids this problem, but
that may only be possible when running the mouse in a dumb-ed down PS/2
mode that Belkin recommends on their site.


# 512824f8 09-Nov-2003 Seigo Tanimura <tanimura@FreeBSD.org>

- Implement selwakeuppri() which allows raising the priority of a
thread being waken up. The thread waken up can run at a priority as
high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
threads. Used by selwakeuppri() if collision occurs.

Not objected in: -arch, -current


# e0c22597 12-Jul-2003 Mike Heffner <mikeh@FreeBSD.org>

Add support for the A4 Tech RFSW-35 mouse wheel. Probe is similar to
4D Plus.

PR: 44333


# b1181a94 06-Jul-2003 Mike Heffner <mikeh@FreeBSD.org>

Reset the PSM aux device twice to help pierce through some KVM's to
get the correct data from the attached mouse. Multiple resets should
be harmless, but just in case, the second one is non-fatal and is just
ignored.


# 6d1c1655 01-Jul-2003 Mike Heffner <mikeh@FreeBSD.org>

Add PnP PS/2 id for Dell Latitude X200.

PR: 48516
MFC after: 2 weeks


# 8c9bbf48 10-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().


# a3e7d3f1 31-May-2003 Poul-Henning Kamp <phk@FreeBSD.org>

wrap macro in do {...} while(0)


# 9d4b1fa4 31-May-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Remove extra ';'

Found by: FlexeLint


# 51da11a2 29-Apr-2003 Mark Murray <markm@FreeBSD.org>

Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.


# 104a9b7e 29-Apr-2003 Alexander Kabaev <kan@FreeBSD.org>

Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on: standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>


# 7ac40f5f 02-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by: re(scottl)


# 521f364b 02-Mar-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).


# 19ad2450 22-Jan-2003 Marcel Moolenaar <marcel@FreeBSD.org>

YAM: This id is found in a Sony Vaio GRX-670. When will this end?

Submitted by: Chuck McCrobie <mccrobie2000@yahoo.com>


# 033aebeb 21-Jan-2003 Jeffrey Hsu <hsu@FreeBSD.org>

Add yet another Sony Vaio PS/2 mouse ID. This one is found on a VX88.

Submitted by: marcel


# 99fd68d9 21-Jan-2003 Marcel Moolenaar <marcel@FreeBSD.org>

Add yet another Sony Vaio PS/2 mouse ID. This one is found in a R505GL.
The ACPI data for the mouse includes the compatibility ID, but we
apparently don't make use of it.


# 6dc61b5a 14-Jan-2003 Matthew N. Dodd <mdodd@FreeBSD.org>

- GC a few more hand-rolled 'abs' macros.
- GC a few hand-rolled min()/max() macros while I'm here.


# 93b0017f 25-Aug-2002 Philippe Charnier <charnier@FreeBSD.org>

Replace various spelling with FALLTHROUGH which is lint()able


# 14e10f99 19-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P.


# 85f190e4 13-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Fixes to make select/poll mpsafe.

Problem:
selwakeup required calling pfind which would cause lock order
reversals with the allproc_lock and the per-process filedesc lock.
Solution:
Instead of recording the pid of the select()'ing process into the
selinfo structure, actually record a pointer to the thread. To
avoid dereferencing a bad address all the selinfo structures that
are in use by a thread are kept in a list hung off the thread
(protected by sellock). When a selwakeup occurs the selinfo is
removed from that threads list, it is also removed on the way out
of select or poll where the thread will traverse its list removing
all the selinfos from its own list.

Problem:
Previously the PROC_LOCK was used to provide the mutual exclusion
needed to ensure proper locking, this couldn't work because there
was a single condvar used for select and poll and condvars can
only be used with a single mutex.
Solution:
Introduce a global mutex 'sellock' which is used to provide mutual
exclusion when recording events to wait on as well as performing
notification when an event occurs.

Interesting note:
schedlock is required to manipulate the per-thread TDF_SELECT
flag, however if given its own field it would not need schedlock,
also because TDF_SELECT is only manipulated under sellock one
doesn't actually use schedlock for syncronization, only to protect
against corruption.

Proc locks are no longer used in select/poll.

Portions contributed by: davidc


# 03b8237d 09-Mar-2002 Takanori Watanabe <takawata@FreeBSD.org>

Add SONY VAIO psm controller ISA-PnP ID.


# 604fb1c0 19-Dec-2001 Sheldon Hearn <sheldonh@FreeBSD.org>

Add another PS2 PNP id.

PR: 32973
Submitted by: KT Sin <ktsin@acm.org>


# 8166ba27 13-Oct-2001 Kazutaka YOKOTA <yokota@FreeBSD.org>

Hack for the "out-of-sync" error.

- Count the number of this error.
- When the error is detected for the first time, the psm driver will
throw few data bytes (up to entire packet size) and see if it can
get back to sync.
- If the error still persists, the psm driver disable/enable the mouse
and see if it works.
- If the error still persists and the count goes up to 20,
the psm driver reset and reinitialize the mouse. The counter
is reset to zero.
- It also discards an incomplete data packet when the interval
between two consequtive bytes are longer than pre-defined timeout
(2 seconds). The last byte which arrived late will be regarded as
the first byte of a new packet. This is louie's idea.

You may see the following error logs during the above operations:

"psmintr: delay too long; resetting byte count"
"psmintr: out of sync (%04x != %04x)"
"psmintr: discard a byte (%d)"
"psmintr: re-enable the mouse"
"psmintr: reset the mouse"

MFC after: 1 month


# c84f2b28 03-Oct-2001 Takanori Watanabe <takawata@FreeBSD.org>

Add PnP ID 'IBM3781' for TP240 mouse.


# d4b248f2 25-Sep-2001 Kazutaka YOKOTA <yokota@FreeBSD.org>

Yet another turn of workaround for psm/ACPI/PnP BIOS
problems currently experienced in -CURRENT.

This should fix the problem that the PS/2 mouse is detected
twice if the acpi module is not loaded on some systems.


# cd6cd68d 14-Sep-2001 Kazutaka YOKOTA <yokota@FreeBSD.org>

Refine ACPI/PnP BIOS probe/attach routines a bit.

- Add workaround for the problematic PnP BIOS which does not assign
irq resource for the PS/2 mouse device node; if there is no irq
assigned for the PS/2 mouse node, refer to device.hints for an
irq number. If we still don't find an irq number in the hints
database, use a hard-coded value.
- Delete unused ivars.
- Bit of clean up in probe/attach.
- Add PnP ID for the PS/2 mouse port on some IBM ThinkPad models.


# b40ce416 12-Sep-2001 Julian Elischer <julian@FreeBSD.org>

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


# ef92e447 05-Sep-2001 Kazutaka YOKOTA <yokota@FreeBSD.org>

Update the atkbdc, atkbd, and psm drivers to probe/attach
more cleanly and consistently in all APCI, PnP BIOS, and "hint"
cases.

NOTE: this doesn't necessarily solve the problem that the PS/2
mouse is not detected after the recent ACPI update.


# f8388051 25-Mar-2001 Poul-Henning Kamp <phk@FreeBSD.org>

Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.


# 0a2c3d48 08-Jan-2001 Garrett Wollman <wollman@FreeBSD.org>

select() DKI is now in <sys/selinfo.h>.


# 872dfb2d 30-Nov-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

- Add a hack for "psmintr: out of sync.." This is NOT a fix,
but a hack! Add `flags 0x8000' to the psm driver to enable it.
The psm driver will try to get out of out-of-sync situation
by disabling the mouse and immediately enable it again.

If you are seeing this out-of-sync problem because of an
incompetent(?!) KVM switch, this hack will NOT be good
for you. However, if you are occasionally seeing the
problem because of lost mouse interrupt, this might help.


# ed584487 30-Nov-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

- Slightly rearrnage IntelliMouse Explorer and Logitech
MouseMan+ identification routines for efficiency.
No functional change.


# db7e3af1 15-Oct-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Remove unneeded #include <machine/clock.h>


# f6b5c74c 09-Oct-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Initiate deorbit burn sequence for <machine/mouse.h>.

Replace all in-tree uses with <sys/mouse.h> which repo-copied a few
moments ago from src/sys/i386/include/mouse.h by peter.
This is also the appropriate fix for exo-tree sources.

Put warnings in <machine/mouse.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/mouse.h> files will be removed.


# 86ab18a7 22-Sep-2000 John Baldwin <jhb@FreeBSD.org>

Fix several 64-bit-ism warnings due to sizeof(int) != sizeof(void *) on
the alpha.


# 01819900 24-Aug-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

Add spltty()/splx() in the watchdog timer routine.


# fc581b6b 27-Jul-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

Fix GENERIC_MOUSE_ENTRY.

Submitted by: Graham Wheeler <gram@cequrux.com> and gibbs


# 7ce6464a 21-Jul-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

This is yet another attempt to fix "psmintr out of sync.." problems.

- Properly protect the watchdog timer routine.
- Relocate the sync check statement so that we don't see too many
error messages.


# 3389ae93 19-Apr-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


# d0a99324 02-Apr-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

- Add temporary workaround to fool some "clever" KVM switch products
which think they know the IntelliMouse 4-byte packet and believe,
wrongly, that any other protocols use 3-byte packets.
- Update a couple of comment lines for A4 Tech mice.


# 3346e881 18-Mar-2000 Kazutaka YOKOTA <yokota@FreeBSD.org>

- Add Support for the following PS/2 mice:
- Microsoft IntelliMouse Explorer: 2 buttons on top, 2 side buttons
and a wheel which also acts as the middle button. The mouse is
recognized as "IntelliMouse Explorer".
- Genius NetScroll Optical: 2 buttons on top, 2 side buttons and a
wheel which also acts as the middle button. The mouse is recognized
as "NetMouse/NetScroll Optical".
- MouseSystems SmartScroll Mouse (OEM from Genius?): 3 buttons on top,
1 side button and a wheel. The mouse is recognized as Genius
"NetScroll".
- IBM ScrollPoint: 2 buttons on top and a stick between the buttons.
The stick can perform "horizontal scroll" in W*ndows environment.
The horizontal movement of the stick is detected. It is currently
mapped to the Z axis movement in the same way as the first wheel.
The mouse is recognized as "MouseMan+", as it is considered to be
a variation of MouseMan.
- A4 Tech 4D and 4D+ mice. These mice have two wheels! The movement
of the second wheel is reported as the Z axis movement in the
same way as the first wheel. These mice are recognized as "4D
Mouse" and "4D+ Mouse".
- Tweak IntelliMouse support code a bit so that less-than-compatible
wheel mice can work properly with the psm driver.
- Add driver configuration flags which correspond to the kernel
options PSM_HOOKRESUME and PSM_RESETAFTERSUSPEND, so that we don't
need to recompile the kernel when we need these functions.
- Properly keep track of the irq resource.
- Add a watchdog timer in case interrupts are lost (experimental).
- Add `detach' function (experimental).


# a6b85130 01-Mar-2000 Peter Wemm <peter@FreeBSD.org>

Don't free(sc) before returning an error from probe, it does not "belong"
to us, subr_bus.c will free it. This bug (panic: freeing already free)
was exposed by kern/subr_bus.c rev 1.54

Not explicitly approved by: jkh (but this is a showstopper and fallout of
the above approved change)


# 8f8e5879 29-Jan-2000 Peter Wemm <peter@FreeBSD.org>

Use config's conditional compilation rather than using #ifdefs that make
modular compilation harder. I'm doing this because people seem to like
cut/pasting examples of bad practices in existing code.


# 273157da 15-Dec-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

- Add the device resume method. It supercedes the existing resume
routine which hooks the apm driver.
- Rename the PSM_HOOKAPM option to PSM_HOOKRESUME.
- Delete unnecessary #include.


# 1faa5a84 08-Nov-1999 Peter Wemm <peter@FreeBSD.org>

Use DEVICE_MODULE() directly instead of DEV_DRIVER_MODULE. psm.c uses
make_dev() already.


# d6a0e38a 25-Sep-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Remove five now unused fields from struct cdevsw. They should never
have been there in the first place. A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 9dcbe240 23-Aug-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Convert DEVFS hooks in (most) drivers to make_dev().

Diskslice/label code not yet handled.

Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers)

Add the correct hook for devfs to kern_conf.c

The net result of this excercise is that a lot less files depends on DEVFS,
and devtoname() gets more sensible output in many cases.

A few drivers had minor additional cleanups performed relating to cdevsw
registration.

A few drivers don't register a cdevsw{} anymore, but only use make_dev().


# 7d27f93a 22-Aug-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

Improve the detection code for GlidePoint. This is still a kludge,
but better than before...

PR: kern/13215


# e6d37e18 16-Aug-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

Recognize Interlink VersaPad. `Tap' action will be recognized
as the button 4.

Submitted by: Masachika ISHIZUKA <ishizuka@ish.org>


# 01533d85 12-Jul-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

Improve Logitech MouseMan+ protocol support.


# 551e01b1 12-Jul-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

Implement a kludge for some wheeled mice for which infamous "psmintr:
out of sync..." messages is generated and the wheel movement is not
recognized.

The trick is found by Takashi Nishida.


# 03016f42 04-Jul-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Remove cmaj and bmaj args from DEV_DRIVER_MODULE.


# 2b9e6c75 02-Jun-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

Fix PS/2 MouseMan+ protocol. We have been looking at a wrong place
for the sign bit for roller movement!


# 4e2f199e 30-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

This commit should be a extensive NO-OP:

Reformat and initialize correctly all "struct cdevsw".

Initialize the d_maj and d_bmaj fields.

The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format. Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.


# 52400704 09-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference between
a major number for a dev_t.


# d1a67a94 08-May-1999 Kazutaka YOKOTA <yokota@FreeBSD.org>

Revive APM hooking code for i386 arch now that the same source file is
used for both i386 and alpha (the code was in sys/i386/isa/psm.c, but
was disabled when ported to alpha.)


# 566643e3 08-May-1999 Doug Rabson <dfr@FreeBSD.org>

Move the declaration of the interrupt type from the driver structure
to the BUS_SETUP_INTR call.


# 46eede00 07-May-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Continue where Julian left off in July 1998:

Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline)
function.

Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention
to the order of the cmaj/bmaj arguments!)

Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE
(ditto!)

(Next step will be to convert all bdev dev_t's to cdev dev_t's
before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)


# 25f43374 18-Apr-1999 Peter Wemm <peter@FreeBSD.org>

Merge revs 1.57 and 1.60 of i386/isa/psm.c


# 6182fdbd 16-Apr-1999 Peter Wemm <peter@FreeBSD.org>

Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition. eisa, isapnp and pccard* are
not yet using the new resource manager. Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
ATA driver to the Alpha. Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by: core


# 8a997770 23-Jan-1999 Doug Rabson <dfr@FreeBSD.org>

Update the alpha port to use the new syscons.

Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> (partly)


# 08b6a4cb 15-Nov-1998 Doug Rabson <dfr@FreeBSD.org>

* Add hooks to allow the X server to access I/O ports and memory.
* Update drivers to the latest version of the bus interface.

The ISA drivers' use of the new resource api is minimal. Garrett has
some much cleaner drivers which should be more easily shared between
i386 and alpha. This has only been tested on cia based machines. It
should work on lca and apecs but I might have broken something.


# 66d22cfe 08-Nov-1998 Doug Rabson <dfr@FreeBSD.org>

Port the ps/2 mouse driver to the alpha.