Search:  
Gentoo Wiki

Mobile_Phone/Bluetooth

Contents

Compatibility list

Please report here, if it worked with your mobile-phone / PC / notebook:

Notebooks:

  • Samsung X11
  • HP dv6135nr with Belkin USB Bluetooth dongle
  • Acer Travelmate 8106lmi
  • HP 6910p
  • HP Compaq nx7400
  • HP Compaq nc6000
  • Asus F3Jc
  • Asus G2s
  • Dell Latitude D630
  • Dell C520 Desktop Computer

Mobile Phones:

  • Motorola RAZR
  • Samsung SGH-T509
  • Samsung SGH-X680
  • Samsung SGH-X820
  • Samsung SGH-D608
  • Sony Ericsson T630
  • Sony Ericsson T610
  • Sony Ericsson Z520a
  • Sony Ericsson K750i
  • Sony Ericsson W300i
  • Sony Ericsson W610i
  • Sony Ericsson W850i
  • Nokia 6300
  • Nokia 6086
  • Nokia N72
  • Nokia 6230i
  • Nokia 6300
  • Watch Mobile 8100

Prologue

I've just successfully installed Bluetooth support and managed to connect my Sony Ericsson T630 mobile phone. Since there's a lot of information on the web about Bluetooth under Linux but I couldn't find a Gentoo-specific tutorial I decided to write one. I hope this tutorial is generic enough so that it's useful to people with other hardware, too. Fortunately, Bluetooth virtually works out of the box with Gentoo using stable packages only!

My hardware:

What I wanted to do (read: what's covered in this tutorial):

What I haven't done yet (and thus isn't covered here):

Configure kernel for Bluetooth support

Like USB or FireWire you should have the latest kernel drivers for bluetooth. If you're using a previous version your mileage may vary. Also, make sure that USB hotplugging is working as it won't be covered in this tutorial. I assume it's already working for you. Go to /usr/src/linux and make menuconfig to set up Bluetooth. You may compile the features into the kernel but I used modules. Works well and saves you from recompiling the whole kernel. First, go to USB support and make sure that USB Bluetooth support is disabled. (at least for kernel 2.6:) Enable OHCI or UHCI USB support depending on your Hardware (refer to lspci). Then, go to "Bluetooth support" and at least select the following options:

Linux Kernel Configuration: Bluetooth support
 Networking -->
  <M> Bluetooth subsystem support -->
    <M> L2CAP protocol support
    <M> RFCOMM protocol support
    [*]   RFCOMM TTY support
        Bluetooth device drivers --->
          <M> HCI USB driver

RFCOMM is not necessary but you may want to enable it, however, if you get the following error message "Can't create device: Operation not permitted" or to prevent it.

Exit, Save your configuration and do make modules modules_install && update-modules. And don't forget to (if you have compiled bluetooth as a module) modprobe bluetooth.

Emerge the packages

If you are using GNOME, you can just do:

USE="bluetooth" emerge -av gnome-bluetooth

as it will pull in all required packages. If you do NOT have GNOME you should install the following packages:

USE="bluetooth" emerge -av bluez-utils openobex obexftp

If you have a broadcom bluetooth device (eg, the Belkin F8T001), you should install bluez-firmware.

Make sure "bluetooth" is in your USE or the openobex wont work

Warning: It's not a good idea to pass USE flags in this way... You should add package name with apropriate USE flags to /etc/portage/package.use or add "bluetooth" to /etc/make.conf

Attach the dongle

There's a lot of Bluetooth hardware available, but as long as it's a USB device, you won't have to do more than connect it to a USB port now. Type dmesg to see if your dongle has been recognized by Linux. It should print something like this:
# dmesg
(...)
hub.c: new USB device 00:07.3-1, assigned address 2
usb.c: USB device 2 (vend/prod 0x400/0x807) is not claimed by any active driver.
usbdevfs: USBDEVFS_CONTROL failed dev 2 rqt 128 rq 6 len 18 ret -6
BlueZ Core ver 2.3 Copyright (C) 2000,2001 Qualcomm Inc
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
BlueZ HCI USB driver ver 2.4 Copyright (C) 2000,2001 Qualcomm Inc
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
usb.c: registered new driver hci_usb
usbdevfs: USBDEVFS_CONTROL failed dev 2 rqt 128 rq 6 len 18 ret -6
usbdevfs: USBDEVFS_CONTROL failed dev 2 rqt 128 rq 6 len 18 ret -6
usbdevfs: USBDEVFS_CONTROL failed dev 2 rqt 128 rq 6 len 9 ret -6
usbdevfs: USBDEVFS_CONTROL failed dev 2 rqt 128 rq 6 len 18 ret -6
Look for the "BlueZ" lines. They're telling you that your dongle has been recognized as a USB HCI device. In my case, the kernel modules have been loaded automatically. This might not be the case for everyone. See this site (link busted) on how to edit your /etc/modules.conf if necessary. Keep in mind though, that editing modules.conf directly is not the Gentoo way. Read the man page of modules-update for more.

