git: Sync psm/evdev/atkbd with FreeBSD

Michael Neumann mneumann at crater.dragonflybsd.org
Fri Apr 19 02:58:55 PDT 2024


commit a162a738eca94f99d45d88429e86cfd0fbfbe95d
Author: Michael Neumann <mneumann at ntecs.de>
Date:   Sat Apr 6 12:40:13 2024 +0200

    Sync psm/evdev/atkbd with FreeBSD
    
    Partially sync psm, evdev and atkbd drivers with FreeBSD HEAD as of now.
    
    The result should be much better input device support (Touchpad etc.) on
    some Laptops.
    
    Tested on following hardware:
    
    * Panasonic CF-SV (myself)
    * Tuxedo InfinityBook 14 (myself)
    * Lenovo Thinkpad T480 (Antonio)
    * Lenovo Thinkpad T490 (Peeter)
    
    As for the Panasonic CF-SV and Tuxedo InfinityBook 14, it works so much
    better than before. Without this commit, the touchpad was either not
    recognized (missing active AUX port multiplexing) or barely useable.
    
    Credits go as well to the authors of Bug report #3206 (htse, daftaupe)
    who did similar work in parallel.
    
    To summarize some of the changes:
    
    * psm, evdev (w/o uinput) and to some degree the atkbd driver is synced
      with FreeBSD.
    
    * As for atkbd, mainly the parts related to support active AUX port
      multiplexer code is synced from FreeBSD. Active AUX port MUX is
      required to detect for example my synaptics touchpad on the Pansonic
      CF-SV, otherwise the touchpad is only recognized as standard PS/2 mouse.
      Other laptops use the same "method" to attach "multiple" mice to the AUX
      port.
    
    * This patch also includes the patch given in Bug report #3206:
      https://bugs.dragonflybsd.org/issues/3206
    
    * Adds kern.features sysctl. Xorg uses e.g. kern.features.evdev
      and kern.features.evdev_support to detect if evdev is available.
    
    * Tested with a Synaptics Touchpad using both moused/sysmouse and
      libinput under X11. Both work reliably.
    
    * This patch enables hw.psm.{synaptics,trackpoint,elantech}_support
      by default. This should give a better user-experience by default.
    
    * Set hw.psm.mux_disabled=1 if your keyboard no longer works due
      to the AUX MUX code (I haven't synced the quirks code yet).
    
    * atkbd - periodic polling is disabled. Can be turned on by setting
      loader tunable hw.atkbd.hz to 1 or 10 (as it was before).
    
    How to use this with Xorg? Set:
    
        sysctl kern.evdev.rcpt_mask=6
    
    Then, either add moused_enable=YES to /etc/rc.conf. Then you can
    use this with the default xorg.conf.
    
    To use this with libinput, which I do, I had to add the following to
    /etc/X11/xorg.conf:
    
        Section "InputClass"
             Identifier "libinput pointer catchall"
             MatchIsPointer "on"
             MatchIsTouchpad "on"
             MatchDevicePath "/dev/input/event*"
             Driver "libinput"
        EndSection
    
    and in $HOME/.xinitrc:
    
        xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1
    
    to enable tapping. Not needed if sysmouse is used (requires running
    moused). Scrolling feels better with libinput, but that is likely just
    a better default setting.
    
    ---
    
    In the following, each commit message is listed:
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/dcc414b888bd855d3ad30bea0e20fb35733097cb
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/f3bae0ea25e2f2b76f5dcd8a6a800344803a900f
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/933ef2d3b285966c604d21848963afc9e9a07a0b
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/51de77dd3d64846b8ed8462b366f83f4cfabc1b7
    
    psm - Adjust Elantech palm width threshold to nearly match synaptics defaults
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/8a98c8c412d0c7171054423dced8874f62cd6082
    
    psm - reduce cursor jumping on palm detection
    
    This is done with discarding pointer movements rather then mouse packets
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/848714bcb443af01596a455cad58beda33caf98b
    
    psm - Enable palm detection on two finger touches for multitouch trackpads
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/eb65854355fe829af8c9b0d5c5a2c324a220ed10
    
    psm - Report 3-rd and 4-th fingers as first finger for Elan hw v.2/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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/6c85d7cb3230313a90ae2f5fb4fe943d5ad686f0
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/21cb8f6288d49b2a274db0fa531306a25220abd8
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/ae3b1e4a342724a1ac2151f2526cd8b8f69c60b5
    
    psm - Add sanity checks to Synaptics touchpad driver resolution parser
    
    This fixes "Kernel has only x or y resolution, not both" libinput error.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/8352f326c3db80e16d43d5b29a9cf55d914becdd
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/9402bd96df8000c2ac5d9c239ff746919af0dd66
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/b9b766ae4708627ab5f62377c30ec070b6dd103d
    
    psm - Log syncmask[1], not syncmask[0] twice
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/90b0eb9b4a7b94c81f4183937210371c02fc3f58
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/7d1460a4b1a0e5cd9fbed912b7d4480d0f769d4a
    
    psm - 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
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/f451e00544de30a6ce00b15bf056bedb880e882f
    
    psm - Fix panic occuring soon after PS/2 packet has been rejected by synaptics or elantech sanity checker
    
    This patch has already been partially applied in commit 906090f3.
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/74a53bd1315341bc33f9dd0dc589d0397080f270
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/893daee680dcb62886ce0c3d74457834a1c2ead9
    
    psm - Initialize variables before use
    
    dxp/dyp could have been used uninitialized in the subsequent debugging log
    invocation.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/015ab098439452cb798dbea5dd2d4fe57c72808c
    
    psm - 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.
    
    Not applied is a section related to EVDEV support.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/80203ccefd77badf5dc58a63047a1da2d303472c
    
    psm - 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 FreeBSD r317814.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/51319286ed34e70b00a709ac36a1120c26d95a5d
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/0c8a908463dd601a860c6ec9e52742684df3e63b
    
    psm - give names to synaptics commands
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/bf33f20d962c1b4443324af205170a35acce63f7
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/3b11e3b6e195d08f6ca6e32464f49b7495697045
    
    psm - Fix Elantech trackpoint support.
    
    Sign bits for X and Y motion data were taken from wrong places.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/8fa46200391063bd5c15a25d9f9b06354fcd4147
    
    psm - Add extra sanity checks to Elantech trackpoint packet parser
    
    Not included are parts related to evedev.
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/6c53fea7d62edeeb7d1e0d2d1da922a3a67c0bce
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/2dd9a967d299a1c0c1363e82a1e3f0c19b4b9846
    
    psm - Add macOS-like three finger drag trackpad gesture
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/5a037b11974c8c74c7df22378633caca71456a53
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/6d3c9beedb7f100922a61f1e089254be24e48547
    
    psm - Do not disable trackpoint when hw.psm.elantech.touchpad_off is enabled
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/8137fb2e38f7b88d2cce9c29a2f00cda33a89d1c
    
    psm - Workaround active PS/2 multiplexor hang
    
    which happens on some laptops after returning to legacy multiplexing mode
    at initialization stage.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/ec45be6c36dcb373103014e16a3623e0c182a5bb
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/2ac1c1927258e649e3ca3269aea40fb4c63e2296
    
    psm - 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2
    
    psm - Disable KVM switch "jitter" clamping for absolute touchpads
    
    FreeBSD commit r123442 [1] 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/bedf31ad7e15c7d3e3ff9e5295bfd5454fbb42fa
    
    [1]: https://svnweb.freebsd.org/base?view=revision&revision=123442
    
    atkbd - Reduce polling rate from 10Hz to ~1Hz
    
    In my understanding this is only needed to workaround lost interrupts.
    I was thinking to remove it completely, but the comment about edge-
    triggered interrupt may be true and needs deeper investigation.  ~1Hz
    should be often enough to handle the supposedly rare loss cases, but
    rare enough to not appear in top.  Add sysctl hw.atkbd.hz to tune it.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/9e007a88d65ba0d23e73c3c052d474a78260d503
    
    psm - Remove write-only variables
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/9b0eb55048e6294c00db70f8ebecf18c1c3c1dbe
    
    psm - Swap the unit member in the softc for a device_t
    
    This also adds a device_log() function to subr_bus.c.
    
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/a6c09f20e8e00bec7d9eb088b4f32dd38bf7f490
    
    psm - Fix typo in comment
    
    s/diable/disable/
    
    Taken-from: FreeBSD
    
    psm - recognize post-IBM trackpoints on Thinkpads
    
    Newer Thinkpads (e.g. X1 Carbon 7th Gen) 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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/2bcef59d428a672a9144c574b4b4f42f5f0e5b2a
    
    psm/atkbd - Sync with FreeBSD (partially)
    
    Drop MOUSE_GETVARS and MOUSE_SETVARS ioctls support
    
    These ioctls are not documented and only stubbed in a few drivers:
    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.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/67580198b70aa58d572a2602a02d1a70d9971350
    
    evdev/psm - update evdev, add evdev-support to psm(4)
    
    * Partially update evdev from FreeBSD and add evdev-support to psm
    
    * Touches ums(4)
    
    atkbd - Disable periodic polling by default
    
    If this cause keyboard/mouse freezes on some hardware, please set
    loader tunable hw.atkbd.hz=1 as workaround and report the issue.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/ce881170088c4c98c036fe561f8ee8413c2e2585
    
    psm - use evdev_register_mtx()
    
    This uses psm_softc->lock for evdev operations
    
    evdev - Hide "kern.evdev.rcpt_mask" sysctl if kernel compiled w/o EVDEV_SUPPORT
    
    Now presence of this sysctl can be used for discovery if evdev support
    for hybrid devices is compiled into kernel or not.
    Hide "kern.evdev.sysmouse_t_axis" sysctl for the same reason.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/233e10741a791bfa570a69804ae40f9fffcdcd43
    
    evdev - Take driver's lock in cdev write handler if necessary
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/f3f8069493a5a9db77a5f660f4f9e613742fdc42
    
    evdev - Disable value normalization and state filtering for SND events
    
    Some events can take sound pitch as a value so can not be represented
    as binary on/off events. Tracking for on/off state is left in place
    as it is a part of the evdev API.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/c6e809423fde2f5ce02b9fef5910c34e434e7c36
    
    evdev - Do not start/stop softrepeat callout if no clients attached
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/37ff33454873d8639d10dc5c72d76fb3a1eb540f
    
    evdev - Fix evdev codes for slash and asterisk numpad keys of AT-keyboards
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/b12ac17ef1928858ed236a9a5851c30f465f8d26
    
    evdev - Fix pause key release event in AT keyboard set 1 to evdev xlat-or
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/a0e9218c019b30a68fe137f8540a8c8da947480b
    
    evdev - export event device properties through sysctl interface
    
    A big security advantage of Wayland is not allowing applications to read
    input devices all the time. Having /dev/input/* accessible to the user
    account subverts this advantage.
    
    libudev-devd was opening the evdev devices to detect their types (mouse,
    keyboard, touchpad, etc). This don't work if /dev/input/* is inaccessible.
    With the kernel exposing this information as sysctls (kern.evdev.input.*),
    we can work w/o /dev/input/* access, preserving the Wayland security model.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/f99e7b1aed7ea65ca0dbe5b182f2b9cbfdfe54db
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/dd3a67a0781261c1fdd670456f492ecb695b8fe5
    
    evdev - return error rather than zero-length data on blocked read()
    
    if blocked process has been woken up by evdev device destruction.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/006eb44926d6949e0b60b21920f1ea93f03efd2f
    
    evdev - Use proper mutex reference in autorepeat callout initialization
    
    This fixes panic occuring when evdev key autorepeat is enabled by driver
    which initializes evdev with external mutex.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/68cc053763eec2f2afef8de8a12f6786805c9e24
    
    evdev - Use LIST_FOREACH_MUTABLE
    
    instead of LIST_FOREACH as we are removing elements in the middle.
    
    This fixes a panic when detaching USB mouse.
    
    Note that LIST_FOREACH_SAFE in FreeBSD corresponds to our
    LIST_FOREACH_MUTABLE.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/5396856ee0e158a1505dce733aad4f9b42afafbb
    
    evdev - Add AT translated set1 scancodes for F-unlocked F1-12 keys
    
    "F lock" is a switch between two sets of scancodes for function keys F1-F12
    found on some Logitech and Microsoft PS/2 keyboards [1]. When "F lock" is
    pressed, then F1-F12 act as function keys and produce usual keyscans for
    these keys. When "F lock" is depressed, F1-F12 produced the same keyscans
    but prefixed with E0.
    Some laptops use [2] E0-prefixed F1-F12 scancodes for non-standard keys.
    
    [1] https://www.win.tue.nl/~aeb/linux/kbd/scancodes-6.html
    [2] https://reviews.freebsd.org/D21565
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/8701adbeb0d4e29c9aae68b493317fb581ae520e
    
    evdev - Sync event codes with Linux kernel 5.6
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/d316504953cf0890433ac2cb75d10c6fcf0c0263
    
    evdev - Add AT translated set1 scancodes for 'Eisu' & 'Kana' keys
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/94811094f8357824108a57169d1f5b1e2ffb56ca
    
    evdev - recognize the Chromebook menu key as F13 like Linux does
    
    This is the key on the right side of the function keys, with the
    "hamburger menu" icon on it.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/54cca285fc3d32e0be4028d17c055424b49f4f7d
    
    evdev - Implement fuzz
    
    Fuzz is used to filter noise from the event stream.
    Upcoming gamepad drivers use it.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/3b2175fdb62c7f872e78ce732952f2ac2ff99c8d
    
    evdev - Linux evdev does not terminate truncated strings with 0
    
    It seems that DragonFly ioctl(2) cannot return the actual length of
    copyouted data as only error=0 is treated as "no-error".
    
    Based-on-FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/7a810290b8f6c6885fdb9917cf590d46fa270a61
    
    Revert "evdev - Linux evdev does not terminate truncated strings with 0"
    
    This reverts commit 12ac6b7825fba8f53f9cbfe3a6aaed27983c1848.
    
    I think it's safer to properly 0-terminate the strings. The only reason
    why this commit landed in FreeBSD was to support a Linux binary Imprivata,
    which we can't run anyways.
    
    evdev - Do not check maximal contact number for MT initialization
    
    This allows singletouch devices which use multitouch protocols to work.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/e40fec4ec9a7a6625b3e332d4f856eb1d05f0def
    
    evdev - Multitouch code style changes
    
    1. Move touch count reporting helpers to utils. They are not multitouch.
    2. Use evdev_mt prefix for private multitouch support routines.
    3. Use int instead of int32_t where fixed size is not required.
    4. Export some internal functions.
    
    This change should be no-op.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/98a7606b85e05132f328a2498dccab78df31cb7e
    
    evdev - Use bitsets to track active touches and slots changed in current report
    
    Obtained from:	OpenBSD
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/2dc7188e532f0147b36a44ce5c033d9f59cbd9f4
    
    evdev - Send first active rather than 0-th slot state as ST report
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/fbe17f9017e785dd564ce7fc5553a9136d3a0b03
    
    kern - Add kern.features sysctl and FEATURE macro
    
    Similar to FreeBSD.
    
    xorg-server checks e.g. for kern.features.evdev or
    kern.features.evdev_support.
    
    Add evdev_support feature
    
    evdev - force no fuzz for autogenerated single touch compat events
    
    As fuzz has already been applied on multitouch event processing.
    This allows to remove existing workaround for double fuzz procesing.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/314913ed7c6e6e1b7c80a1063620f478961419b7
    
    evdev - Normalize width and pressure of single touch compat events
    
    to match Synaptics touchpad reporting range.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/127e54deb6d8899e1dc1bc6251d512e19f21b0f1
    
    evdev - Give short aliases to items of evdev_mt_slot array
    
    with using of unioned anonymous structure.
    
    Access to the same data by using different members of union generally
    works despite it is not supported by C specs.
    
    Also add helper function to report entire slot state.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/059360287e3344f48f5a7839e2d6d54016b18b19
    
    evdev - Make MT tracking IDs monotonically increasing sequence
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/66bd52f5e241bd2548015f847f12cdff69176c40
    
    evdev - Import support for touch-tracking
    
    Touch tracking is a process of assignment of unique trackingID to each
    initiated contact on the surface.  Keeping the trackingIDs persistent
    across multitouch reports requires solving of so called Euclidian
    Bipartite Matching problem.
    
    This commit imports EBM-solver implementation based on Dinitz-Kronrod
    algorithm to find minimum cost matching between contacts listed in two
    consecutive reports.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/4c0a134e32a7f4dec556fea15c8de22f69864492
    Obtained-from: OpenBSD
    
    evdev - Add implicit mode for touch tracking
    
    In implicit mode assignment of slot number and tracking id is performed
    automatically on each synchronization requested by device driver.
    
    This is done with creation of intermediate buffer for multitouch events.
    This buffer holds untracked events until synchronization is requested by
    device driver. It is needed as touch assigment requires
    knowledges of all touch positions pushed in current and previous reports.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/f76051c7dabe952b75127a8031d87d78b603be20
    
    evdev - Add support for automatic MT protocol type A to type B conversion
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/d056693d7bc6c1b5f2c1612e5b34807f173e21c7
    
    evdev - Do not export multitouch functions which are unused outside evdev
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/35bc295b30ef91f1835a0ee0225e8d957a9ebddd
    
    evdev - Fix a typo in a commit
    
    - s/prefered/preferred/
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc
    
    evdev - Fix "hancha" and "han/yong" korean keys handling
    
    The Korean keyboard has two keys, the Korean/Chinese and the
    Korean/English toggles, that generate scancodes 0xF1 and 0xF2
    (respectively) when pressed, and nothing when released. They do not
    repeat.
    As Hanyong/Hancha keys are generally greater than 0x80, which is
    generally considered a release key, add extra preceding press key event
    to generate press/release pair.
    Swap Hanyong/Hancha key codes to match reality.
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/6a26c99f827ffa9da5e23d466eeb17131fc75238
    
    evdev - Sync event codes with Linux kernel 6.5
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/87a53bef41fe769920f925e74fedddafd5187b93
    
    Fix commit "Import support for touch tracking" (afa7dd1f)
    
    - Fix maybe-uninitialized warning
    - use bitcount32
    - bring in bit_foreach_at from FreeBSD
    - reorder "static"
    
    evdev - Sync our copy of freebsd-bitstring.h with FreeBSD
    
    - Mostly using proper functions returning the result
      instead of assigning it to a pointer.
    
    - Specify bit positions using size_t instead of int.
    
    evdev - Conditionalize kern.features.evdev_support
    
    evdev - Sync with FreeBSD
    
    atkbdc: use proper pointer type for KBDC
    
    FreeBSD-commit: https://github.com/freebsd/freebsd-src/commit/e9305818c1ba2762ec0ac40294cde0a4b96806c7
    
    atkbdc - add quirks from FreeBSD
    
    atkbd - sync with FreeBSD
    
    atkbd - Incoorperate patch from bugreport #3206
    
    https://bugs.dragonflybsd.org/issues/3206

Summary of changes:
 sys/bus/u4b/input/ums.c                |   12 +-
 sys/dev/misc/evdev/cdev.c              |    8 +-
 sys/dev/misc/evdev/evdev.c             |  217 +++-
 sys/dev/misc/evdev/evdev.h             |   54 +-
 sys/dev/misc/evdev/evdev_mt.c          |  682 +++++++---
 sys/dev/misc/evdev/evdev_private.h     |   84 +-
 sys/dev/misc/evdev/evdev_utils.c       |   72 +-
 sys/dev/misc/evdev/freebsd-bitstring.h |  265 ++--
 sys/dev/misc/evdev/input-event-codes.h |  149 ++-
 sys/dev/misc/evdev/input.h             |    9 +-
 sys/dev/misc/kbd/atkbd.c               |  750 ++++++-----
 sys/dev/misc/kbd/atkbdc.c              | 1374 ++++++++++++---------
 sys/dev/misc/kbd/atkbdcreg.h           |   22 +-
 sys/dev/misc/kbd/atkbdreg.h            |    2 +-
 sys/dev/misc/kbd/kbd.c                 |   46 +
 sys/dev/misc/kbd/kbdreg.h              |    3 +
 sys/dev/misc/psm/psm.c                 | 2117 ++++++++++++++++++++++++--------
 sys/dev/misc/syscons/sysmouse.c        |    6 -
 sys/kern/kern_mib.c                    |    2 +
 sys/kern/subr_bus.c                    |   42 +
 sys/sys/bus.h                          |    1 +
 sys/sys/mouse.h                        |   17 +-
 sys/sys/sysctl.h                       |    9 +
 23 files changed, 4194 insertions(+), 1749 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a162a738eca94f99d45d88429e86cfd0fbfbe95d


-- 
DragonFly BSD source repository


More information about the Commits mailing list