13 Dec, 2019

1 commit

  • We should not be leaving half-mapped usages with potentially invalid
    keycodes, as that may confuse hidinput_find_key() when the key is located
    by index, which may end up feeding way too large keycode into the VT
    keyboard handler and cause OOB write there:

    BUG: KASAN: global-out-of-bounds in clear_bit include/asm-generic/bitops-instrumented.h:56 [inline]
    BUG: KASAN: global-out-of-bounds in kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline]
    BUG: KASAN: global-out-of-bounds in kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495
    Write of size 8 at addr ffffffff89a1b2d8 by task syz-executor108/1722
    ...
    kbd_keycode drivers/tty/vt/keyboard.c:1411 [inline]
    kbd_event+0xe6b/0x3790 drivers/tty/vt/keyboard.c:1495
    input_to_handler+0x3b6/0x4c0 drivers/input/input.c:118
    input_pass_values.part.0+0x2e3/0x720 drivers/input/input.c:145
    input_pass_values drivers/input/input.c:949 [inline]
    input_set_keycode+0x290/0x320 drivers/input/input.c:954
    evdev_handle_set_keycode_v2+0xc4/0x120 drivers/input/evdev.c:882
    evdev_do_ioctl drivers/input/evdev.c:1150 [inline]

    Cc: stable@vger.kernel.org
    Reported-by: syzbot+19340dff067c2d3835c0@syzkaller.appspotmail.com
    Signed-off-by: Dmitry Torokhov
    Tested-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

14 May, 2019

1 commit

  • Pull input updates from Dmitry Torokhov:
    "A few new drivers:

    - driver for Azoteq IQS550/572/525 touch controllers

    - driver for Microchip AT42QT1050 keys

    - driver for GPIO controllable vibrators

    - support for GT5663 in Goodix driver

    ... along with miscellaneous driver fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: libps2 - mark expected switch fall-through
    Input: qt1050 - add Microchip AT42QT1050 support
    Input: add support for Azoteq IQS550/572/525
    Input: add a driver for GPIO controllable vibrators
    Input: synaptics-rmi4 - fix enum_fmt
    Input: synaptics-rmi4 - fill initial format
    HID: input: add mapping for KEY_KBD_LAYOUT_NEXT
    Input: add KEY_KBD_LAYOUT_NEXT
    Input: hyperv-keyboard - add module description
    Input: olpc_apsp - depend on ARCH_MMP
    Input: sun4i-a10-lradc-keys - add support for A83T
    Input: snvs_pwrkey - use dev_pm_set_wake_irq() to simplify code
    Input: lpc32xx-key - add clocks property and fix DT binding example
    Input: i8042 - signal wakeup from atkbd/psmouse
    Input: goodix - add GT5663 CTP support
    Input: goodix - add regulators suppot
    Input: evdev - use struct_size() in kzalloc() and vzalloc()
    Input: edt-ft5x06 - convert to use SPDX identifier
    Input: edt-ft5x06 - enable ACPI enumeration

    Linus Torvalds
     

11 May, 2019

1 commit


07 May, 2019

