Created
November 11, 2025 01:03
-
-
Save vinibortoletto/43726e78fcb6fd31c7af5ec861b48fb1 to your computer and use it in GitHub Desktop.
Script to disable PS4 controller touchpad on linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Define the UDEV rule file path | |
| RULE_FILE="/etc/udev/rules.d/72-ds4tm.rules" | |
| # Define the content of the UDEV rule | |
| # This rule matches the touchpad device by name for both USB and Bluetooth connections | |
| # and tells libinput to ignore it as a primary input device (mouse). | |
| RULE_CONTENT=' | |
| # Disable PS4 DualShock 4 (DS4) touchpad acting as a mouse | |
| # USB Connection | |
| ATTRS{name}=="Sony Interactive Entertainment Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" | |
| # Bluetooth Connection | |
| ATTRS{name}=="Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" | |
| ' | |
| echo "Creating UDEV rule file: $RULE_FILE" | |
| # Use sudo tee to create/overwrite the file with the rule content | |
| # The initial empty line in RULE_CONTENT is handled by tee | |
| echo "$RULE_CONTENT" | sudo tee "$RULE_FILE" > /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo "Rule file created successfully." | |
| echo "Reloading UDEV rules..." | |
| # Reload udev rules to make the system aware of the new file | |
| sudo udevadm control --reload | |
| # Trigger udev to process the new rules for existing devices (like the connected controller) | |
| sudo udevadm trigger | |
| echo "UDEV rules reloaded and triggered." | |
| echo "" | |
| echo "✅ **PS4 Touchpad is now disabled.**" | |
| echo "You may need to **disconnect and reconnect** the PS4 controller for the change to take full effect." | |
| else | |
| echo "❌ **ERROR:** Failed to create the UDEV rule file. Check script permissions or disk space." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment