ubuntu - How to Connect BlueTooth device running Serial Port Profile (SPP) from command line

07
2014-07
  • Ruslan Gerasimov

    I have the device with Blue-Tooth on the board. The firmware in the device runs Serial Port Profile (SPP) stack on it.

    It works well when I connect to this device from my laptop by means of Blueman applet. This applet involves asking me:

    PinCode,
    Pairing my laptop and device,
    Creating /dev/rfcommX device file, which I use to trnasmit with the device.
    

    So, it works well,

    BUT I need to be able to organize this connection from command line. I've read different forums, but could not get nor my understanding neither working recipe.

    I need the description how to do this. Could you please write here your advices? Also, this Blueman applet crashes my Ubuntu 13.04 at Dell Latitude E6430 from time to time (when I click to connect Serial Port in there).

    This is a screen of Blueman applet, just in caseenter image description here

    I believe the command line solution I need should at least do this:

    1. Ask to input a PinCode to Pair with device.

    2. Create /dev/rfcommX device file

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    ubuntu - What does the BlueZ applet in Gnome do "behind the scenes"?
  • Fylke

    I have this Apple wireless keyboard that I've successfully paired and gotten to work with my Ubuntu laptop (using a bluetooth dongle). The laptop is running 9.04 Jaunty and I used the nice little BlueZ applet that comes with Gnome to do the pairing.

    What I'm actually trying to do though is to hook up the same keyboard, using the same dongle, to my HTPC that is running a stripped version of Jaunty (XBMC Live).

    The problem is that the HTPC doesn't have Gnome and therefore no applet so I need to do the pairing manually on the command line.

    What I've tried:

    • hcitool scan -- Finds the keyboard okay

    • sudo hcitool cc <MAC> -- Gives me a new prompt, just as if it succeeded pairing only I can't type anything

    I also tried a lot of hidd solutions but since it works on the laptop that doesn't have hidd installed so I'm pretty sure that's not the way to go (plus the fact that hidd is deprecated in Ubuntu 9.04).

    I also checked the /etc/default/bluetooth settings file on the laptop after the pairing and it doesn't contain anything new. So I guess I should be able to get it to pair without modifying it.

    How can I check if it has succeeded in pairing? hcitool dev doesn't give anything on the laptop when the keyboard is paired.


  • Related Answers
  • cjm

    I don't use Bluetooth myself, but there's a lot of information on the BlueZ Wiki. (Which is remarkably well hidden. I couldn't find a single link from www.bluez.org to wiki.bluez.org.)