1 commit

  • Pull HID updates from Jiri Kosina:

    - support for U2F Zero device, from Andrej Shadura

    - logitech-dj has historically been treating devices behind
    non-unifying receivers as generic devices, using the HID emulation in
    the receiver. That had several shortcomings (special keys handling,
    battery level monitoring, etc). The driver has been reworked to
    enumarate (and directly communicate with) the devices behind the
    receiver, to avoid the (too) generic HID implementation in the
    receiver itself. All the work done by Benjamin Tissoires and Hans de
    Goede.

    - restructuring of intel-ish driver in order to allow for multiple
    clients of the ISH implementation, from Srinivas Pandruvada

    - several other smaller fixes and assorted device ID additions

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (68 commits)
    HID: logitech-dj: fix spelling in printk
    HID: input: fix assignment of .value
    HID: input: make sure the wheel high resolution multiplier is set
    HID: logitech-dj: add usbhid dependency in Kconfig
    HID: logitech-hidpp: add support for HID++ 1.0 consumer keys reports
    HID: logitech-hidpp: add support for HID++ 1.0 extra mouse buttons reports
    HID: logitech-hidpp: add support for HID++ 1.0 wheel reports
    HID: logitech-hidpp: make hidpp10_set_register_bit a bit more generic
    HID: logitech-hidpp: add input_device ptr to struct hidpp_device
    HID: logitech-hidpp: do not hardcode very long report length
    HID: logitech-hidpp: handle devices attached to 27MHz wireless receivers
    HID: logitech-hidpp: use RAP instead of FAP to get the protocol version
    HID: logitech-hidpp: remove unused origin_is_hid_core function parameter
    HID: logitech-hidpp: remove double assignment from __hidpp_send_report
    HID: logitech-hidpp: do not make failure to get the name fatal
    HID: logitech-hidpp: ignore very-short or empty names
    HID: logitech-hidpp: make .probe usbhid capable
    HID: logitech-hidpp: allow non HID++ devices to be handled by this module
    HID: logitech-dj: add support for Logitech Bluetooth Mini-Receiver
    HID: logitech-dj: make appending of the HID++ descriptors conditional
    ...

    Linus Torvalds
     

27 Apr, 2019

1 commit


24 Apr, 2019

