22 Sep, 2020

2 commits


01 Sep, 2020

1 commit

  • When calling into hid_map_usage(), the passed event code is
    blindly stored as is, even if it doesn't fit in the associated bitmap.

    This event code can come from a variety of sources, including devices
    masquerading as input devices, only a bit more "programmable".

    Instead of taking the event code at face value, check that it actually
    fits the corresponding bitmap, and if it doesn't:
    - spit out a warning so that we know which device is acting up
    - NULLify the bitmap pointer so that we catch unexpected uses

    Code paths that can make use of untrusted inputs can now check
    that the mapping was indeed correct and bail out if not.

    Cc: stable@vger.kernel.org
    Signed-off-by: Marc Zyngier
    Signed-off-by: Benjamin Tissoires

    Marc Zyngier
     

11 Jun, 2020

1 commit

  • Pull input updates from Dmitry Torokhov:

    - a new driver for the Azoteq IQS269A capacitive touch controller

    - a new driver for the Cypress CY8CTMA140 touchscreen

    - updates to Elan and ft5x06 touchscreen drivers

    - assorted driver fixes

    - msm-vibrator has been removed as we have a more generic solution

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (28 commits)
    Input: adi - work around module name confict
    Input: iqs269a - add missing I2C dependency
    Input: elants - refactor elants_i2c_execute_command()
    Input: elants - override touchscreen info with DT properties
    Input: elants - remove unused axes
    Input: add support for Azoteq IQS269A
    dt-bindings: input: Add bindings for Azoteq IQS269A
    Input: imx_sc_key - use devm_add_action_or_reset() to handle all cleanups
    Input: remove msm-vibrator driver
    dt-bindings: Input: remove msm-vibrator
    Input: elants_i2c - provide an attribute to show calibration count
    Input: introduce input_mt_report_slot_inactive()
    dt-bindings: input: touchscreen: elants_i2c: convert to YAML
    Input: add driver for the Cypress CY8CTMA140 touchscreen
    dt-bindings: touchscreen: Add CY8CTMA140 bindings
    Input: edt-ft5x06 - prefer asynchronous probe
    Input: edt-ft5x06 - improve power management operations
    Input: edt-ft5x06 - move parameter restore into helper
    Input: edt-ft5x06 - fix get_default register write access
    Input: atkbd - receive and use physcode->keycode mapping from FW
    ...

    Linus Torvalds
     

27 May, 2020

2 commits

  • After commit c23e2043d5f7 ("HID: multitouch: do not filter mice nodes"),
    MT_CLS_WIN_8 also supports mouse nodes, hence make MT_CLS_WIN_8_DUAL
    redundant.

    Remove MT_CLS_WIN_8_DUAL accordingly.

    Signed-off-by: Kai-Heng Feng
    Signed-off-by: Benjamin Tissoires

    Kai-Heng Feng
     
  • Two touchpad/trackstick combos are currently not behaving properly.
    They define a mouse emulation collection, as per Win8 requirements,
    but also define a separate mouse collection for the trackstick.

    The way the kernel currently treat the collections is that it
    merges both in one device. However, given that the first mouse
    collection already defines X,Y and left, right buttons, when
    mapping the events from the second mouse collection, hid-multitouch
    sees that these events are already mapped, and simply ignores them.

    To be able to report events from the tracktick, add a new quirked
    class for it, and manually add the 2 devices we know about.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=207235
    Cc: stable@vger.kernel.org
    Tested-by: Kai-Heng Feng
    Signed-off-by: Benjamin Tissoires

    Benjamin Tissoires
     

13 May, 2020

1 commit

  • input_mt_report_slot_state() ignores "tool" argument when the slot is
    closed, which has caused a bit of confusion. Let's introduce
    input_mt_report_slot_inactive() to report inactive slot state.

    Suggested-by: Dmitry Torokhov
    Signed-off-by: Jiada Wang
    Link: https://lore.kernel.org/r/20200508055656.96389-2-jiada_wang@mentor.com
    Signed-off-by: Dmitry Torokhov

    Jiada Wang
     

14 Apr, 2020

1 commit


19 Dec, 2019

