#!/bin/bash # Reload the Linux psmouse kernel module. # # Description: # Removes and reloads the psmouse module, which controls PS/2 mice and # touchpads on many Linux systems. This can resolve cases where the # touchpad/mouse has stopped responding. # # Usage: # ./reload-psmouse.sh # # Requirements: # - Linux # - sudo privileges # - psmouse kernel module # # Notes: # Reloading psmouse may temporarily disconnect the touchpad/mouse. # Systems using a different input driver may not be affected. set -e if ! command -v modprobe >/dev/null 2>&1; then echo "Error: modprobe is not available." exit 1 fi if ! lsmod | grep -q '^psmouse '; then echo "psmouse module is not currently loaded." echo "Loading psmouse..." sudo modprobe psmouse else echo "Reloading psmouse..." sudo modprobe -r psmouse sudo modprobe psmouse fi echo "psmouse module reloaded successfully."