2 commits

  • The value field is actually an array of .maxfield. We should assign the
    correct number to the correct usage.

    Not that we never encounter a device that requires this ATM, but better
    have the proper code path.

    Fixes: 2dc702c991e377 ("HID: input: use the Resolution Multiplier for
    high-resolution scrolling")
    Cc: stable@vger.kernel.org # v5.0+
    Signed-off-by: Benjamin Tissoires

    Benjamin Tissoires
     
  • Some old mice have a tendency to not accept the high resolution multiplier.
    They reply with a -EPIPE which was previously ignored.

    Force the call to resolution multiplier to be synchronous and actually
    check for the answer. If this fails, consider the mouse like a normal one.

    Fixes: 2dc702c991e377 ("HID: input: use the Resolution Multiplier for
    high-resolution scrolling")
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1700071
    Reported-and-tested-by: James Feeney
    Cc: stable@vger.kernel.org # v5.0+
    Signed-off-by: Benjamin Tissoires

    Benjamin Tissoires
     

20 Apr, 2019

1 commit

  • Pull input updates from Dmitry Torokhov:

    - several new key mappings for HID

    - a host of new ACPI IDs used to identify Elan touchpads in Lenovo
    laptops

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
    Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ
    HID: input: add mapping for "Toggle Display" key
    HID: input: add mapping for "Full Screen" key
    HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys
    HID: input: add mapping for Expose/Overview key
    HID: input: fix mapping of aspect ratio key
    [media] doc-rst: switch to new names for Full Screen/Aspect keys
    Input: document meanings of KEY_SCREEN and KEY_ZOOM
    Input: elan_i2c - add hardware ID for multiple Lenovo laptops

    Linus Torvalds
     

03 Apr, 2019

1 commit


27 Mar, 2019

5 commits


14 Feb, 2019

1 commit


07 Dec, 2018

1 commit

  • Windows uses a magic number of 120 for a wheel click. High-resolution
    scroll wheels are supposed to use a fraction of 120 to signal smaller
    scroll steps. This is implemented by the Resolution Multiplier in the
    device itself.

    If the multiplier is present in the report descriptor, set it to the
    logical max and then use the resolution multiplier to calculate the
    high-resolution events. This is the recommendation by Microsoft, see
    http://msdn.microsoft.com/en-us/windows/hardware/gg487477.aspx

    Note that all mice encountered so far have a logical min/max of 0/1, so
    it's a binary "yes or no" to high-res scrolling anyway.

    To make userspace simpler, always enable the REL_WHEEL_HI_RES bit. Where
    the device doesn't support high-resolution scrolling, the value for the
    high-res data will simply be a multiple of 120 every time. For userspace,
    if REL_WHEEL_HI_RES is available that is the one to be used.

    Potential side-effect: a device with a Resolution Multiplier applying to
    other Input items will have those items set to the logical max as well.
    This cannot easily be worked around but it is doubtful such devices exist.

    Signed-off-by: Peter Hutterer
    Verified-by: Harry Cutts
    Signed-off-by: Benjamin Tissoires

    Peter Hutterer
     

22 Nov, 2018

2 commits


12 Nov, 2018

1 commit

  • The Motorola/Zebra Symbol DS4308-HD is a handheld USB barcode scanner
    which does not have a battery, but reports one anyway that always has
    capacity 2.

    Let's apply the IGNORE quirk to prevent it from being treated like a
    power supply so that userspaces don't get confused that this
    accessory is almost out of power and warn the user that they need to charge
    their wired barcode scanner.

    Reported here: https://bugs.chromium.org/p/chromium/issues/detail?id=804720

    Signed-off-by: Benson Leung
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Benjamin Tissoires

    Benson Leung
     

30 Oct, 2018

1 commit

  • Commit 1ff2e1a44e02 ("HID: input: Create a utility class for counting
    scroll events") created the helper function

    hid_scroll_counter_handle_scroll()

    to handle high-res scroll events and also expose them as regular wheel
    events.

    But the resulting algorithm was unstable, and causes scrolling to be
    very unreliable. When you hit the half-way mark of the highres
    multiplier, small highres movements will incorrectly translate into big
    traditional wheel movements, causing odd jitters.

    Simplify the code and make the output stable.

    NOTE! I'm pretty sure this will need further tweaking. But this at
    least turns a unusable mouse wheel on my Logitech MX Anywhere 2S into
    a usable one.

    Cc: Jiri Kosina
    Cc: Harry Cutts
    Cc: Benjamin Tissoires
    Cc: Peter Hutterer
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

23 Oct, 2018

2 commits


05 Sep, 2018

4 commits

  • Some system may want to know if a detected digitizer device is either an
    integrated or an external device. In order to distinguish such condition,
    setting either INPUT_PROP_DIRECT or INPUT_PROP_POINTER is required,
    checking the member, "application", in "hid_field" structure.

    Signed-off-by: Tatsunosuke Tobita
    Reviewed-by: Ping Cheng
    Signed-off-by: Jiri Kosina

    Tatsunosuke Tobita
     
  • To avoid code duplication, this class counts high-resolution scroll
    movements and emits the legacy low-resolution events when appropriate.
    Drivers should be able to create one instance for each scroll wheel that
    they need to handle.

    Signed-off-by: Harry Cutts
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Harry Cutts
     
  • Or it creates some weird input names like:
    "MI Dongle MI Wireless Mouse Mouse"

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • commit f07b3c1da92d ("HID: generic: create one input report per
    application type") was effectively the same as MULTI_INPUT:
    hidinput->report was never set, so hidinput_match_application()
    always returned null.

    Fix that by testing against the real application.

    Note that this breaks some old eGalax touchscreens that expect MULTI_INPUT
    instead of HID_QUIRK_INPUT_PER_APP. Enable this quirk for backward
    compatibility on all non-Win8 touchscreens.

    link: https://bugzilla.kernel.org/show_bug.cgi?id=200847
    link: https://bugzilla.kernel.org/show_bug.cgi?id=200849
    link: https://bugs.archlinux.org/task/59699
    link: https://github.com/NixOS/nixpkgs/issues/45165

    Cc: stable@vger.kernel.org # v4.18+
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

28 Aug, 2018

1 commit


17 Jul, 2018

1 commit

  • The Dell Canvas 27 has a tool that can be put on the surface and acts
    as a dial. The firmware processes the detection of the tool and forward
    regular HID reports with X, Y, Azimuth, rotation, width/height.

    The firmware also exports Contact ID, Countact Count which may hint that
    several totems can be used at the same time (the FW only supports one).

    We can tell that MT_TOOL_DIAL will be reported by setting the min/max
    of ABS_MT_TOOL_TYPE to MT_TOOL_DIAL.

    This tool is aimed at being used by the system and not the applications,
    so the user space processing should not go through the regular touch
    inputs.
    We set INPUT_PROP_DIRECT which applies ID_INPUT_TOUCHSCREEN to this new
    type of devices, but we will counter this for the time being with the
    special udev hwdb entry mentioned above.

    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1511846

    Acked-by: Peter Hutterer
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

08 Jun, 2018

1 commit


26 Apr, 2018

3 commits

  • Given that we create one input node per application, we should name
    the input node accordingly to not lose userspace.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • It is not a good idea to try to fit all types of applications in the
    same input report. There are a lot of devices that are needing
    the quirk HID_MULTI_INPUT but this quirk doesn't match the actual HID
    description as it is based on the report ID.

    Given that most devices with MULTI_INPUT I can think of split nicely
    the devices inputs into application, it is a good thing to split the
    devices by default based on this assumption.

    Also make hid-multitouch following this rule, to not have to deal
    with too many input created.

    While we are at it, fix some checkpatch complaints about converting
    'unsigned' to 'unsigned int'.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • We were only storing the report in case of QUIRK_MULTI_INPUT.
    It is interesting for the upcoming HID_QUIRK_INPUT_PER_APP to also
    store the full list of reports that are attached to it.

    We need the full list because a device (Advanced Silicon has some)
    might want to use a different report ID for the Input reports and
    the Output reports. Storing the full list allows the drivers to
    have all the data.

    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

17 Apr, 2018

1 commit

  • This is something that bothered us from a long time. When hid-input
    doesn't know how to map a usage, it uses *_MISC. But there is something
    else which increments the usage if the evdev code is already used.

    This leads to few issues:
    - some devices may have their ABS_X mapped to ABS_Y if they export a bad
    set of usages (see the DragonRise joysticks IIRC -> fixed in a specific
    HID driver)
    - *_MISC + N might (will) conflict with other defined axes (my Logitech
    H800 exports some multitouch axes because of that)
    - this prevents to freely add some new evdev usages, because "hey, my
    headset will now report ABS_COFFEE, and it's not coffee capable".

    So let's try to kill this nonsense, and hope we won't break too many
    devices.

    I my headset case, the ABS_MISC axes are created because of some
    proprietary usages, so we might not break that many devices.

    For backward compatibility, a quirk HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE
    is created and can be applied to any device that needs this behavior.

    Signed-off-by: Benjamin Tissoires
    Acked-by: Peter Hutterer
    Acked-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

09 Apr, 2018

1 commit

  • The commit 581c4484769e ("HID: input: map digitizer battery usage")
    assumed that devices having input (qas opposed to feature) report for
    battery strength would report the data on their own, without the need to
    be polled by the kernel; unfortunately it is not so. Many wireless mice
    do not send unsolicited reports with battery strength data and have to
    be polled explicitly. As a complication, stylus devices on digitizers
    are not normally connected to the base and thus can not be polled - the
    base can only determine battery strength in the stylus when it is in
    proximity.

    To solve this issue, we add a special flag that tells the kernel
    to avoid polling the device (and expect unsolicited reports) and set it
    when report field with physical usage of digitizer stylus (HID_DG_STYLUS).
    Unless this flag is set, and we have not seen the unsolicited reports,
    the kernel will attempt to poll the device when userspace attempts to
    read "capacity" and "state" attributes of power_supply object
    corresponding to the devices battery.

    Fixes: 581c4484769e ("HID: input: map digitizer battery usage")
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=198095
    Cc: stable@vger.kernel.org
    Reported-and-tested-by: Martin van Es
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     

05 Apr, 2018

1 commit


23 Mar, 2018

1 commit


16 Feb, 2018

1 commit

  • Follow the change of return type u32 of hid_report_len,
    fix all the types of variables those get the return value of
    hid_report_len to u32, and all other code already uses u32.

    Cc: stable@vger.kernel.org
    Signed-off-by: Aaron Ma
    Signed-off-by: Jiri Kosina

    Aaron Ma
     

05 Oct, 2017

1 commit


15 Aug, 2017

1 commit

  • The power_supply subsystem tends to emit uevent every time
    power_supply_changed() is called, so we should call this API only when battery
    strength reported by the device is actually different from the previous
    readings, otherwise we'll drown the system in uevents.

    Fixes: 581c4484769e ("HID: input: map digitizer battery usage")
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov