Skip to content

Instantly share code, notes, and snippets.

@tjluoma
Last active April 15, 2016 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjluoma/9ec0eba09de01174487c4d31b50d1457 to your computer and use it in GitHub Desktop.
Save tjluoma/9ec0eba09de01174487c4d31b50d1457 to your computer and use it in GitHub Desktop.
# Check to see if "low power" Bluetooth is supported on a given Mac
#!/bin/zsh -f
# Check to see if "low power" Bluetooth is supported on a given Mac
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2016-04-13
NAME="bt4check.sh"
PATH=/usr/local/scripts:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
# This should be '4' or greater
BLUETOOTH_VERSION=$(system_profiler -detailLevel full SPBluetoothDataType \
| awk -F' ' '/LMP Version/{print $3}' \
| cut -d. -f 1)
if [ "$BLUETOOTH_VERSION" -ge "4" ]
then
echo "$NAME: SUCCESS: This Mac support Bluetooth version 4 or greater ($BLUETOOTH_VERSION)"
elif [ "$BLUETOOTH_VERSION" -lt "4" ]
then
echo "$NAME: FAILURE: This Mac does not support Bluetooth version 4 or greater (Version = $BLUETOOTH_VERSION)"
exit 1
else
echo "$NAME: It is not known whether this Mac supports Bluetooth version 4 or later, as required by Knock. (BLUETOOTH_VERSION = $BLUETOOTH_VERSION)"
exit 2
fi
exit 0
#
#EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment