Skip to content

Instantly share code, notes, and snippets.

@kingcody
Created December 11, 2018 07:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingcody/2f5d71a79d34f8c2c9607c95fe956380 to your computer and use it in GitHub Desktop.
Save kingcody/2f5d71a79d34f8c2c9607c95fe956380 to your computer and use it in GitHub Desktop.
Update teensyduino.sh PID Detection
#!/bin/bash
sleep 2
export HOME=$2
$1 & TEENSYPID=$!
sleep 5
xdotool search --class "teensyduino" \
windowfocus \
key space sleep 1 \
key Tab sleep 0.4 \
key Tab sleep 0.4 \
key Tab sleep 0.4 \
key Tab sleep 0.4 \
key space sleep 1 \
key Tab sleep 0.4 \
key Tab sleep 0.4 \
key Tab sleep 0.4 \
key Tab sleep 0.4 \
key space sleep 1 \
key Tab sleep 0.4 \
key space sleep 35
kill $TEENSYPID >/dev/null || exit 1
[ -d $2/hardware/teensy ] || exit 1
--- teensyduino.sh 2018-09-23 07:13:17.000000000 -0400
+++ teensyduino_pid.sh 2018-12-11 02:33:20.774271251 -0500
@@ -3,7 +3,7 @@
sleep 2
export HOME=$2
-$1 &
+$1 & TEENSYPID=$!
sleep 5
xdotool search --class "teensyduino" \
@@ -22,5 +22,5 @@
key Tab sleep 0.4 \
key space sleep 35
-killall $(basename $1) >/dev/null || exit 1
+kill $TEENSYPID >/dev/null || exit 1
[ -d $2/hardware/teensy ] || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment