Skip to content

Instantly share code, notes, and snippets.

@chmouel
Created October 30, 2016 06:34
Show Gist options
  • Save chmouel/2f8655dc72d67e6e1ecd9d1c8fc910e2 to your computer and use it in GitHub Desktop.
Save chmouel/2f8655dc72d67e6e1ecd9d1c8fc910e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
STATUS=$(echo pow 0|cec-client -s -d 1|grep power\ status|sed 's/.*: //')
if ! grep -i apple /proc/bus/input/devices && [[ ${STATUS} == on ]] ;then
sudo /bin/hciconfig hci0 up
echo "on" > /tmp/xxx
elif grep apple /proc/bus/input/devices && [[ ${STATUS} != on ]] ;then
sudo /bin/hciconfig hci0 down
echo "off" > /tmp/xxx
fi
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment