forked from novaspirit/bluetooth_fm_pi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbluetooth-agent
More file actions
37 lines (37 loc) · 1.02 KB
/
bluetooth-agent
File metadata and controls
37 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
#/etc/init.d/bluetooth-agent
### BEGIN INIT INFO
# Provides: bluetooth-agent
# Required-Start: $remote_fs $syslog bluetooth pulseaudio
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Makes Bluetooth discoverable and connectable to 0000
# Description: Start Bluetooth-Agent at boot time.
### END INIT INFO
USER=root
HOME=/root
export USER HOME
case "$1" in
start)
echo "initializing pulseaudio"
sudo pactl info
echo "setting bluetooth discoverable"
sudo hciconfig hci0 piscan
start-stop-daemon -S -x /usr/bin/bluetooth-agent -c pi -b -- 0000
echo "bluetooth-agent started pw: 0000"
sudo /usr/lib/udev/bluetooth-auto &
echo "bluetooth-auto-discovery started"
sudo /home/pi/fm/pifm /home/pi/fm/silence 87.7 44100 stereo
echo "pifm started at 87.7, playing silence"
;;
stop)
echo "Stopping bluetooth-agent"
start-stop-daemon -K -x /usr/bin/bluetooth-agent
;;
*)
echo "Usage: /etc/init.d/bluetooth-agent {start|stop}"
exit 1
;;
esac
exit 0