wulf7 / iichid

Generic HID layer for FreeBSD. Including I2C and USB backends.
BSD 2-Clause "Simplified" License
45 stars 6 forks source link

Tapping or Clicking not working on HP Specte x360 13-ap0043dx #4

Closed neelchauhan closed 5 years ago

neelchauhan commented 5 years ago

First off, thank you so much for your work on this repository and the previous HP Synaptics patches you wrote.

I recently got a HP Spectre x360 13-ap0043dx as a gift. Unlike my previous EliteBooks (which were all eBay refurbs), the Spectre (meaning my laptop, not the vulnerability) was bought brand-new.

The touchpad is a Synaptics I2C-only (meaning no PS/2) model and I am unable to tap or click. The Spectre also has an Elantech I2C touchscreen which works fine.

However, I am able to touch using the touchscreen, and move the cursor and scroll up/down using the touchpad.

Here are the attached files:

I am using the following patches:

If you need more information,

The self-written patches have been posted to Bugzilla.

wulf7 commented 5 years ago

I recently got a HP Spectre x360 13-ap0043dx

I am a lucky man. My "HP Spectre 13-af006ur" still supports PS/2 as a fallback option :-) But, unfortunately, the primary interface is SMBUS so I can't test any I2c stuff with it.

The touchpad is a Synaptics I2C-only (meaning no PS/2) model and I am unable to tap or click.

Tap failing is expected as according to your dmesg, touchpad is running in polling mode where fingers release events are lost very often at my experience.

Try add following snippet to ig4iic_pci_methods array in /usr/src/sys/dev/ichiic/ig4_pci.c and rebuild kernel or ig4.ko

/* Bus interface */
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),

The initial goal is to get "iichidX: allocated irq at 0xXXXXXXXXXXXXXX and rid 0" string in dmesg output instead of "iichidX: IRQ allocation failed. Fallback to sampling."

neelchauhan commented 5 years ago

Unfortunately, I still have an issue even with your patch:

iichid1: IRQ allocation failed. Fallback to sampling.
imt1: <SYNA327E> on iichid1
imt1: 15 contacts and [C]. Report range [0:0] - [1392:672]
iichid1: HID command I2C_HID_CMD_GET_REPORT 8 (type 3, len 2)
iichid1: response: 04 00 08 05
imt1: 5 feature report contacts
iichid1: HID command I2C_HID_CMD_GET_REPORT 7 (type 3, len 257)
iichid1: response: 03 01 07 05 a1 01 85 02 09 01 a1 00 05 09 19 01 29 02 15 00 25 01 75 01 95 02 81 02 95 06 81 01 05 01 09 30 09 31 15 81 25 7f 75 08 95 02 81 06 c0 c0 06 00 ff 09 01 a1 01 85 09 09 02 15 00 26 ff 00 75 08 95 14 91 02 85 0a 09 03 15 00 26 ff 00 75 08 95 14 91 02 85 0b 09 04 15 00 26 ff 00 75 08 95 3d 81 02 85 0c 09 05 15 00 26 ff 00 75 08 95 3d 81 02 85 1d 09 0a 15 00 26 ff 00 35 00 46 ff 00 75 08 95 01 81 02 85 0f 09 06 15 00 26 ff 00 75 08 95 03 b1 02 85 0e 09 07 15 00 26 ff 00 75 08 95 01 b1 02 85 1f 09 09 15 00 26 ff 00 75 08 95 01 b1 02 c0 05 0d 09 05 a1 01 85 03 05 0d 09 22 a1 02 15 00 25 01 09 47 09 42 95 02 75 01 81 02 95 01 75 03 25 05 09 51 81 02 75 01 95 03 81 03 05 01 15 00 26 70 05 75 10 55 0e 65 11 09 30 35 00 46 87 04 95 01 81 02 46 30 02 26 a0 02 09 31
iichid1: HID command I2C_HID_CMD_GET_REPORT 4 (type 3, len 2)
iichid1: HID command I2C_HID_CMD_SET_REPORT 4 (type 3, len 2): 04 03
iichid1: HID command I2C_HID_CMD_SET_POWER(1)
wulf7 commented 5 years ago