Start the Bluetooth device

At the console, type "hciconfig" to see the Bluetooth HCI device that has been installed. There should be a hci0 device but it should be marked "DOWN".
# /etc/init.d/bluetooth start
This will start Gentoo's Bluetooth init script. Now, call hciconfig again.
# hciconfig
hci0:   Type: USB
        BD Address: 08:00:17:1B:42:96 ACL MTU: 339:4  SCO MTU: 60:9
        UP RUNNING PSCAN ISCAN
        RX bytes:5603 acl:177 sco:0 events:209 errors:0
        TX bytes:40682 acl:270 sco:0 commands:30 errors:0
The device is active now as can be seen by "UP RUNNING" in line 3. if the device appears as DOWN, you simply have to run:
# hciconfig hci0 up

If you want to start Bluetooth at boot time, add the script to the default runlevel:

# rc-update add bluetooth default

Let's detect the phone

The "hcitool" command line tool allows you to scan your environment for bluetooth devices. Make sure that your phone is switched on and Bluetooth is enabled. Then type:
# hcitool dev
Devices:
        hci0    08:00:17:1B:42:96
That was your local device. Nothing special here.
When scanning for your phone, be sure that your phone is in "discoverable" mode. This is usually found in the Bluetooth menu as "Find Me" or similar.
# hcitool inq
Inquiring ...
        00:0E:07:37:7C:BD       clock offset: 0x7080    class: 0x520204
# hcitool scan
Scanning ...
        00:0E:07:37:7C:BD       T630
Yay! That's my cell phone! "T630" is the factory's default name. You can change that on your cell phone of course.

Use GNOME to transfer stuff to your mobile

If you've emerged gnome-bluetooth, the fun has just begun. I'm running the yet masked GNOME 2.6. If you're still running 2.4 things are hopefully the same. First, no need to be root anymore. Log into GNOME as a regular user and open a terminal. Type "gnome-bluetooth-admin" (in GNOME 2.8 type gnome-bluetooth-manager) to launch the GUI version of hcitool.
Click "Scan" and after a while your mobile phone should appear.
Next, launch Nautilus and browse to "bluetooth:///". Marvel at the icon depicting your cell phone! You might be tempted to double click on it but this won't work. Instead, you need to drag&drop files onto the icon to transfer them to your mobile phone. In case that "bluetooth:///" doesn't work, try right clicking the file you want to send and select "Send via bluetooth ...".
Background images for the T630 are JPEG images with a size of 128x127 pixels. Use the gimp to create an image yourself or go to sites like http://www.mobile-arsenal.com.ua to get all the backgrounds you need. You're not limited to images. For example, ".thm" files are themes and they can be transfered as well. Midi files (.mid) are used as ring tones. Here are two examples to get started:
Shortly after you've dropped a file onto the icon, your mobile phone should pop up a dialog asking you to accept the incoming file. Do this quickly or Nautilus will time out after a few seconds. If you accept the incoming transfer, the file is uploaded to your phone and stored in the appropriate location of your mobile phone's memory. Go to your pictures folder to see the image or go to "Settings" -> "Display" -> "Themes" to select the new theme.

[added by xanda]

Newer version of gnome-bluetooth (0.8 and above) don't have "gnome-bluetooth-admin" or "gnome-bluetooth-manager" and GNOME (2.10 and above) wont recognize "bluetooth:///" when u type it in your Nautilus. What you should do is first, scan available device(s)

# hcitool scan
Scanning ...
       00:0E:07:37:7C:BD       T630
and now you can use gnome-obex-send to send your file to your mobile phone
gnome-obex-send --dest 00:0E:07:37:7C:BD /home/xanda/your-file.jpg

