- 1 Installation
- 2 Graphical Front-ends
- 3 Manual Configuration
- 4 Pairing
- 5 Using Obex for sending and receiving files
- 6 Examples
- 7 Troubleshooting
- 8 Resources
To use Bluetooth, the bluez package for the Linux Bluetooth protocol stack must be installed:
# pacman -S bluez
Once bluez is installed, both the dbus daemon and the bluetooth daemon must be running:
# /etc/rc.d/dbus start # /etc/rc.d/bluetooth start
The dbus daemon is used to read settings and for pin pairing, while the bluetooth daemon is required for the Bluetooth protocol. It is important that dbus is started before bluetooth. If dbus was not running when bluetooth was started, then try (after dbus is running):
# /etc/rc.d/bluetooth restart
To start bluetooth automatically on boot, add bluetooth to your daemons array in rc.conf (after dbus):
To solve this, make sure dbus is not backgrounded.
The following packages allow for a graphical interface to customize Bluetooth.
# pacman -S blueman
Be sure that bluetooth daemon is running as described above and execute blueman-applet. To make the applet run on login add blueman-applet either under System -> Preferences -> Startup Applications (GNOME) or Xfce Menu -> Settings -> Session and Startup (Xfce).
Note: if you are running blueman outside Gnome/gdm, e.g. in Xfce using plain "startx" command you should add ". /etc/X11/xinit/xinitrc.d/*" on top of your ~/.xinitrc to make nautilus capable to browse your devices.
Note: if you are not using nautilus (for example thunar)(this may by useful for OpenBox/etc users) you may find this useful:
#!/bin/bash fusermount -u ~/bluetooth obexfs -b $1 ~/bluetooth thunar ~/bluetooth
without fusermount -u /mountpoint you may get an error caused by unclean unmounting of a fuse fs.
Now you will need to mv the script (i called it obex_thunar.sh) to /usr/bin, after that
chmod +x /usr/bin/obex_thunar.sh
Last step would be to change the line in Local Services > Transfer > Advanced to obex_thunar.sh %d
gnome-bluetooth is a fork of the old bluez-gnome and is focused on integration with the GNOME desktop environment. First, install gnome-bluetooth:
# pacman -S gnome-bluetooth gnome-user-share
Run bluetooth-applet for a nice Bluetooth applet. You should now be able to setup devices and send files by right-clicking the Bluetooth icon. To make the applet run on login, add it to System -> Preferences -> Startup Applications.
To add a Bluetooth entry to the SendTo menu in Thunar's file properties menu, see: http://thunar.xfce.org/pwiki/documentation/sendto_menu
The bluetooth tool for KDE4 is bluedevil. To install it type:
$ pacman -S bluedevil
Make sure bluetooth daemon is running. You should get a bluetooth icon both in dolphin & in the system tray, from which you can configure bluedevil, detect bluetooth devices, etc. by clicking the icon. You can also configure bluedevil from the KDE System Settings
Fluxbox, openbox, other wm
Of course you can still use the preceding applications even if GNOME, Xfce or KDE are not your desktop manager. This list should help you figuring out which application does what:
- bluetooth-applet -- tray icon with access to settings, pairing wizard, management of known devices
- /usr/lib/gnome-user-share/gnome-user-share -- needs to be running if you're about to receive files via obexBT from a paired/bonded device
if you're receiving an error during transmission and/or there's no file received add this into
<policy user="your_user_id"> <allow own="org.bluez"/> <allow send_destination="org.bluez"/> <allow send_interface="org.bluez.Agent"/> </policy>
- bluetooth-wizard -- for new devices to be paired
- bluetooth-properties -- accessible also via bluetooth-applet icon
- gnome-file-share-properties -- permissions on receiving files via bluetooth
- bluez-sendto -- gui for sending files to a remote device
To configure bluetooth (bluez) manually, you will need to edit the configuration files in /etc/bluetooth. These are:
audio.conf input.conf main.conf network.conf rfcomm.conf
The default configuration should work for most purposes. Most configuration options are well-documented in these files, so customization is a simple matter of reading the option descriptions. For general options, start with main.conf.
Many bluetooth devices require pairing. The exact procedure depends among other on the devices involved, and their input functionality. The procedure on a mobile may be as follows:
- The computer sends a connect request to the mobile.
- A pin, determined by the computer, is prompted for at the mobile
- The same key must be re-entered at the computer.
To scan for external devices, do
$> hcitool scan
To pair with a device without using the gnome-bluez package you will need to use a tool named bluez-simple-agent that comes with the bluez package. You need a few python related packages from the regular repositories to get this to run: dbus-python and pygobject. If you have everything ready you can start the script from the root user:
If it all works, you should get the message "Agent registered" on that console. You can now start pairing from your mobile device, and the script will ask you for the passcode on this console, you type it and confirm with enter - voila that's all. You can now also shut down the agent using ^C-c, you need it only for pairing, not every time you want to connect. If you can`t discover computer from your phone, go to troubleshooting section.
If you want to pair with a 'passive' device such as a headset, you can provide it's address to attempt pairing from your computer:
$> bluez-simple-agent hci0 00:11:22:33:AA:BB
For an example scroll down to the example section.
Using Obex for sending and receiving files
Another option, rather than using KDE or Gnome Bluetooth packages, is Obexfs which allows you to mount your phone and treat it as part of your filesystem. Note that to use Obexfs, you need a device that provides an Obex FTP service.
# pacman -S obexfs
and then your phone can then be mounted running as root
# obexfs -b <devices mac address> /mountpoint
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs
This is what I did to connect to my S55. (I have not figured out how to initiate the connection from the phone)
- The steps under installation
$> hcitool scan Scanning ... XX:XX:XX:XX:XX:XX NAME $> B=XX:XX:XX:XX:XX:XX
Start the simple-agent in a second terminal
$> su -c bluez-simple-agent Password: Agent registered
Back to the first console
$> obexftp -b $B -l "Address book" # Phone ask for pin, I enter it and answer yes when asked if I want to save the device ... <file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /> ... $> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr" Browsing 00:01:E3:6B:FF:D7 ... Channel: 5 Connecting...done Receiving "Address book/5F07.adr"... Sending "Address book"... done Disconnecting...done $> obexftp -b 00:01:E3:6B:FF:D7 -p a ... Sending "a"... done Disconnecting...done
Logitech Mouse MX Laser / M555b
To quickly test the connection:
$> hidd --connect XX:XX:XX:XX:XX:XX
For automated reconnection, use your desktop wizard to configure the bluetooth mouse. If your desktop environment doesn't includes support for this task, see the Bluetooth mouse manual configuration guide.
After installing blueman and running blueman-applet, click "find me" under connections -> bluetooth in motorla device. In blueman-applet, scan devices, find the motorola, click "add" in blueman-applet. Click "bond" in blueman-applet, enter some pin, enter the same pin in motorola when it asks. In terminal:
cd ~/ mkdir bluetooth-temp obexfs -n xx:yy:zz:... ~/bluetooth-temp cd ~/bluetooth-temp
and browse... Only audio, video, and pictures are available when you do this.
> pacman -S obextool obexfs obexftp openobex bluez
> lsusb Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module] Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> hciconfig hci0 up
> hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8 UP RUNNING RX bytes:348 acl:0 sco:0 events:11 errors:0 TX bytes:38 acl:0 sco:0 commands:11 errors:0
> hcitool dev Devices: hci0 00:16:41:97:BA:5E
Attention: make sure that bluetooth on your phone is enabled and your phone is visible!
> hcitool scan Scanning ... 00:1A:1B:82:9B:6D [quirxi]
> hcitool inq Inquiring ... 00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204
> l2ping 00:1A:1B:82:9B:6D Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ... 44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms 44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms 44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms 44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms 44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms 44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms 6 sent, 6 received, 0% loss
> hcitool name 00:1A:1B:82:9B:6D [quirxi]
# hciconfig -a hci0 hci0: Type: BR/EDR Bus: USB BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8 UP RUNNING RX bytes:9740 acl:122 sco:0 events:170 errors:0 TX bytes:2920 acl:125 sco:0 commands:53 errors:0 Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: Link mode: SLAVE ACCEPT Name: 'BCM2045' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 2.0 (0x3) Revision: 0x204a LMP Version: 2.0 (0x3) Subversion: 0x4176 Manufacturer: Broadcoml / Corporation (15)
> hcitool info 00:1A:1B:82:9B:6D Requesting information ... BD Address: 00:1A:1B:82:9B:6D Device Name: [quirxi] LMP Version: 1.2 (0x2) LMP Subversion: 0x309 Manufacturer: Broadcom Corporation (15) Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00 <3-slot packets> <5-slot packets> <encryption> <slot offset> <timing accuracy> <role switch> <hold mode> <sniff mode> <RSSI> <channel quality> <SCO link> <HV2 packets> <HV3 packets> <A-law log> <CVSD> <power control> <transparent SCO> <AFH cap. slave> <AFH cap. master>
Edit your main.conf and enter the proper class for your phone ( Class = 0x100100 ):
> vim /etc/bluetooth/main.conf
# Default device class. Only the major and minor device class bits are # considered. #Class = 0x000100 Class = 0x100100
> /etc/rc.d/dbus start :: Starting D-BUS system messagebus [DONE]
> /etc/rc.d/bluetooth start :: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd [DONE] :: Starting bluetooth subsystem: bluetoothd
Pairing with bluez-simple-agent only has to be done once. On your motorola-phone give 0000 in as your pin when phone asks for it !!
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D) Enter PIN Code: 0000 Release New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)
Now u can browse the filesystem of your phone with obexftp:
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l Connecting..\done Tried to connect for 448ms Receiving "(null)"...-<?xml version="1.0" ?> <!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"> <folder-listing> <parent-folder /> <folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /> <folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /> <folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /> </folder-listing> done Disconnecting..\done
Or you can mount your phone into a directory on your computer and treat it like a normal file system:
> groupadd bluetooth > mkdir /mnt/bluetooth > chown root:bluetooth /mnt/bluetooth > chmod 775 /mnt/bluetooth > usermod -a -G bluetooth arno
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/ > l /mnt/bluetooth/ total 6 drwxr-xr-x 1 root root 0 10. Okt 13:25 . drwxr-xr-x 5 root root 4096 10. Okt 10:08 .. drwxr-xr-x 1 root root 0 10. Okt 2010 audio drwxr-xr-x 1 root root 0 10. Okt 2010 picture drwxr-xr-x 1 root root 0 10. Okt 2010 video
Pairing with an iPhone using bluez-simple-agent
Assuming a bluetooth device called hci0 and an iPhone that showed up in a hcitool scan as '00:00:DE:AD:BE:EF':
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF Passcode:
$> passkey-agent --default 1234 Can't register passkey agent The name org.bluez was not provided by any .service files
You probably started /etc/rc.d/bluetooth before /etc/rc.d/dbus
$> hciconfig dev # (no listing)
Try running hciconfig hc0 up
If blueman-applet fails to start, try removing the entire /var/lib/bluetooth directory and restarting the machine (or just the hal, dbus, and bluetooth services).
# rm -rf /var/lib/bluetooth # reboot
If you see this when trying to enable receiving files in bluetooth-properties:
Bluetooth OBEX start failed: Invalid path Bluetooth FTP start failed: Invalid path
# pacman -S xdg-user-dirs $ xdg-user-dirs-update
You can edit the paths using:
$ vi ~/.config/user-dirs.dirs
Bluetooth USB Dongle
If you are using a USB dongle, you should check that your Bluetooth dongle is recognized. You can do that by inspecting /var/log/messages.log when plugging in the USB dongle. It should look something like the following (look out for hci):
# tail -f /var/log/messages.log May 2 23:36:40 tatooine usb 4-1: new full speed USB device using uhci_hcd and address 9 May 2 23:36:40 tatooine usb 4-1: configuration #1 chosen from 1 choice May 2 23:36:41 tatooine hcid: HCI dev 0 registered May 2 23:36:41 tatooine hcid: HCI dev 0 up May 2 23:36:41 tatooine hcid: Device hci0 has been added May 2 23:36:41 tatooine hcid: Starting security manager 0 May 2 23:36:41 tatooine hcid: Device hci0 has been activated
For a list of supported hardware please refer to the resources section on this page.
If you only get the first two lines, you may see that it found the device but you need to bring it up. Example:
hciconfig -a hci0 hci0: Type: USB BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0 DOWN RX bytes:0 acl:0 sco:0 events:0 errors:0 TX bytes:0 acl:0 sco:0 commands:0 errors: sudo hciconfig hci0 up hciconfig -a hci0 hci0: Type: USB BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8 UP RUNNING RX bytes:348 acl:0 sco:0 events:11 errors:0 TX bytes:38 acl:0 sco:0 commands:11 errors:0
To verify that the device was detected you can use hcitool which is part of the bluez-utils. You can get a list of available devices and their identifiers and their MAC address by issuing:
$ hcitool dev Devices: hci0 00:1B:DC:0F:DB:40
More detailed informations about the device can be retrieved by using hciconfig.
$ hciconfig -a hci0 hci0: Type: USB BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:1226 acl:0 sco:0 events:27 errors:0 TX bytes:351 acl:0 sco:0 commands:26 errors:0 Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'BlueZ (0)' Class: 0x000100 Service Classes: Unspecified Device Class: Computer, Uncategorized HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c Manufacturer: Cambridge Silicon Radio (10)
hcitool scan: Device not found
- On some Dell laptops (e.g. Studio 15) you have to switch the Bluetooth mode from HID to HCI using
- Sometimes also this simple command helps:
# hciconfig hci0 up
My computer isn't visible
Can't discover computer from your phone? Enable PSCAN and ISCAN:
# enable PSCAN and ISCAN $ hciconfig hci0 piscan # check it worked $ hciconfig hci0: Type: USB BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:20425 acl:115 sco:0 events:526 errors:0 TX bytes:5543 acl:84 sco:0 commands:340 errors:0
Try changing device class in /etc/bluetooth/main.conf as following
# Default device class. Only the major and minor device class bits are # considered. #Class = 0x000100 (from default config) Class = 0x100100
This was the only solution to make my computer visible for my phone.
Nautilus cannot browse files
If nautilus doesn't open and show this error:
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".
Install gvfs-obexftp package:
# pacman -S gvfs-obexftp
Bluetooth is disabled when starting gnome
Make sure that in your DAEMONS array (/etc/rc.conf) dbus is loaded before bluetooth. Also check whether dbus is backgrounded (@). If so, a possible solution is removing the unbackground dbus. (Removing @)