13 Dec, 2018

1 commit


05 Sep, 2018

2 commits

  • 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

5 commits


06 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
     

01 Dec, 2017

1 commit

  • The current hid-multitouch driver only allow the report of two
    orientations, vertical and horizontal. We use the Azimuth orientation
    usage 0x3F under the Digitizer usage page to report orientation if the
    device supports it.

    Changelog:
    v1 -> v2:
    - Fix commit message.
    - Remove resolution reporting for ABS_MT_ORIENTATION.
    v2 -> v3:
    - Fix commit message.
    v3 -> v4:
    - Fix ABS_MT_ORIENTATION ABS param range.
    - Don't set ABS_MT_ORIENTATION in ABS_DG_HEIGHT when it is already
    set by ABS_DG_AZIMUTH.
    v4 -> v5:
    - Improve multi-touch-protocol.rst documentation.

    Signed-off-by: Wei-Ning Huang
    Signed-off-by: Wei-Ning Huang
    Reviewed-by: Dmitry Torokhov
    Reviewed-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Wei-Ning Huang
     

22 Nov, 2017

4 commits

  • According to the Win8 Precision Touchpad spec, inside the HID_UP_BUTTON
    usage-page usage 1 is for a clickpad getting clicked, 2 for an external
    left button and 3 for an external right button. Since Linux uses
    BTN_LEFT for a clickpad being clicked we end up mapping both usage 1
    and 2 to BTN_LEFT and if a single report contains both then we ended
    up always reporting the value of both in a single SYN, e.g. :
    BTN_LEFT 1, BTN_LEFT 0, SYN. This happens for example with Hantick
    HTT5288 i2c mt touchpads.

    This commit fixes this by not immediately reporting left button when we
    parse the report, but instead storing or-ing together the values and
    reporting the result from mt_sync_frame() when we've a complete frame.

    Signed-off-by: Hans de Goede
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Hans de Goede
     
  • Devices in "single finger hybrid mode" will send one report per finger,
    on some devices only the first report of such a multi-packet frame will
    contain a value for BTN_LEFT, in subsequent reports (if multiple fingers
    are down) the value is always 0, causing hid-mt to report BTN_LEFT going
    1 - 0 - 1 - 0 when pressing a clickpad and putting down a second finger.
    This happens for example on USB 0603:0002 mt touchpads.

    This commit fixes this by only reporting non touch fields for the first
    packet of a (possibly) multi-packet frame.

    Signed-off-by: Hans de Goede
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Hans de Goede
     
  • The Windows Precision Touchpad spec "Figure 4 Button Only Down and Up"
    and "Table 9 Report Sequence for Button Only Down and Up" indicate
    that the first packet of a (possibly hybrid mode multi-packet) frame
    may contain a contact-count of 0 if only a button is pressed and no
    fingers are detected.

    This means that a value of 0 for contact-count is a valid value and
    should be used as expected contact count when it is the first packet
    (num_received == 0), as extra check to make sure that this is the first
    packet of a buttons only frame, we also check that the timestamp is
    different.

    Signed-off-by: Hans de Goede
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Hans de Goede
     
  • Fix alphabetic sorting of mt_devices hid_device_id table.

    Signed-off-by: Hans de Goede
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Hans de Goede
     

15 Nov, 2017

2 commits


11 Oct, 2017

1 commit

  • In preparation for unconditionally passing the struct timer_list pointer to
    all timer callbacks, switch to using the new timer_setup() and from_timer()
    (introduced by 686fef928bba ("timer: Prepare to change timer callback
    argument type")) to pass the timer pointer explicitly. Adds pointer back to
    hid_device for multitouch.

    [jkosina@suse.cz: extend changelog a little bit as asked for by Benjamin]
    Cc: Jiri Kosina
    Cc: Benjamin Tissoires
    Cc: linux-input@vger.kernel.org
    Cc: linux-usb@vger.kernel.org
    Cc: Thomas Gleixner
    Signed-off-by: Kees Cook
    Reviewed-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Kees Cook
     

05 Oct, 2017

1 commit

  • Computes and forwards the device timestamp according to the specification.

    Many devices use a 16-bit timestamp field, with a resolution of 100us,
    therefore rolling around very frequently (every 6.5 seconds). To make sure
    there is no ambiguity, the timestamp reported to the input stack reset to
    0 whenever the time between 2 received events is greater than
    MAX_TIMESTAMP_INTERVAL (1 second).

    Signed-off-by: Nicolas Boichat
    Acked-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Nicolas Boichat
     

02 Oct, 2017

1 commit


06 Sep, 2017

3 commits


05 Sep, 2017

1 commit