1 commit

  • 1002 if ((quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) {
    1003 struct input_mt_slot *i_slot = &mt->slots[slotnum];
    1004
    1005 if (input_mt_is_active(i_slot) &&
    1006 input_mt_is_used(mt, i_slot))
    1007 return -EAGAIN;
    1008 }

    We previously assumed 'mt' could be null (see line 1002).

    The following situation is similar, so add a judgement.

    Signed-off-by: Pan Zhang
    Signed-off-by: Benjamin Tissoires

    Pan Zhang
     

09 Dec, 2019

1 commit


22 Aug, 2019

2 commits

  • This panel is not very friendly to us:
    it exposes multiple multitouch collections, some of them being of
    logical application stylus.

    Usually, a device has only one report per application, and that is
    what I assumed in commit 8dfe14b3b47f ("HID: multitouch: ditch mt_report_id")

    To avoid breaking all working device, add a new class and a new quirk
    for that situation.

    Reported-and-tested-by: Matthias Fend
    Signed-off-by: Benjamin Tissoires

    Benjamin Tissoires
     
  • It was a good idea at the time to not create a mouse node for the
    multitouch touchscreens, but:
    - touchscreens following the Win 8 protocol should not have this
    disturbing mouse node anymore, or if they have, it should be
    used for something else (like a joystick attached to the screen)
    - touchpads have it, and they should not use it unless there is a bug,
    but when the laptop has a trackstick, the data are reported through this
    mouse node.

    So instead of whitelisting all of the devices that have a need for the
    mouse node, just export it.
    hid-input.c will append a suffix to it ('Mouse'), so users will eventually
    see if something goes wrong.

    Signed-off-by: Benjamin Tissoires

    Benjamin Tissoires
     

28 Jun, 2019

1 commit

  • Pull HID fixes from Jiri Kosina:

    - fix for one corner case in HID++ protocol with respect to handling
    very long reports, from Hans de Goede

    - power management fix in Intel-ISH driver, from Hyungwoo Yang

    - use-after-free fix in Intel-ISH driver, from Dan Carpenter

    - a couple of new device IDs/quirks from Kai-Heng Feng, Kyle Godbey and
    Oleksandr Natalenko

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
    HID: intel-ish-hid: fix wrong driver_data usage
    HID: multitouch: Add pointstick support for ALPS Touchpad
    HID: logitech-dj: Fix forwarding of very long HID++ reports
    HID: uclogic: Add support for Huion HS64 tablet
    HID: chicony: add another quirk for PixArt mouse
    HID: intel-ish-hid: Fix a use after free in load_fw_from_host()

    Linus Torvalds
     

26 Jun, 2019

1 commit


13 Jun, 2019

1 commit

  • Pull HID fixes from Jiri Kosina:

    - regression fixes (reverts) for module loading changes that turned out
    to be incompatible with some userspace, from Benjamin Tissoires

    - regression fix for special Logitech unifiying receiver 0xc52f, from
    Hans de Goede

    - a few device ID additions to logitech driver, from Hans de Goede

    - fix for Bluetooth support on 2nd-gen Wacom Intuos Pro, from Jason
    Gerecke

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
    HID: logitech-dj: Fix 064d:c52f receiver support
    Revert "HID: core: Call request_module before doing device_add"
    Revert "HID: core: Do not call request_module() in async context"
    Revert "HID: Increase maximum report size allowed by hid_field_extract()"
    HID: a4tech: fix horizontal scrolling
    HID: hyperv: Add a module description line
    HID: logitech-hidpp: Add support for the S510 remote control
    HID: multitouch: handle faulty Elo touch device
    HID: wacom: Sync INTUOSP2_BT touch state after each frame if necessary
    HID: wacom: Correct button numbering 2nd-gen Intuos Pro over Bluetooth
    HID: wacom: Send BTN_TOUCH in response to INTUOSP2_BT eraser contact
    HID: wacom: Don't report anything prior to the tool entering range
    HID: wacom: Don't set tool type until we're in range
    HID: rmi: Use SET_REPORT request on control endpoint for Acer Switch 3 and 5
    HID: logitech-hidpp: add support for the MX5500 keyboard
    HID: logitech-dj: add support for the Logitech MX5500's Bluetooth Mini-Receiver
    HID: i2c-hid: add iBall Aer3 to descriptor override

    Linus Torvalds
     

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

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

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

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

    Thomas Gleixner
     

22 May, 2019

1 commit

  • Since kernel v5.0, one single win8 touchscreen device failed.
    And it turns out this is because it reports 2 InRange usage per touch.

    It's a first, and I *really* wonder how this was allowed by Microsoft in
    the first place. But IIRC, Breno told me this happened *after* a firmware
    upgrade...

    Anyway, better be safe for those crappy devices, and make sure we have
    a full slot before jumping to the next.
    This won't prevent all crappy devices to fail here, but at least we will
    have a safeguard as long as the contact ID and the X and Y coordinates
    are placed in the report after the grabage.

    Fixes: 01eaac7e5713 ("HID: multitouch: remove one copy of values")
    CC: stable@vger.kernel.org # v5.0+
    Reported-and-tested-by: Breno Leitao
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

14 Feb, 2019

1 commit


19 Nov, 2018

1 commit


05 Sep, 2018

3 commits

  • Now that the application is simply stored in struct hid_input, we can
    overwrite it in mt_input_mapping() for the faulty egalax and have a
    simpler suffix processing in mt_input_configured()

    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
     
  • When implementing commit 7f81c8db5489 ("HID: multitouch: simplify
    the settings of the various features"), I wrongly removed a test
    that made sure we never try to set the second InputMode feature
    to something else than 0.

    This broke badly some recent Elan panels that now forget to send the
    click button in some area of the touchpad.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=200899
    Fixes: 7f81c8db5489 ("HID: multitouch: simplify the settings of the various features")
    Cc: stable@vger.kernel.org # v4.18+
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

17 Jul, 2018

9 commits

  • Usually, there is no palm rejection for touchscreens. You don't rest
    your palm on the touchscreen while interacting with it.
    However, some wacom devices do so because you can rest your palm while
    interacting with the stylus.

    Unfortunately, the spec for touchscreens[1] is less precise than the one
    for touchpads[2]. This leads to a situation where it's 'legitimate'
    for a touchscreen to provide both tipswitch off and confidence off in the
    same report.

    Work around that by keeping the slot active for one frame where we report
    MT_TOOL_PALM, and then synthesizing the release event in a separate frame.
    frame

    Acked-by: Peter Hutterer
    Signed-off-by: Dmitry Torokhov
    [rebased and new commit message]
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     
  • According to [1] the confidence is used not only by touchpad devices,
    but also by touchscreens.

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

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

    Dmitry Torokhov
     
  • According to Microsoft specification [1] for Precision Touchpads (and
    Touchscreens) the devices use "confidence" reports to signal accidental
    touches, or contacts that are "too large to be a finger". Instead of
    simply marking contact inactive in this case (which causes issues if
    contact was originally proper and we lost confidence in it later, as
    this results in accidental clicks, drags, etc), let's report such
    contacts as MT_TOOL_PALM and let userspace decide what to do.

    [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/touchpad-windows-precision-touchpad-collection

    Signed-off-by: Dmitry Torokhov
    [splitted and rebased]
    Signed-off-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Dmitry Torokhov
     
  • 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
     
  • The current way of handling multitouch data is not very straightforward:
    - in mt_event() we do nothing
    - in mt_report() we:
    - do some gym to fetch the scantime and the contact count
    - then iterate over the input fields where we copy the data to a
    temporary place
    - when we see the last field in a slot, we then use this data to emit
    the input data

    A more streamlined way is to first get all of the address in the report
    of all fields, and then just pick the fields we are interested in in
    mt_report()

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

    Benjamin Tissoires
     
  • Now that the driver can handle more than one multitouch collection in
    a single HID device, ditch the last bit that contains us to use only
    one mt collection.

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

    Benjamin Tissoires
     
  • If a device has more than one multitouch collection, there is a chance
    we need per tool quirks. This is the case for the Totem on the Dell
    Canvas.

    Note that thesysfs attribute quirks can now get out of sync, but there
    should not be much users of it as it's debugging only.

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

    Benjamin Tissoires
     
  • Currently, hid-multitouch can only handle one multitouch collection at
    a time. This is an issue for the Dell Canvas, as the Totem (a dial tool)
    is also using a multitouch-like collection.

    Factor out the multitouch collection data in their own struct.

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

    Benjamin Tissoires
     
  • const is a magic keyword here :)

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

    Benjamin Tissoires
     

30 May, 2018

1 commit

  • According to [1] and also seemingly agreed by [2], the Scan Time usage
    (0x0D 0x56) is a report level usage, not a contact level usage.

    However, the hid-multitouch driver currently includes HID_DG_SCANTIME
    when calculating `td->last_slot_field', which may lead to
    mt_complete_slot() being prematurely called in certain cases (e.g. when
    each touch input report includes more than one contact and the Scan Time
    usage appears before any contact logical collection).

    This patch fixes the issue by skipping mt_store_field() on
    HID_DG_SCANTIME, similar to how HID_DG_CONTACTCOUNT and
    HID_DG_CONTACTMAX are handled.

    [1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections#windows-precision-touchpad-input-reports
    [2] https://patchwork.kernel.org/patch/1742181/

    Fixes: 29cc309d8bf19 ("HID: hid-multitouch: forward MSC_TIMESTAMP")
    Signed-off-by: Ben Chan
    Reviewed-by: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Ben Chan
     

16 May, 2018

1 commit


26 Apr, 2018

3 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
     
  • The Win8 spec also declare other features we want to support:
    latency and surface and button switches.

    Though it doesn't seem we need to activate those by default, we have been
    proved in the past that manufacturers rely on the Windows driver behavior
    so we better mimic it to prevent further issues.

    The current way of setting the features is cumbersome. It avoids iterating
    over the list of features, but the way we store/retrieve the data just
    doesn't scale with more than two values.

    So iterate over the features when we decide to switch on the device and
    make it simpler to extend.

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

    Benjamin Tissoires
     
  • We now have HID_QUIRK_INPUT_PER_APPLICATION that splits the devices
    into several devices. This helps us as we can now rely on hid-input
    to set the names for us.

    Also, this helps removing some magical numbers '0' when calling
    .input_configured().

    The only thing to take care of is that the field .report in struct
    hid_input is now null. We need to iterate over the full list of
    reports attached to a hid_input.

    This is required for some Advanced Silicon touchscreen to correctly apply
    the HID_QUIRK_INPUT_PER_APPLICATION as they have 2 reports associated
    with the hidinput node. One contains the Input data, the other one
    contains the Output data.

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

    Benjamin Tissoires
     

05 Apr, 2018

2 commits


23 Mar, 2018

2 commits