RSS Feed
Oct 5

HowTo: Pair your bluetooth phone with Ubuntu Gutsy or Ubuntu Hardy for file transfers etc.

Posted on Sunday, October 5, 2008 in Tutorials

To get my blog started, I’m duplicating my HowTo guides that I wrote on Overclockers Australia here, but updating or modifying them in the process with improvements or snapshots that I didn’t have before. We’ll start with my guide on how to pair your Bluetooth phone with Ubuntu Linux.

Connecting your phone via Bluetooth has many advantages including basic file transfer and synchronising your phone contacts and calendar with your PIM.

But how do you do it? If you’ve never had any idea how to do connect something via Bluetooth, then read this guide. It is based on the guide on LinuxQuestions.org, but with some minor changes to make it easier for novices. You can read the original guide here otherwise step inside my office. :)

Prerequisites:

  • Bluetooth-enabled mobile phone (I used a Nokia N95 in this guide).
  • USB Bluetooth adapter or PC with built-in Bluetooth such as a modern notebook. Your adapter must be Bluetooth 1.2 compliant or higher.
  • Ubuntu Linux (this guide was built using Gutsy Gibbon 7.10 but also works for Hardy Heron 8.04). NOTE: If you are using Ubuntu Intrepid Ibex or later, you should use this guide instead.

Difficulty level: Easy-peasy. Your pet rock could do this.

  1. First, plug in your USB Bluetooth adapter or enable it on your notebook. Ubuntu should recognise it immediately with no need for additional drivers. You can confirm that by jumping into a terminal as issuing the lsusb command to list your USB devices:
    $ lsusb | grep tooth
    Bus 001 Device 005: ID 1310:0001 Roper Class 1 Bluetooth Dongle
    $
  2. You’ll be happy to know that Ubuntu comes pre-installed with everything you need to get Bluetooth running (but not the apps to run on top of it), so it’s just a case of configuring it. Open up the /etc/bluetooth/hcid.conf file in your favourite text editor:
    $ sudo nano /etc/bluetooth/hcid.conf

    …and look for the line that has “security user” in it and change it to “security auto”.

  3. Now we need to change the security PIN number. By default Ubuntu uses “1234″ which is obviously not very secure. Scroll further down until you see a line with “passkey “1234″;” and change the number to be any preferred PIN, eg: if you wanted to use 1337 as your PIN, you’d change the line to look like:
    passkey "1337";
  4. Save and close the file.
  5. Now we restart the Bluetooth services to read our changed configuration with:
    $ sudo /etc/init.d/bluetooth restart

    …and your PC is now ready for being connected to.

  6. It is easier to pair from the phone than it is from the PC, so grab yer phone and open up the Bluetooth Connections option. On my Nokia N95, this is Menu->Tools->Bluetooth. Ensure that Bluetooth is turned on.
  7. Open your “paired devices” list and select the menu option to add a new device. Allow the phone to begin a search and your PC should come up on your phone with a “-0″ on the end of the name. Eg: If your PC was called “gordon”, it would appear on your phone as “gordon-0″.
  8. Choose your PC’s name in the list. After a second you should get prompted for your PC’s PIN number. Enter the one you did earlier.
  9. Once connected, your phone may ask you if you want to authorise your PC to make automatic connections to your phone without prompting. Choose what you’d prefer here.
  10. We’re nearly done! Ubuntu Hardy users do NOT need to do this step. For Ubuntu Gutsy users ONLY, to get file transfer support going. Open a terminal and enter:
    $ sudo apt-get install gnome-bluetooth
  11. Next we need to install a quick workaround for a bug in gnome-bluetooth that affects Bluetooth 1.1 devices. We need to set your Bluetooth adapter back into inquiry results mode so it can find remote devices properly. This has to be executed everytime you restart, so we’re going to add it to the /etc/rc.local file:
    $ sudo nano /etc/rc.local
  12. This is a short file where the last line reads “exit 0″. Above this line enter:
    hciconfig hci0 inqmode 0

    …and then save and exit.

  13. Reboot your PC.
  14. If you are using Ubuntu Gutsy: Go to Applications->Accessories->Bluetooth File Sharing. An icon will appear in your tray ready to accept incoming file transfer requests from your phone. To transfer files from your phone to Ubuntu, simply grab your phone and “Send via Bluetooth”. If your PC and phone are paired, the transfer will happen without confirmation and get put into your Home directory. If you are not paired, then Ubuntu will prompt you to accept the transfer.If you are using Ubuntu Hardy: Things are even simpler. Up in your system tray is a Bluetooth icon. Simply do a right-mouse click on this icon and choose either “Send File…” (see below) or “Browse Device…” (step 15).
    Bluetooth in the System Tray

    Bluetooth in the System Tray

    “Send File…” will bring up a file requester for you to choose a file from. This is what you want to send to your phone.

    File Requester

    File Requester

    Once chosen, you will then be prompted for what Bluetooth device you want to send to. Select your mobile phone from the list and click “Connect”.

    Bluetooth Device Selection

    Bluetooth Device Selection

    The File Transfer window will appear showing you the progress of your transferred file. Once complete, your phone should acknowledge the file transfer by advertising that it received a new message like an SMS. Cool, huh?

    Transferring a file via Bluetooth

    Transferring a file via Bluetooth

  15. Choosing “Browse Device…” from the Bluetooth icon menu will make the device selection window appear. Choose your mobile phone from the list and click on “Connect”.

    Bluetooth Device Selection

    Bluetooth Device Selection

  16. After a brief delay, a Nautilus window will pop up showing you your phone’s memory as drives. In my case, my phone’s internal memory and its memory card appear as two separate drives, presented in the Windows style of C: and E: drives. This allows you to browse your phone as though it were any ordinary USB flash or hard-drive. You can perform all the standard drag & drop or copy & paste file operations now.

    Browsing my phone via Bluetooth

    Browsing my phone via Bluetooth

  17. Finally, you will notice on your desktop a new icon for your phone which will open a Nautilus window when clicked on. I made a custom icon for my Nokia using a reference photo.

    My Nokia N95's desktop icon

    My Nokia N95

    That’s essentially it! You are now a Bluetooth pro. :)

