#!/bin/bash # This script is designed to mitigate a common interrupt storm issue on Surface devices running Linux. # It identifies the IRQ that is firing excessively and disables it. # Find the IRQ with the highest number of interrupts. # We exclude the local timer interrupts (LOC) as they are expected to be high. HIGH_IRQ=$(cat /proc/interrupts | grep -v "LOC" | sort -n -k 2 | tail -n 1 | cut -d: -f1 | tr -d ' ') if [ -z "$HIGH_IRQ" ]; then echo "Could not find a high IRQ to disable." exit 1 fi echo "Disabling IRQ $HIGH_IRQ" # Disable the IRQ by writing it to /proc/irq/{number}/smp_affinity. # This will prevent the interrupt from being handled by any CPU. echo 0 > "/proc/irq/$HIGH_IRQ/smp_affinity" echo "IRQ $HIGH_IRQ has been disabled." echo "The associated device (likely the touchscreen) may no longer function." echo "To re-enable, you can write the original smp_affinity value back, or simply reboot."