title: Bluetooth A2DP and RFCOMM
body: <p>I'm trying to make my own bluetooth speaker with some add-ons. My Sony android phone will act as source and a raspberry pi with an usb bluetooth dongle is being the sink.</p>
  
  <p>I already have my bluetooth dongle set up with the A2DP profile and a loopback script is running to link the incoming audio to the connected soundcard.</p>
  
  <p>Next, i want to add some functionality with reading/writing variables and send commands to the raspberry pi over the same bluetooth connection with the RFCOMM profile.</p>
  
  <p>when i open and RFCOMM connection with "sdptool add sp" followed by "sudo rfcomm listen hci0" and try to connect with my phone with an android bluetooth emulator, the emulator says the connection has been opened. After that, the emulator immediately says that the connection has been closed. The raspberry pi doesn't even notice the connection being opened or being closed.</p>
  
  <p>I already read <a href="https://stackoverflow.com/questions/7865607/concurrent-bluetooth-a2dp-and-rfcomm-communication">this</a> article which notes my goal is possible, the only question for me is how.</p>
  
  <p><strong>So my question is:</strong></p>
  
  <p>Am I able to use an already paired bluetooth connection for both the A2DP and the RFCOMM profile and how do i have to set my settings with HCI.</p>
  
  <p>If anyone has alternatives to send commands over a socket like connection to my raspberry pi, i certainly would like to try them.</p>
  
  <p>----EDIT----</p>
  
  <p>So last weekend i gave it another try to solve my bluetooth issue. I first tried to set up the RFCOMM connection from the command line and it worked like expected. </p>
  
  <p>Next i disconnected, set the bluetooth profile to 0x20041C (portable audio) and set up the RRCOMM connection again. I don't quite what went wrong last time i tried, but this time it just worked. I even was able to link my android phone as audio source to my usb soundcard with pulseaudio.</p>
  
  <p>So, question solved, i guess.</p>