NMI handler

This commit is contained in:
Kroese 2023-04-16 19:52:56 +02:00 committed by GitHub
parent 28b84f39d8
commit ce8afc3fee

View File

@ -5,11 +5,9 @@ declare nmi
function checkNMI {
nmi=$(cat /proc/interrupts | grep NMI)
nmi=$(echo "$nmi" | sed 's/[^0-9]*//g')
nmi=$(echo "$nmi" | sed 's/^0*//')
nmi=$(awk '/NMI/ {for (i=2; i<=NF; i++) if ($i ~ /^[0-9]+$/) {sum+=$i}} END {print sum}' /proc/interrupts)
if [ "$nmi" != "" ]; then
if [ "$nmi" != "" ] && [ "$nmi" -ne "0" ]; then
echo "Received shutdown request through NMI.." > /dev/ttyS0