fix(inputdevices): fsync udev rule and rebuild on boot for touchpad - #1221
Conversation
1. Replace os.WriteFile with os.Create + f.Sync() to ensure the udev rule file is flushed to disk before close 2. On startup, call setTouchpadEnableViaUdev directly instead of setTouchpadEnable to avoid skipped udev rebuild when changed=false due to pre-initialized Enable field 3. Prevents touchpad disable state loss after forced power-off Log: fix touchpad disabled state lost after forced power-off because udev rule file write was not fsynced and startup rebuild was skipped by changed=false check Influence: 1. Disable touchpad, force power off, reboot and verify it stays disabled 2. Disable touchpad, normal reboot and verify it stays disabled 3. Enable touchpad, force power off, reboot and verify it stays enabled fix(inputdevices): 修复强制关机后触控板禁用状态丢失 1. 将 os.WriteFile 改为 os.Create + f.Sync() 确保写入 udev 规则文件时强制刷盘,防止断电丢失 2. 启动恢复时直接调用 setTouchpadEnableViaUdev 重建 udev 规 则,避免 changed=false 导致跳过写入 3. 修复强制关机后触控板禁用失效的问题 Log: 修复强制关机后触控板禁用状态丢失,原因是 udev 规则文件 写入未调用 fsync 导致断电丢失,且启动恢复逻辑因 changed=false 跳过了 udev 规则重建 Influence: 1. 禁用触控板后强制关机,重启后确认触控板仍为禁用状态 2. 禁用触控板后正常重启,确认触控板仍为禁用状态 3. 启用触控板后强制关机,重启后确认触控板仍为启用状态 PMS: BUG-374789
Reviewer's GuideThe PR preserves touchpad enable state across forced power-offs by synchronously flushing the udev rule file to disk and unconditionally rebuilding that rule from the persisted configuration during startup. Sequence diagram for durable touchpad state restorationsequenceDiagram
participant Startup
participant InputDevices
participant Touchpad
participant UdevRuleFile
participant Disk
Startup->>InputDevices: init()
InputDevices->>Touchpad: setTouchpadEnableViaUdev(enabled)
Touchpad->>UdevRuleFile: os.Create(udevRuleFile)
Touchpad->>UdevRuleFile: f.Write(udevRuleContent)
Touchpad->>UdevRuleFile: f.Sync()
UdevRuleFile->>Disk: Flush rule contents
Touchpad->>UdevRuleFile: f.Close()
Note over Disk: Rule survives forced power-off
Flow diagram for touchpad udev rule rebuilding on bootflowchart TD
A[Persisted touchpad enable state] --> B["init()"]
B --> C["setTouchpadEnableViaUdev(enabled)"]
C --> D["os.Create(udevRuleFile)"]
D --> E["f.Write(udevRuleContent)"]
E --> F["f.Sync()"]
F --> G[udev rule durably rebuilt]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
/retest |
|
/retest deepin-ci-robot |
|
@fly602: The
Use
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test github-pr-review-ci |
|
/test all |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Log: fix touchpad disabled state lost after forced power-off because udev rule file write was not fsynced and startup rebuild was skipped by changed=false check
Influence:
fix(inputdevices): 修复强制关机后触控板禁用状态丢失
Log: 修复强制关机后触控板禁用状态丢失,原因是 udev 规则文件
写入未调用 fsync 导致断电丢失,且启动恢复逻辑因 changed=false
跳过了 udev 规则重建
Influence:
PMS: BUG-374789
Summary by Sourcery
Ensure touchpad state survives forced power-offs by reliably persisting and rebuilding its udev configuration.
Bug Fixes:
Enhancements: