05 Mar, 2020

1 commit

  • commit 84a4062632462c4320704fcdf8e99e89e94c0aba upstream.

    We have a HID touch device that reports its opens and shorts test
    results in HID buffers of size 8184 bytes. The maximum size of the HID
    buffer is currently set to 4096 bytes, causing probe of this device to
    fail. With this patch we increase the maximum size of the HID buffer to
    8192 bytes, making device probe and acquisition of said buffers succeed.

    Signed-off-by: Johan Korsnes
    Cc: Alan Stern
    Cc: Armando Visconti
    Cc: Jiri Kosina
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Johan Korsnes
     

18 Sep, 2019

2 commits


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
     

06 May, 2019

1 commit


24 Apr, 2019

2 commits

  • 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
     
  • Most Logitech wireless keyboard and mice using the 27 MHz are hidpp10
    devices, add support to logitech-dj for their receivers.

    Doing so leads to 2 improvements:

    1) All these devices share the same USB product-id for their receiver,
    making it impossible to properly map some special keys / buttons
    which differ from device to device. Adding support to logitech-dj to
    see these as hidpp10 devices allows us to get the actual device-id
    from the keyboard / mouse.

    2) It enables battery-monitoring of these devices

    This patch uses a new HID group for 27Mhz devices, since the logitech-hidpp
    code needs to be able to differentiate them from other devices instantiated
    by the logitech-dj code.

    Signed-off-by: Hans de Goede
    Signed-off-by: Benjamin Tissoires

    Hans de Goede
     

02 Apr, 2019

1 commit

  • As seen on some USB wireless keyboards manufactured by Primax, the HID
    parser was using some assumptions that are not always true. In this case
    it's s the fact that, inside the scope of a main item, an Usage Page
    will always precede an Usage.

    The spec is not pretty clear as 6.2.2.7 states "Any usage that follows
    is interpreted as a Usage ID and concatenated with the Usage Page".
    While 6.2.2.8 states "When the parser encounters a main item it
    concatenates the last declared Usage Page with a Usage to form a
    complete usage value." Being somewhat contradictory it was decided to
    match Window's implementation, which follows 6.2.2.8.

    In summary, the patch moves the Usage Page concatenation from the local
    item parsing function to the main item parsing function.

    Signed-off-by: Nicolas Saenz Julienne
    Reviewed-by: Terry Junge
    Signed-off-by: Benjamin Tissoires

    Nicolas Saenz Julienne
     

16 Jan, 2019

1 commit


10 Jan, 2019

1 commit

  • Previously, the pointer to the parent collection was stored. If a device
    exceeds 16 collections (HID_DEFAULT_NUM_COLLECTIONS), the array to store
    the collections is reallocated, the pointer to the parent collection becomes
    invalid.

    Replace the pointers with an index-based lookup into the collections array.

    Fixes: c53431eb696f3c ("HID: core: store the collections as a basic tree")
    Reported-by: Pandruvada, Srinivas
    Signed-off-by: Peter Hutterer
    Tested-by: Kyle Pelton
    Signed-off-by: Jiri Kosina

    Peter Hutterer
     

03 Jan, 2019

1 commit


07 Dec, 2018

3 commits

  • 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
     
  • The Resolution Multiplier is a feature report that modifies the value of
    Usages within the same Logical Collection. If the multiplier is set to
    anything but 1, the hardware reports (value * multiplier) for the same amount
    of physical movement, i.e. the value we receive in the kernel is
    pre-multiplied.

    The hardware may either send a single (value * multiplier), or by sending
    multiplier as many reports with the same value, or a combination of these two
    options. For example, when the Microsoft Sculpt Ergonomic mouse Resolution
    Multiplier is set to 12, the Wheel sends out 12 for every detent but AC Pan
    sends out a value of 3 at 4 times the frequency.

    The effective multiplier is based on the physical min/max of the multiplier
    field, a logical min/max of [0,1] with a physical min/max of [1,8] means the
    multiplier is either 1 or 8.

    The Resolution Multiplier was introduced for high-resolution scrolling in
    Windows Vista and is commonly used on Microsoft mice.

    The recommendation for the Resolution Multiplier is to default to 1 for
    backwards compatibility. This patch adds an arbitrary upper limit at 255. The
    only known use case for the Resolution Multiplier is for scroll wheels where the
    multiplier has to be a fraction of 120 to work with Windows.

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

    Peter Hutterer
     
  • For each collection parsed, store a pointer to the parent collection
    (if any). This makes it a lot easier to look up which collection(s)
    any given item is part of

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

    Peter Hutterer
     

05 Dec, 2018

2 commits

  • The ASUS laptops start to support the airplane mode radio management
    to replace the original mechanism of airplane mode toggle hotkey.
    On the ASUS P5440FF, it presents as a HID device connecting via
    I2C, named i2c-AMPD0001. When pressing it, the Embedded Controller
    send hid report via I2C and switch the airplane mode indicator LED
    based on the status.

    However, it's not working because it fails to be identified as a
    hidinput device. It fails in hidinput_connect() due to the macro
    IS_INPUT_APPLICATION doesn't have HID_GD_WIRELESS_RADIO_CTLS as
    a legit application code.

    It's easy to add the HID I2C vendor and product id to the quirk
    list and apply HID_QUIRK_HIDINPUT_FORCE to make it work. But it
    makes more sense to support it as a generic input application.

    Signed-off-by: Chris Chiu
    Signed-off-by: Benjamin Tissoires

    Chris Chiu
     
  • Add missing definition for HID_DG_WHITEBOARD then replace the hid
    usage hex with macros for better readibility.

    Signed-off-by: Chris Chiu
    Signed-off-by: Benjamin Tissoires

    Chris Chiu
     

22 Nov, 2018

1 commit


06 Nov, 2018

1 commit

  • The documentation for the .raw_event() callback says that if the
    driver return 1, there will be no further processing of the event,
    but this is not true, the actual code in hid-core.c looks like this:

    if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
    ret = hdrv->raw_event(hid, report, data, size);
    if (ret < 0)
    goto unlock;
    }

    ret = hid_report_raw_event(hid, type, data, size, interrupt);

    The only return value that has any effect on the processing is
    a negative error.

    Correct this as it seems to confuse people: I found bogus code in
    the Razer out-of-tree driver attempting to return 1 here.

    Signed-off-by: Linus Walleij
    Signed-off-by: Jiri Kosina

    Linus Walleij
     

23 Oct, 2018

1 commit


05 Sep, 2018

2 commits

  • 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
     
  • 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
     

21 Aug, 2018

1 commit


23 Jul, 2018

1 commit


17 Jul, 2018

2 commits

  • Looks like 4 was sufficient until now. However, the Surface Dial needs
    a stack of 5 and simply fails at probing.
    Dynamically add HID_COLLECTION_STACK_SIZE to the size of the stack if
    we hit the upper bound.

    Checkpatch complains about bare unsigned, so converting those to
    'unsigned int' in struct hid_parser

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

    Benjamin Tissoires
     
  • 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
     

25 Jun, 2018

1 commit

  • Detected on the Dell XPS 9365.

    The laptop has 2 devices that benefit from the hid-generic auto-unbinding.
    When those 2 devices are presented to the userspace, udev loads both wacom and
    hid-multitouch. When this happens, the code in __hid_bus_reprobe_drivers() is
    called concurrently and the second device gets reprobed twice.

    An other bug in the power_supply subsystem prevent to remove the wacom driver
    if it just finished its initialization, which basically kills the wacom node.

    [jkosina@suse.cz: reformat changelog a bit]
    Fixes c17a7476e4c4 ("HID: core: rewrite the hid-generic automatic unbind")
    Cc: stable@vger.kernel.org # v4.17
    Tested-by: Mario Limonciello
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

08 Jun, 2018

1 commit


15 May, 2018

1 commit

  • There are two ways to connect the Steam Controller: directly to the USB
    or with the USB wireless adapter. Both methods are similar, but the
    wireless adapter can connect up to 4 devices at the same time.

    The wired device will appear as 3 interfaces: a virtual mouse, a virtual
    keyboard and a custom HID device.

    The wireless device will appear as 5 interfaces: a virtual keyboard and
    4 custom HID devices, that will remain silent until a device is actually
    connected.

    The custom HID device has a report descriptor with all vendor specific
    usages, so the hid-generic is not very useful. In a PC/SteamBox Valve
    Steam Client provices a software translation by using hidraw and a
    creates a uinput virtual gamepad and XTest keyboard/mouse.

    This driver intercepts the hidraw usage, so it can get out of the way
    when the Steam Client is in use.

    Signed-off-by: Rodrigo Rivas Costa
    Signed-off-by: Jiri Kosina

    Rodrigo Rivas Costa
     

26 Apr, 2018

4 commits

  • The Win 8.1 precision touchpad spec introduce new modes for touchpads
    that can come in handy[1].

    Implement the settings of these modes, so we are not taken off-guard if
    a firmware decides to enforce them.

    [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections

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

    Benjamin Tissoires
     
  • 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

2 commits


23 Mar, 2018

3 commits

  • There is no real point of registering an empty input node.
    This should be default, but given some drivers need the blank input
    node to set it up during input_configured, we need to postpone
    the check for hidinput_has_been_populated().

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

    Benjamin Tissoires
     
  • This should prevent future mess ups fortunately.

    Signed-off-by: Benjamin Tissoires
    Acked-by: Peter Hutterer
    --
    include/linux/hid.h | 52 ++++++++++++++++++++++++++--------------------------
    1 file changed, 26 insertions(+), 26 deletions(-)
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • This can lead to some hairy situation with the developer losing
    a day or two realizing that 4 should be after 2, not 3.

    Signed-off-by: Benjamin Tissoires
    Reviewed-by: Dmitry Torokhov
    Acked-by: Peter Hutterer
    --
    include/linux/hid.h | 13 +++++++------
    1 file changed, 7 insertions(+), 6 deletions(-)
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

06 Mar, 2018

1 commit