iichid1: IRQ allocation failed. Fallback to sampling.

It is still in polling mode. Most probably it requires GPIO interrupt support which is not done for FreeBSD yet.

sysctl dev.iichid.1.sampling_rate=125 should help to some extent, but I doubt that it solves the problem entirely. I will try to create a workaround to the problem but it will take some time.

About clicks: Could you post here evdev capabilities of your touchpad. They can de obtained with evemu-record tool of devel/evemu port

neelchauhan commented 5 years ago

sysctl dev.iichid.1.sampling_rate=125 doesn't help for me. You're probably right, the touchpad uses GPIO interrupts. However, take your time, there's no rush.

Luckily, I just got my USB-C mouse today (I live in New York, US) so I can use FreeBSD on my laptop while I wait for the touchpad to be fully supported. The USB-A port is used by a Wi-Fi dongle (well, the Intel AC 9560 Wi-Fi isn't supported either, but then this isn't some refurbushed 5-year-old ThinkPad with the advantage of years of support).

The evemu-record output is below:

# EVEMU 1.3
# Kernel: 13.0-CURRENT
# Input device name: "SYNA327E"
# Input device ID: bus 0x18 vendor 0x6cb product 0xcd4f version 0x206
# Size in mm: 116x56
# Supported events:
#   Event type 0 (EV_SYN)
#     Event code 0 (SYN_REPORT)
#     Event code 1 (SYN_CONFIG)
#     Event code 2 (SYN_MT_REPORT)
#     Event code 3 (SYN_DROPPED)
#     Event code 4 ((null))
#     Event code 5 ((null))
#     Event code 6 ((null))
#     Event code 7 ((null))
#     Event code 8 ((null))
#     Event code 9 ((null))
#     Event code 10 ((null))
#     Event code 11 ((null))
#     Event code 12 ((null))
#     Event code 13 ((null))
#     Event code 14 ((null))
#     Event code 15 (SYN_MAX)
#   Event type 1 (EV_KEY)
#     Event code 325 (BTN_TOOL_FINGER)
#     Event code 328 (BTN_TOOL_QUINTTAP)
#     Event code 330 (BTN_TOUCH)
#     Event code 333 (BTN_TOOL_DOUBLETAP)
#     Event code 334 (BTN_TOOL_TRIPLETAP)
#     Event code 335 (BTN_TOOL_QUADTAP)
#   Event type 3 (EV_ABS)
#     Event code 0 (ABS_X)
#       Value      788
#       Min          0
#       Max       1392
#       Fuzz         0
#       Flat         0
#       Resolution  12
#     Event code 1 (ABS_Y)
#       Value      283
#       Min          0
#       Max        672
#       Fuzz         0
#       Flat         0
#       Resolution  12
#     Event code 47 (ABS_MT_SLOT)
#       Value        0
#       Min          0
#       Max          4
#       Fuzz         0
#       Flat         0
#       Resolution   0
#     Event code 53 (ABS_MT_POSITION_X)
#       Value        0
#       Min          0
#       Max       1392
#       Fuzz         0
#       Flat         0
#       Resolution  12
#     Event code 54 (ABS_MT_POSITION_Y)
#       Value        0
#       Min          0
#       Max        672
#       Fuzz         0
#       Flat         0
#       Resolution  12
#     Event code 57 (ABS_MT_TRACKING_ID)
#       Value        0
#       Min          0
#       Max          5
#       Fuzz         0
#       Flat         0
#       Resolution   0
# Properties:
#   Property  type 0 (INPUT_PROP_POINTER)
#   Property  type 2 (INPUT_PROP_BUTTONPAD)
neelchauhan commented 5 years ago

Your recent commits have fixed the issue. Thank you!

Even if it's not as good as Windows, Linux, or OpenBSD, doubling the sampling rates also helps with the accuracy/precision of clicks (on my Spectre):

dev.iichid.1.sampling_rate_fast=120
dev.iichid.1.sampling_rate_slow=10

I'm closing this ticket.