first commit
This commit is contained in:
14
poweroff_linux/send_signal.sh
Normal file
14
poweroff_linux/send_signal.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
TTY_DEVICE="/dev/ttyACM0"
|
||||
# 参数为 "poweroff", "halt", "reboot"等
|
||||
ACTION=$1
|
||||
|
||||
# 当关机(poweroff)或重启(reboot)时才发送
|
||||
if [ "$ACTION" = "poweroff" ] ; then
|
||||
if [ -w "$TTY_DEVICE" ]; then
|
||||
stty -F "$TTY_DEVICE" 115200 cs8 -cstopb -parenb
|
||||
printf "ok\r\n" > "$TTY_DEVICE"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
Reference in New Issue
Block a user