Use KDE to browse your mobile phone

Alternatively, you may use KDE to connect to your phone. KDE allows you to browse the contents of your mobile phone. If you don't have konqueror installed, do it
emerge konqueror
and then, emerge kdebluetooth
emerge net-wireless/kdebluetooth
Now, start kbluetoothd. Open a console and type
kbluetoothd
You'll then have a new protocol available in konqueror (bluetooth:///) from where you can browse the contents of your phone. Just open a konqueror window and type bluetooth:/// in the location bar.

Using your cellphone as remote control for xmms (tested on: Sony Ericsson T630, T610, K700i, K800i, W810)

If you have included RFCOMM protocol support and RFCOMM TTY support into your kernel you are able to configure your cellphone to function as a remote control for xmms. In order to do so, you first need to emerge xmms-btexmms as a plugin.
emerge xmms-btexmms
Now you have to establish the connection between your pc and your cellphone.
You do this by issuing the command rfcomm connect 0 <DEVICE ID>. <DEVICE ID> of course must be replaced by the actual device id of your mobilephone.
rfcomm connect 0 00:0E:07:42:ED:B2
  Connected /dev/rfcomm0 to 00:0E:07:42:ED:B2 on channel 1
  Press CTRL-C for hangup
In order to find out this device id you have to run hcitool as follows:
hcitool scan
       Scanning ...
       00:0E:07:42:ED:B2       Momesana

If you did not read the paragraph above yet: read it to find out how to set your PIN. k700i 9988

Now that the connection is established you must start xmms. It must be restarted if it was already running before the connection was made. Every time you reconnect the pc and cellphone you have to also restart xmms in order for it to work properly. Now you have to go to the Options > preferences > General Plugins and configure your BTE Control Plugin. You have to edit the Device Inputline to point to your rfcomm device. On a devfs filesystem it is somewhat like /dev/bluetooth/rfcomm/0. On udev you will find it as /dev/rfcomm0 etc. Feel free to make a symlink to it with a more suitable name such as /dev/phone. This is optional. Remember to then set your device config option in the above mentioned xmms config dialog to /dev/phone.

Now activate the plugin by checking the checkbox at the right bottom of the dialog.

ln -s /dev/rfcomm0 /dev/phone

Now enable your xmms plugin. On a Sony Ericsson cellphone you now can go to connectivity > accessories and select the xmms plugin. To find out about the keys and their function take a look at the config dialog of the plugin under xmms. If you receive an Error like "Can't open RFCOMM device: No such file or directory" as regular user (i.e. not root) and you are using udev, that indicates that your permissions are not correctly set. Since udev creates and deletes device files on demand you have to put the desired permissions in a config file residing under /etc/udev/permission.d. There is probably already a file named "50-udev.permissions". Don't edit this file! Instead create a new file that starts with a lower number, since this will override the settings set in the previously mentioned file. You may for example create a file called "10-udev.permissions" with your favourite editor (I use vi ;) ):

vi /etc/udev/permissions.d/10-udev.permissions

In that file you define the permissions as follows:

rfcomm*:root:dialout:0660

For >udev-056:

# vi /etc/udev/rules.d/10-local.rules

KERNEL="rfcomm[0-9]*", NAME="dialout/%k", GROUP="dialout", MODE="0660"

For >udev-070 the line above should read:

KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="dialout", MODE="0660"

The above configuration assumes that you belong to the dialout group. If you define a group you do not belong to, you will of course continue getting the error message. The first column rfcomm* means that all device files residing under /dev that start with rfcomm followed by a letter or digit are owned by root (second column -- defining the owner of the file) and belong to the group dialout (third column). The collon functions as a separator. With the above setting root and any member of the dialout group can create /dev/rfcomm, thus being able to use btexmms. You may choose another group and of course you can set other permissions. To enable everybody to use btexmms you may for example change the above permission from 0660 to 0666. Good luck and have fun!

Writing udev rules to have meaningful device names for RFCOMM devices

Here is an example:

ACTION=="add", SUBSYSTEM=="tty", KERNEL=="rfcomm[0-9]*", \
       WAIT_FOR_SYSFS="address", \
       ATTR{address}=="Y0:UR:MA:C_:AD:DR", \
       SYMLINK+="phone modem"

