Skip to content

feat: backport upstream touchpad support for haptic/pressure pads - #16

Open
Zeno-sole wants to merge 1 commit into
masterfrom
feat/upstream-touchpad-support
Open

Zeno-sole wants to merge 1 commit into
masterfrom
feat/upstream-touchpad-support

Conversation

@Zeno-sole

Copy link
Copy Markdown
Contributor

背景

上一轮为 Lenovo ThinkBook G8+ IPH 提交了 PR #15(ModelPressurePad 写法)。这次按上游实际演进方向,把 1.28.1 → 1.32.0 之间上游新增的触摸板支持整体回合,同时把压力板机制对齐上游。

本 PR 独立于 #15(不含 #15 内容),版本号用 deepin3 以避开 #15 的 deepin2;两者合并顺序不受限制。

关键发现:上游已废弃 ModelPressurePad

上游在 1.31/1.32 删除了 ModelPressurePad 这个 quirk key(bde6d07d),全部改用 AttrInputProp=+INPUT_PROP_PRESSUREPAD,并为此修了两处代码。这直接印证了 PR #8 回退的真实根因是解析失败,而不是 ID 匹配:

  1. 7621edab — 自带内核头文件缺宏:include/linux/*/input-event-codes.h 里没有 INPUT_PROP_PRESSUREPAD (0x07)。
  2. db6a0466 — libevdev 名字表缺项:libevdev < 1.13.6 不认识 "INPUT_PROP_PRESSUREPAD",parse_input_prop_property() 返回失败,错误经 parse_file()/parse_files() 上抛,quirks_init_subsystem() 返回 NULL,libinput 丢弃整个 quirks 数据库。这正是"部分机型触摸板失效"的机制。
  3. db6a0466 — 消费点不认该属性:tp_init_pressurepad() 原本只看 ABS_MT_PRESSURE 分辨率和 ModelPressurePad,需补上 libevdev_has_property(INPUT_PROP_PRESSUREPAD)。

本 PR 把这三处按上游原样回传,并保留 ModelPressurePad 兼容路径,保证既有 ThinkBook G6+/G7+、HONOR MagicBook Air 14 等 quirk 继续生效。

quirk 数据

逐字引入上游 37 个新触摸板 section(注释与顺序保持上游原样,便于后续 refresh):

厂商 覆盖
Goodix 触感 27C6:01E7 / 01E8 / 01E9 / 01EA / 01EB / 0F90 / 0F95 / 0F96
Elan 触感 04F3:3355
Pixart 093A:4811(触感)、0255 / 0274 / 1336 / 200F
Synaptics 触感 06CB:D024
Dell 压力板 0488:108C / 108D、2C2F:0033 / 0034、06CB:D01A / D01D
其他 Hantick 0911:5288、Clevetura CLVX S、Microsoft Surface Pro 10 / Flex KB、Google Chromebook Roric / Rull、Samsung Galaxy Book 4 360、Positivo N8460 / VAIO FE15、Wareus B15、Getac X600、GPD MicroPC 2、Acer Nitro ANV16-42、EAECIS NL60R、HP OmniBook Ultra Flip 14、Lenovo ThinkPad P14s Gen 6

其中 9 个为上游新增 quirk 文件,9 个为在既有文件内追加。

刻意未纳入的条目

以下上游条目依赖 1.28.1 不存在的 quirk key,照搬会让解析失败并再次拖垮整个数据库,故排除:

  • AttrTouchpadHysteresis(Framework Laptop 13 Pro)
  • ModelCircularTouchpad(Panasonic Let's Note CF-SV1/SV8/SC6/FV1,需新增圆形滚动特性与源文件)
  • ModelScrollOnMiddleClick(Logitech MX Master 4)
  • AttrIsVirtual(QEMU / Oracle / VMware 虚拟设备)
  • ModelHPPavilionDM4Touchpad、ModelClevoW740SU、ModelSystem76Galago、ModelSystem76Kudu

这些需要另开 PR 单独引入对应特性。

验证

在 1.28.1 源码树上实际套用两个补丁后实测(非仅静态检查):

  • libinput-quirks validate --data-dir=quirks → exit 0;
  • test/test_quirks_files.py → 118 passed(含 configparser 严格模式,可捕获重复 section);
  • 回归对比:以 origin/master 为基线,原有 304 个 section 全部保留、内容零改动,净增 37 个(合计 341);
  • 语义校验:9 组 DMI glob 正向命中目标机型、且不误伤相邻型号(P14s Gen6 vs Gen5、Wareus B15 vs B16、Getac X600 vs X500、EAECIS NL60R vs NL61R 等),15 组硬件条目的 quirk key 逐项核对,0 失败;
  • 运行时行为(链接构建产物实测):+INPUT_PROP_PRESSUREPAD 解析成功、-INPUT_PROP_BUTTONPAD / +0x07 正常、未知名字仍被拒绝(兜底是名称精确匹配,不放宽其他输入)、libevdev_enable_property(0x07) 后 has_property 为真 → tp_init_pressurepad() 分支会触发。

修复过程中的一个真实缺陷也是靠这套验证抓到的:初版误加了上游 Dell i2c Touchpads 与 Precision 7x50 Touchpad 两个已存在于 1.28.1 的 section(仅 DMI 写法略有差异),validate 能通过但 test_quirks_files.py 的 configparser 严格模式报 duplicate section,已删除重复副本。

测试建议

  1. 各触感触摸板机型(Goodix / Elan / Pixart / Synaptics / Dell):光标可移动、按压可点击;
  2. ThinkBook 14/16 G6+ / G7+、HONOR MagicBook Art 14:原 quirk 仍生效;
  3. 任一台依赖 ModelPressurePad 的机器:行为与升级前一致;
  4. sudo libinput quirks validate 与 libinput list-devices 确认 quirks 数据库正常加载(日志中不应出现 Failed to load the device quirks)。

Backport the upstream INPUT_PROP_PRESSUREPAD support and the touchpad
quirk entries added between 1.28.1 and 1.32.0.

Upstream replaced the ModelPressurePad quirk with
AttrInputProp=+INPUT_PROP_PRESSUREPAD and, while doing so, had to fix two
things that this version also needs:

  a) the vendored linux headers do not define INPUT_PROP_PRESSUREPAD
     (0x07), added upstream in 7621edab;
  b) libevdev < 1.13.6 does not know the name "INPUT_PROP_PRESSUREPAD",
     so parse_input_prop_property() fails and libinput discards the whole
     quirks database. Upstream added a name fallback in db6a0466, and
     made tp_init_pressurepad() honour the property as well.

Point b is the root cause of the touchpad regression that forced the
reverted debian patch (PR #8). Keeping ModelPressurePad alongside it
means the existing ThinkBook G6+/G7+ and HONOR quirks keep working.

On top of that, 37 touchpad quirk sections from upstream are imported
verbatim: Goodix 27C6:01E7/01E8/01E9/01EA/01EB/0F90/0F95/0F96, Elan
04F3:3355, Pixart 093A:4811/0255/0274/1336/200F, Synaptics 06CB:D024,
Dell 0488:108C/108D and 2C2F:0033/0034 and 06CB:D01A/D01D, plus Hantick,
Clevetura, Microsoft Surface Pro 10, Google Chromebook Roric/Rull,
Samsung Galaxy Book 4 360, Positivo, Wareus B15, Getac X600,
GPD MicroPC 2, Acer Nitro ANV16-42, EAECIS NL60R, HP OmniBook Ultra Flip
and Lenovo ThinkPad P14s Gen 6.

Entries that depend on quirks unknown to 1.28.1 are left out on purpose
(AttrTouchpadHysteresis, ModelCircularTouchpad, ModelScrollOnMiddleClick,
AttrIsVirtual); including them would make the parser reject the file and
lose the whole database again. All 304 existing quirk sections are kept
unchanged.

Log: Imported upstream INPUT_PROP_PRESSUREPAD support and 37 touchpad quirk entries

Influence:
1. Verify a quirk using AttrInputProp=+INPUT_PROP_PRESSUREPAD no longer breaks the quirks database
2. Verify haptic touchpads (Goodix/Elan/Pixart/Synaptics/Dell) move the cursor
3. Verify existing ThinkBook G6+/G7+, HONOR MagicBook Art 14 quirks still apply
4. Verify devices relying on ModelPressurePad behave as before
5. Run libinput quirks validate and the quirks test suite

feat: 回合上游触摸板支持(压力板/触感触摸板)

回合上游 1.28.1 到 1.32.0 之间新增的 INPUT_PROP_PRESSUREPAD 支持及其
触摸板 quirk 条目。

上游用 AttrInputProp=+INPUT_PROP_PRESSUREPAD 取代了 ModelPressurePad,
并为此修了两个问题,本版本同样需要:

  a) 自带的内核头文件缺少 INPUT_PROP_PRESSUREPAD(0x07) 定义,上游在
     7621edab 中补上;
  b) libevdev < 1.13.6 不认识 "INPUT_PROP_PRESSUREPAD" 这个名字,
     parse_input_prop_property() 会失败,导致 libinput 丢弃整个 quirks
     数据库。上游在 db6a0466 中加了名称兜底,同时让
     tp_init_pressurepad() 也认这个属性。

b) 正是导致触摸板失效、进而回退补丁(PR #8)的根因。保留
ModelPressurePad 是为了让已有的 ThinkBook G6+/G7+、HONOR 等 quirk 继续
生效。

此外逐字引入上游 37 个触摸板 quirk 条目:Goodix
27C6:01E7/01E8/01E9/01EA/01EB/0F90/0F95/0F96、Elan 04F3:3355、
Pixart 093A:4811/0255/0274/1336/200F、Synaptics 06CB:D024、Dell
0488:108C/108D 与 2C2F:0033/0034、06CB:D01A/D01D,以及 Hantick、
Clevetura、Microsoft Surface Pro 10、Google Chromebook Roric/Rull、
Samsung Galaxy Book 4 360、Positivo、Wareus B15、Getac X600、
GPD MicroPC 2、Acer Nitro ANV16-42、EAECIS NL60R、
HP OmniBook Ultra Flip、Lenovo ThinkPad P14s Gen 6。

依赖 1.28.1 不支持的新 quirk 的条目(AttrTouchpadHysteresis、
ModelCircularTouchpad、ModelScrollOnMiddleClick、AttrIsVirtual)刻意
不引入,否则解析失败会再次拖垮整个数据库。原有 304 个 quirk section
全部保持不变。

Log: 引入上游 INPUT_PROP_PRESSUREPAD 支持及 37 个触摸板 quirk 条目

Influence:
1. 验证 AttrInputProp=+INPUT_PROP_PRESSUREPAD 不再导致 quirks 库加载失败
2. 验证各触感触摸板(Goodix/Elan/Pixart/Synaptics/Dell)可移动光标
3. 验证已有 ThinkBook G6+/G7+、HONOR MagicBook Art 14 quirk 仍生效
4. 验证依赖 ModelPressurePad 的设备行为不变
5. 运行 libinput quirks validate 与 quirk 测试套件

repo: libinput #master
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from zeno-sole. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

/hold
因为该quilt包的上游版本号变更,详情见: deepin-community/infra-settings#134

@github-actions

Copy link
Copy Markdown

TAG Bot

TAG: 1.28.1-1+deb13u1deepin3
EXISTED: no
DISTRIBUTION: unstable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants