Skip to content

Instantly share code, notes, and snippets.

@omgmog
Created February 6, 2026 17:26
Show Gist options
  • Select an option

  • Save omgmog/1bc233203966b9d1ef8a2768240f14e3 to your computer and use it in GitHub Desktop.

Select an option

Save omgmog/1bc233203966b9d1ef8a2768240f14e3 to your computer and use it in GitHub Desktop.
Poll for fastboot/adb modes on headless Pixel C tablet
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