That will create symlinks /dev/phone and /dev/modem pointing to right device. WAIT_FOR_SYSFS really matters as you may hit race-condition otherwise.

Upload files and manage your SMSes / phonebook (tsemgr)

This program installs with a simple emerge command:

emerge -av tsemgr

It should support connections through serial cable / IR / Bluetooth, but so far I only just tested connection through serial cable. If you use a USB cable, set this in the 'config' pane:

  • Device: /dev/ttyUSB0

I used a SE DSS-20 usb cable (well, desktop stand actually, whatever) and a T630 phone. Unfortunately, the upload files functionality doesn't work for me. (it ends in a segmentation fault) Better luck for you! ;-)

Tsemgr works on bluetooth with a T-610. It also has features to create a "bluetooth remote control" by allowing you to launch predefined commands.

The development of tsemgr has stopped.

Bemused (Only on Nokia Symbian S60 and Nokia S40 with Java Phones)

Warning: Masked as of 02 Feb 2008: needs a version of media-sound/audacious which is no longer in the tree.

Works on most, if not all Nokia S60 Phones... and J2ME phones (a lot of Nokia S40 phones) with Bemused J2ME

This is a method for controlling xmms using a Nokia cellphone with Bluetooth and Java. It involves the bemused application being installed on the cellphone and a second part bemusedlinuxserver installed on your computer. To do this, download from bemused.sourceforge.net, unzip and then send bemused.sis (or bemused_full.sis) to your cellphone using either the Gnome or KDE transfer methods described above.

On the computer where your music is stored, type :

emerge bemused

You may need to unmask it:

echo "app-mobilephone/bemused" >> /etc/portage/package.keywords
emerge -av bemused

After bemused is installed on your computer, simply type bemusedlinuxserver in a console to run the server.
It will automatically start xmms. Now run Bemused on your phone and connect to your computer when it asks you to.

Its config file is located at /etc/bemused.conf. Its recommended to modify the mp3dir variable to suit your main mp3 folder.

If youre like me, just modify the config file to disable xmms autostart, and add a small script to run bemusedlinuxserver in the autostart folder to start bemused as soon as your desktop loads...

Phones it has been reported to successfully work on:

(Please add your phone to this list if it works satisfactorily on your phone)

Freevo Bluetooth Plugin

Freevo is a "Digital video jukebox (PVR, DVR)". Think MythTV/PlutoHome. There is a plugin avalible for Freevo that lets you use your cellphone as a remote. This uses RFCOMM and an AT/T (Hayes) command that sends all keypresses over the line to your computer. Most Symbian OS phones have this feature. Reported to work with Sony Ericsson T610, T65, Motorola E398 and a few Siemens phones. Download the plugin from the Freevo page (Downloads -> Plugins). Complete instructions is included with the plugin! Also, if you got a Nokia Series 60 phone, check out PlutoHome, their cellphone remote is cool.

Sending SMS with your Mobile Phone

First of all, you have to emerge the Gnome Phone Manager

emerge gnome-phone-manager

Start it (as a normal user) and go to "Preferences -> Connection". Choose bluetooth and click on "Choose" to select a mobile phone. Make sure your mobile is in "Discoverable" mode and click on scan. gnome-phone-manager should now find your mobile. Select it and click "OK". You mobile will now ask for a code (PIN) - simply type any code (eg. 1234). Just one second later, gnome-phone-manager will ask you for a code - type in the same one. Now your mobile is connected. Maybe it's a good idea to set "Automatically retry connections". If you connection is not stable (you can see that by looking on the symbol in your notification area), restart gnome-phone-manager (I needed to do so). After reconnecting, you should be able to send SMS, by simply right-clicking on the icon in the notification area and selecting "Send Message".

I tested this with a Motorola RAZR and a Samsung X11. Sending worked, however SMS were only received on the mobile phone (I wouldn't want to receive them on the notebook anyway...).

See also

I hope you've found this tutorial useful, even if you don't own a USB dongle and a T630. However, the process should be the same for other modern mobile phones. Just look for the right kind of images and themes suitable for your phone. Here are some links to pages that were useful to me:

Retrieved from "http://www.gentoo-wiki.info/Mobile_Phone/Bluetooth"

Last modified: Sun, 21 Sep 2008 22:11:00 +0000 Hits: 166,889