I have my pi set up as an a2dp receiver for streaming music from my phone. When I turn on the pi, i have to manually connect my phone then loopback the audio to play through a USB soundcard. To connect, I've just been using blueman, which works like a charm, but I'd like to run a script to auto-connect and loopback when the pi powers on. I can handle the script part, it's the actual command to connect that's getting me. Whenever I try to run hcitool cc XX_XX_XX_XX_XX_XX I get an input/output error. What is the correct syntax/command to connect via the a2dp profile?
Note: If I could set it up to initiate the connection from my phone that would be great too, I tried enabling autoconnect in /etc/bluetooth/audio.conf, but to no avail.
Any help is greatly appreciated!
Bluetooth connect
5 posts
- Posts: 10
- Joined: Mon Dec 10, 2012 4:14 am
Also I realize I mistyped the BT address, but even when I type it as XX:XX:XX:XX:XX it still won't work. It just waits a second and goes back to command line with no response.
- Posts: 10
- Joined: Mon Dec 10, 2012 4:14 am
Has the phone been paired from the Pi?
I use BT to connect to my solar invertor. The first part of the script checks that I can "ping" the invertor, as I've seen it not connect properly and its the Pi.
Could you use this to re-initialise the connection to the phone instead of my reboot?
I use BT to connect to my solar invertor. The first part of the script checks that I can "ping" the invertor, as I've seen it not connect properly and its the Pi.
Could you use this to re-initialise the connection to the phone instead of my reboot?
- Code: Select all
#!/bin/bash
# A check script ot see if the blue tooth has fallen over
/usr/bin/l2ping 00:12:12:12:12:12 -c 5 > /tmp/check
RESULT=$?
if [ $RESULT = 0 ];
then
echo OK > /dev/null
else
echo "Going for a reboot, no Bluetooth ping" | logger -t root -p local5.info
mail -s "Bluetooth down" keith@email.co.uk < /home/pi/email
sleep 10
/sbin/reboot
fi
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
- Posts: 87
- Joined: Mon Nov 26, 2012 8:48 pm
- Location: Ipswich, Suffolk, England, UK.
jamiesk wrote:Has the phone been paired from the Pi?
I use BT to connect to my solar invertor. The first part of the script checks that I can "ping" the invertor, as I've seen it not connect properly and its the Pi.
Could you use this to re-initialise the connection to the phone instead of my reboot?
My issue is finding the command to actually connect via a2dp, because using a gui, i can connect and stream audio no problem, but I just can't locate the command to connect automatically.
The pi and my phone are paired and the phone is marked as 'trusted' on the pi.
P.S. My half-British side couldn't help but notice the way you spelled initialize
- Posts: 10
- Joined: Mon Dec 10, 2012 4:14 am
uncrocks wrote:My issue is finding the command to actually connect via a2dp, because using a gui, i can connect and stream audio no problem, but I just can't locate the command to connect automatically.
The pi and my phone are paired and the phone is marked as 'trusted' on the pi.
Sorry, I have been using the CLI. I just saw the Pi GUI for the first time yesterday!!!
loluncrocks wrote:P.S. My half-British side couldn't help but notice the way you spelled initialize.
Good luck.
Pi1 (Nov 2012 loft)= 1KW immersion controller for Solar panel
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
Pi2 (Jan 2013 living room)=Play thing
Pi3 (Feb 2013 mobile)= Play thing with Tandy Ladder board,breakout board,Nokia display
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=28193
- Posts: 87
- Joined: Mon Nov 26, 2012 8:48 pm
- Location: Ipswich, Suffolk, England, UK.