-
-
Save omgmog/1bc233203966b9d1ef8a2768240f14e3 to your computer and use it in GitHub Desktop.
Poll for fastboot/adb modes on headless Pixel C tablet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prev="" | |
| while true; do | |
| fb="$(fastboot devices 2>/dev/null | awk '/fastboot$/ {print $1; exit}')" | |
| ad="$(adb devices 2>/dev/null | awk 'NR>1 && NF {print $1":"$2; exit}')" | |
| pid="$(system_profiler SPUSBDataType | awk ' | |
| /Product ID:/ {pid=$3} | |
| /Serial Number: 5A22000865/ {print pid; exit} | |
| ')" | |
| cur="pid=${pid:-na} fastboot=${fb:-none} adb=${ad:-none}" | |
| if [ "$cur" != "$prev" ]; then | |
| printf "%s %s\n" "$(date '+%H:%M:%S')" "$cur" | |
| osascript -e 'beep 1' | |
| prev="$cur" | |
| fi | |
| sleep 1 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment