Skip to content

Support additional i2c touchpad bus drivers in restart trackpad (#13398) - #13805

Open
szaidi-code wants to merge 1 commit into
omacom:quattrofrom
szaidi-code:fix/restart-trackpad-i2c-13398
Open

szaidi-code wants to merge 1 commit into
omacom:quattrofrom
szaidi-code:fix/restart-trackpad-i2c-13398

Conversation

@szaidi-code

Copy link
Copy Markdown
Contributor

Closes #13398

Summary

omarchy-restart-trackpad only scanned /sys/bus/i2c/drivers/i2c_hid_acpi, missing laptops whose touchpads use elan_i2c or i2c_hid_of drivers, and exited 0 silently even when no device was found.

Changes

  • Expand driver scanning in bin/omarchy-restart-trackpad to include elan_i2c and i2c_hid_of.
  • Report an error and exit non-zero if no matching trackpad device is found.
  • Add automated test in test/shell.d/restart-trackpad-test.sh.

@sanjyay

sanjyay commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for working on this! Broadening the driver list to include elan_i2c and i2c_hid_of, along with reporting an error on missing devices, addresses #13398 nicely.

A few recommendations based on testing:

1. Device globbing misses SMBus <bus>-<addr> devices (e.g. 0-0015)

In bin/omarchy-restart-trackpad:

for dev in "$driver_dir"/i2c-*; do

While ACPI-enumerated touchpads are named i2c-<ID>:<instance> (such as i2c-ELAN1000:00), touchpads connected via SMBus/I2C companion buses (common for ELAN hardware) are named <bus>-<addr> (e.g., 0-0015 or 1-002c). These do not match i2c-*, causing the script to report No supported trackpad device found to restart. and exit 1 on those systems.

As noted in #13539, driver control entries in sysfs (bind, unbind, uevent, and module) never contain hyphens, whereas both ACPI (i2c-...) and companion (<bus>-<addr>) device nodes do. Changing the pattern to *-* allows both formats to be detected and reset:

for dev in "$driver_dir"/*-*; do
  [[ -e $dev ]] || continue

2. Test isolation and runtime

In test/shell.d/restart-trackpad-test.sh:

  • Mock sleep: The test executes sleep 1 during the rebind test, adding ~1 second to the suite run. Adding a dummy sleep executable to $bin_dir keeps the test near-instant.
  • Mock lsmod: Test 3 verifies the failure path when no sysfs devices are present. If run on a system where the intel_quicki2c module happens to be loaded in the host kernel, the real lsmod detects it, triggers the reload path, sets found=1, and causes Test 3 to fail. Mocking lsmod (returning non-zero or empty output) in $bin_dir ensures test isolation from the host environment.

If you'd prefer not to receive these independent reviews on your PRs, reply to this comment, and I won't review your future PRs.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omarchy restart trackpad silently does nothing on elan_i2c touchpads

4 participants