How can I disable the touchscreen when closing the lid?

My GPD Win MAX 2 (2024) unfortunately registers phantom touch events when closed and used via a dock. I can disable the touchscreen via command line (with sudo bash -c 'echo "0018:27C6:0113.0004" > /sys/bus/hid/drivers/hid-multitouch/unbind'). Now I would like to tie this to opening / closing the lid. How can I run this command (and the corresponding bind-version) when the lid is triggered?
8 Replies
HikariKnight
HikariKnight2mo ago
you would find the state with cat /proc/acpi/button/lid/LID0/state or cat /proc/acpi/button/lid/LID/state IIRC the rest i am not sure what would be the best approach for you.
Shade
ShadeOP2mo ago
What approches are there? Specifically, is there a way to trigger a script when the lid state changes?
HikariKnight
HikariKnight2mo ago
as i said no idea i know you can make scripts trigger on sleep and wake but thats about it and i used that many many many years ago
Shade
ShadeOP2mo ago
Ah, my bad. I thought you meant there are several options and you don't know which one would work for me.
HikariKnight
HikariKnight2mo ago
nope i meant i have no clue what the best approach would be
antheas
antheas2mo ago
the touchscreen shouldnt work if the screen is off i think
Aru
Aru2mo ago
i wonder if a udev rule could be used for this. for reference, a different workaround runs ryzenadj --max-performance on AC power state changes. perhaps something similar can be made for lid changes.
cat <<EOF > "/etc/udev/rules.d/99-power-source-change.rules"
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/bin/ryzenadj --max-performance"
EOF

udevadm control --reload-rules
cat <<EOF > "/etc/udev/rules.d/99-power-source-change.rules"
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/bin/ryzenadj --max-performance"
EOF

udevadm control --reload-rules
Shade
ShadeOP2mo ago
Yeah, I'd think so too. But unfortunately it does, I get weird phantom touch events in the lower middle screen when using the laptop on a dock (with the lid closed). That is an interesting idea, I'll certainly have a look.

Did you find this page helpful?