The link to the original LinuxQuestions.org guide also has additional instructions for creating a Launcher to transfer files dropped on its icon to any Bluetooth device and also instructions for hooking up a Bluetooth mouse and keyboard. Worth a read.

Bring on the comments!

  1. [...] So, to that end, this is an update to my previous HowTo for connecting a Bluetooth mobile phone to previous versions of Ubuntu. [...]

  2. Dave Pointon says:

    Hmmm, tried the above on Jaunty with Nokia 6110 Navigator … to no avail – ‘phone ‘unable to pair’ after correct entry of ‘new’ PIN :-( (

  3. Sourav says:

    Hi ,

    The guide was really good to configure my Nokia mobile through bluetooth but unable to use my wireless bluetooth enabled headset. It is asking for pairing request & i am giving the default pin 1234 but while browsing the devices in am not able to use the headset.

    OS: ubuntu 8.04 LTS
    sourav@suchitra:/etc/bluetooth$ uname -r
    2.6.24-24-generic

    Laptop: Dell Inspiron 6400

    Any help is appreciated.

    Thanks in Advance.

    Sourav

  4. HyRax says:

    Hi Sourav,

    Using a Bluetooth headset is a completely different kettle of fish.

    It’s much MUCH easier to get a Bluetooth headset running under Ubuntu Jaunty 9.04 or later, however the process is still very buggy even with the latest Blueman packages.

    Because of this I have not bothered to write a HowTo for it yet until it becomes more stable.

Leave a Reply

Spam Protection by WP-SpamFree