https://wiki.archlinux.org/api.php?action=feedcontributions&user=Wfx&feedformat=atomArchWiki - User contributions [en]2024-03-28T13:51:37ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Bluetooth&diff=271963Bluetooth2013-08-21T11:19:51Z<p>Wfx: /* rfkill unblock: Do not unblock */</p>
<hr />
<div>[[Category:Bluetooth]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[[zh-CN:Bluetooth]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers the installation and use of Bluetooth on Arch Linux.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Bluetooth mouse configuration}}<br />
{{Article summary end}}<br />
<br />
{{Out of date|Several generations of various deprecated tools are mentioned. bluez4 and bluez are confused. This article needs cleanup from someone who knows what commands belong in which packages.}}<br />
<br />
[http://www.bluetooth.org/ Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. In Linux, the canonical implementation of the Bluetooth protocol stack is [http://www.bluez.org/ BlueZ].<br />
<br />
== Installation ==<br />
To use Bluetooth, [[pacman|install]] {{Pkg|bluez}}, available in the [[Official Repositories]]. The {{ic|dbus}} daemon(start automatically by systemd) is used to read settings and for PIN pairing, while the {{ic|bluetooth}} daemon is required for the Bluetooth protocol.<br />
<br />
Start the bluetooth service:<br />
# systemctl start bluetooth.service<br />
<br />
Enable the bluetooth service at system boot up:<br />
# systemctl enable bluetooth.service<br />
<br />
== Graphical front-ends ==<br />
<br />
The following packages allow for a graphical interface to customize Bluetooth.<br />
<br />
=== Blueman ===<br />
<br />
[http://blueman-project.org Blueman] is a full featured Bluetooth manager written in [[GTK+]] and, as such, is recommended for [[GNOME]],[[Xfce]], or [[LXDE]]. You can install Blueman with the package {{Pkg|blueman}}, available in the [[Official Repositories]].<br />
<br />
Be sure that {{ic|bluetooth}} daemon is running as described above, and the local bluetooth device is availabe by running {{ic|hcitool dev}}. If only {{ic|Devices:}} is dumped, the local bluetooth device is unavailable. You may run {{ic|systemctl restart bluetooth.service}} or toggle the wifi/bluetooth switch of your laptop {{ic|Ex. Fn+F3 in Acer Aspire}} or reboot to activat the local bluetooth device. If you run {{ic|blueman-applet}} without available local bluetooth device, the {{ic|Blueman tray icon}} won't appear.<br />
<br />
Then execute {{ic|blueman-applet}}, and the Blueman tray icon will show up. {{ic|/etc/xdg/autostart/blueman.desktop}} may have been created to autostart {{ic|Blueman}} when loggin into X in a system-wide manner. If not, to make the applet run after login into a graphical environment automatically, add {{ic|blueman-applet}} either under ''System -> Preferences -> Startup Applications'' (GNOME) or ''Xfce Menu -> Settings -> Session and Startup'' (Xfce). Various ways to autosrtart a program are listed in [[Autostarting]].<br />
<br />
In order for a user to add and manage Bluetooth devices using Blueman, the user must be added to the 'lp' group. See /etc/dbus-1/system.d/bluetooth.conf for the section that enables users of the 'lp' group to communicate with the Bluetooth daemon.<br />
<br />
{{Note|If you are running Blueman outside GNOME/GDM (e.g., in Xfce using the {{ic|startx}} command) you should add {{ic|. /etc/X11/xinit/xinitrc.d/*}} on top of your {{ic|~/.xinitrc}} to make Nautilus capable to browse your devices.}}<br />
<br />
To receive files don't forget to right click on the ''Blueman tray icon -> Local Services -> Transfer -> File Receiving" and tick the square box next to "Enabled".<br />
<br />
==== Script for Thunar ====<br />
If you are not using Nautilus (for example Thunar) you may find the following script useful:<br />
{{hc|obex_thunar.sh|<br />
#!/bin/bash<br />
fusermount -u ~/bluetooth<br />
obexfs -b $1 ~/bluetooth<br />
thunar ~/bluetooth<br />
}}<br />
Now you will need to move the script to an appropriate location (e.g., {{ic|/usr/bin}}). After that, mark it as executable:<br />
{{bc|chmod +x /usr/bin/obex_thunar.sh}}<br />
The last step is to change the line in ''Blueman tray icon -> Local Services -> Transfer -> Advanced'' to {{ic|obex_thunar.sh %d}}.<br />
<br />
=== GNOME Bluetooth ===<br />
<br />
[http://live.gnome.org/GnomeBluetooth GNOME Bluetooth] is a fork of the old ''bluez-gnome'' and is focused on integration with the [[GNOME]] desktop environment. GNOME Bluetooth is required by {{Pkg|gnome-shell}}, so you should already have it installed if you are running GNOME 3. Otherwise, it can be installed with the package {{Pkg|gnome-bluetooth}}. Note that gnome-shell, gnome-bluetooth <= 3.8 depend upon {{Pkg|bluez4}}. From gnome-shell 3.10 onwards, {{Pkg|bluez}} will be supported. More information regarding the GNOME migration to {{Pkg|bluez}} can be found [http://worldofgnome.org/gnome-3-10-port-to-bluez-5/ here] (June 2013 blog post).<br />
<br />
Run {{ic|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''.<br />
<br />
To add a Bluetooth entry to the ''SendTo'' menu in Thunar's file properties menu, see instructions [http://thunar.xfce.org/pwiki/documentation/sendto_menu here].<br />
<br />
=== BlueDevil ===<br />
<br />
The Bluetooth tool for [[KDE]] is [https://projects.kde.org/projects/extragear/base/bluedevil BlueDevil]. It can be installed with the package {{Pkg|bluedevil}}, available in the [[Official Repositories]].<br />
<br />
Make sure {{ic|bluetooth}} daemon is running, as described above. You should get a Bluetooth icon both in Dolphin and in the system tray, from which you can configure BlueDevil and detect Bluetooth devices by clicking the icon. You can also configure BlueDevil from the KDE System Settings<br />
<br />
=== Fluxbox, Openbox, other WM ===<br />
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:<br />
* bluetooth-applet -- tray icon with access to settings, pairing wizard, management of known devices<br />
* /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<br />
<br />
if you're receiving an error during transmission and/or there's no file received add this into<br />
<br />
{{ic|/etc/dbus-1/system.d/bluetooth.conf}}<br />
<policy user="your_user_id"><br />
<allow own="org.bluez"/><br />
<allow send_destination="org.bluez"/><br />
<allow send_interface="org.bluez.Agent"/><br />
</policy><br />
<br />
* bluetooth-wizard -- for new devices to be paired<br />
* bluetooth-properties -- accessible also via bluetooth-applet icon<br />
* gnome-file-share-properties -- permissions on receiving files via bluetooth<br />
* bluez-sendto -- gui for sending files to a remote device<br />
<br />
== Bluez Utils ==<br />
<br />
The package {{Pkg|bluez-utils}} contains various commands,<br />
which are useful to configure and troubleshoot Bluetooth<br />
from the command line.<br />
<br />
=== hciconfig ===<br />
<br />
Print name and basic information about all the Bluetooth devices installed in the system:<br />
$ hciconfig<br />
<br />
To activate a device, use:<br />
# hciconfig <device-name> up<br />
<br />
=== hcitool ===<br />
<br />
To scan for remote devices:<br />
$ hcitool scan<br />
<br />
== Pairing ==<br />
Many bluetooth devices require [http://en.wikipedia.org/wiki/Bluetooth#Pairing pairing].<br />
The exact procedure depends on the devices involved and their input functionality.<br />
<br />
=== with the current bluez (bluez5) ===<br />
<br />
Start the {{ic|bluetoothctl}} interactive command. There you can input {{ic|help}} to get a list of available commands. <br />
* Enter {{ic|devices}} to get the MAC Address of the device with which you want to pair.<br />
* Enter {{ic|pair <MAC Address>}} to do the pairing.<br />
* Finally, use {{ic|connect <MAC Address>}} to establish a connection.<br />
<br />
=== with bluez4 ===<br />
<br />
The procedure on a mobile may be as follows:<br />
* The computer sends a connect request to the mobile. <br />
* A pin, determined by the computer, is prompted for at the mobile<br />
* The same key must be re-entered at the computer.<br />
<br />
To pair with a device without using the gnome-bluez package, the ''bluez-simple-agent'' utility that comes with the bluez package can be used. This utility depends on three packages from [extra]:<br />
<br />
# pacman -S python2-dbus python2-gobject dbus-glib<br />
<br />
First, scan for external devices:<br />
$ hcitool scan<br />
<br />
Run the script as root:<br />
<br />
# bluez-simple-agent<br />
<br />
The message "Agent registered" should be returned, press control-c to quit. <br />
<br />
Below is a basic example of pairing with a specific device. The script will ask for the passcode, enter the code and confirm with enter.<br />
<br />
# bluez-simple-agent hci0 00:11:22:33:AA:BB<br />
<br />
{{note|bluez-simple-agent is only needed once for pairing a device, not every time you want to connect.}}<br />
<br />
See the Examples section below for pairing examples with various devices.<br />
<br />
== Using Obex for sending and receiving files ==<br />
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.<br />
<br />
To install;<br />
# pacman -S obexfs<br />
<br />
and then your phone can then be mounted by running <br />
$ obexfs -b <devices mac address> /mountpoint<br />
<br />
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
For devices don't support Obex FTP service, check if Obex Object Push is supported.<br />
<br />
# sdptool browse XX:XX:XX:XX:XX:XX<br />
<br />
Read the output, look for Obex Object Push, remember the channel for this service. If supported, you can use ussp-push to send files to this device:<br />
<br />
# ussp-push XX:XX:XX:XX:XX:XX@CHANNEL file wanted_file_name_on_phone<br />
<br />
== Examples ==<br />
<br />
=== Siemens S55 ===<br />
<br />
This is what I did to connect to my S55. (I have not figured out how to initiate the connection from the phone)<br />
* The steps under installation<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
Start the simple-agent in a second terminal<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
Back to the first console <br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== Logitech Mouse MX Laser / M555b ===<br />
<br />
To quickly test the connection:<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
For automated reconnection, use your desktop wizard to configure the bluetooth mouse.<br />
If your desktop environment doesn't includes support for this task, see the [[Bluetooth mouse manual configuration]] guide.<br />
<br />
=== Motorola V900 ===<br />
<br />
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:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
and browse... Only audio, video, and pictures are available when you do this.<br />
<br />
=== Motorola RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''Attention: make sure that bluetooth on your phone is enabled and your phone is visible! <br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
'''Edit your main.conf and enter the proper class for your phone ( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
'''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 !!'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''Now you can browse the filesystem of your phone with obexftp:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''Or you can mount your phone into a directory on your computer and treat it like a normal file system:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== Pairing with an iPhone using bluez-simple-agent ===<br />
<br />
Assuming a bluetooth device called hci0 and an iPhone that showed up in a hcitool scan as '00:00:DE:AD:BE:EF':<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
=== Headset and Alsa Devices ===<br />
==== by referencing the bluetooth device in asound.conf ====<br />
1. First if you have not already, install bluez<br />
# pacman -S bluez<br />
2. Scan for your device<br />
$ hcitool (-i <optional hci#>***) scan<br />
3. Pair your headset with your device<br />
$ bluez-simple-agent (optional hci# ***) XX:XX:XX:XX:XX:XX<br />
and put in your pin (0000 or 1234, etc)<br />
4. Add this to your/etc/asound.conf file<br />
#/etc/asound.conf<br />
<br />
pcm.btheadset {<br />
type plug<br />
slave {<br />
pcm {<br />
type bluetooth<br />
device XX:XX:XX:XX:XX:XX <br />
profile "auto"<br />
} <br />
} <br />
hint {<br />
show on<br />
description "BT Headset"<br />
} <br />
}<br />
ctl.btheadset {<br />
type bluetooth<br />
} <br />
<br />
5. Check to see if it has been added to alsa devices<br />
$ aplay -L<br />
<br />
6. Now play with aplay:<br />
$ aplay -D btheadset /path/to/audio/file<br />
<br />
or Mplayer:<br />
$ mplayer -ao alsa:device=btheadset /path/to/audio/or/video/file<br />
<br />
*** To find hci# for a usb dongle, type in <br />
$ hcitool dev<br />
<br />
==== by using bluez-tools from the AUR ====<br />
You can use {{aur|bluez-tools}} from the [[AUR]] with pulseaudio to stream audio to a bluetooth headset. <br />
Find the MAC of the headset:<br />
$ hcitool scan<br />
Connect to the headset:<br />
$ bt-audio -c XX:XX:XX:XX:XX:XX<br />
Open pulseaudio volume control:<br />
$ pavucontrol<br />
The headset should show up in the Configuration tab.<br />
<br />
=== Microsoft Bluetooth Mobile Keyboard 6000 ===<br />
<br />
1. Scan for your device<br />
$ hcitool (-i <optional hci#>***) scan<br />
Scanning ...<br />
00:11:22:33:44:55 Microsoft Bluetooth Mobile Keyboard 6000<br />
<br />
<br />
2. On second console run as root (do not terminate):<br />
# bluez-simple-agent<br />
Agent registered<br />
<br />
3. Back on first console run:<br />
$ bluez-simple-agent hci0 00:11:22:33:44:55<br />
Enter PIN Code: 1234<br />
(now enter that pin on the keyboard and press enter)<br />
Release<br />
New device (/org/bluez/5373/hci0/dev_00_11_22_33_44_55)<br />
<br />
4.<br />
$ bluez-test-device trusted 00:11:22:33:44:55<br />
<br />
5.<br />
$ bluez-test-input connect 00:11:22:33:44:55<br />
<br />
No your keyboard should work. You can terminate bluez-simple-agent on second console with Ctrl-C<br />
<br />
== Troubleshooting ==<br />
<br />
=== Segfaults in Bluez 4.95 ===<br />
If bluetoothd stops working after enabling or disabling your bluetooth device via rfkill or gnome-bluetooth applet, look at your dmesg output. If it looks like:<br />
<br />
bluetoothd[2330]: segfault at 1 ip 00007fcef2327b75 sp 00007fff9f769cb0 error 4 in libglib-2.0.so.0.2800.8[7fcef22ca000+e9000]<br />
<br />
then you should consider downgrading to 4.94 (just grab the PKGBUILD/etc from arch and change version to 4.94 and correct the md5sum for bluez) or wait for an update of bluez. [https://bugs.archlinux.org/task/25088?project=1&openedfrom=-1+week Here] is a (arch) bug report about it.<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
You probably started {{ic|/etc/rc.d/bluetooth}} before {{ic|/etc/rc.d/dbus}}<br />
$> hciconfig dev<br />
# (no listing)<br />
Try running {{ic|hciconfig hc0 up}}<br />
<br />
=== Blueman ===<br />
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).<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
If you see a notification saying '''Incoming file over Bluetooth''' then this means that the device isn't marked as trusted. Mark it as trusted and try again (looking at the code, it looks like some buttons should be displayed in the notification, but I don't see them).<br />
<br />
=== gnome-bluetooth ===<br />
If you see this when trying to enable receiving files in bluetooth-properties:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
Then run:<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
You can edit the paths using:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB Dongle ===<br />
If you are using a USB dongle, you should check that your Bluetooth dongle is recognized. You can do that by inspecting {{ic|/var/log/messages.log}} when plugging in the USB dongle (or running {{ic|journalctl -f}} with systemd). It should look something like the following (look out for hci):<br />
<br />
# tail -f /var/log/messages.log<br />
Feb 20 15:00:24 hostname kernel: [ 2661.349823] usb 4-1: new full-speed USB device number 3 using uhci_hcd<br />
Feb 20 15:00:24 hostname bluetoothd[4568]: HCI dev 0 registered<br />
Feb 20 15:00:24 hostname bluetoothd[4568]: Listening for HCI events on hci0<br />
Feb 20 15:00:25 hostname bluetoothd[4568]: HCI dev 0 up<br />
Feb 20 15:00:25 hostname bluetoothd[4568]: Adapter /org/bluez/4568/hci0 has been enabled<br />
<br />
For a list of supported hardware please refer to the [[Bluetooth#Resources|resources]] section on this page.<br />
<br />
If you only get the first two lines, you may see that it found the device but you need to bring it up.<br />
Example:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
If this fails with an error like:<br />
Operation not possible due to RF-kill<br />
it could be due either to the {{ic|rfkill}} utility, in which case it should be resolved with<br />
# rfkill unblock all<br />
or, it could simply be the hardware switch of the computer. The hardware bluetooth switch (at least sometimes) controls access to USB bluetooth dongles also. Flip/press this switch and try bringing the device up again.<br />
<br />
To verify that the device was detected you can use {{ic|hcitool}} which is part of the {{ic|bluez-utils}}. You can get a list of available devices and their identifiers and their MAC address by issuing:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
More detailed informations about the device can be retrieved by using {{ic|hciconfig}}.<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== Logitech Bluetooth USB Dongle ===<br />
There are Logitech dongles (ex. Logitech MX5000) that can work in two modes Embedded and HCI. In embedded mode dongle emulates a USB device so it seems to your PC that your using a normal USB mouse/keyoard.<br />
<br />
If you hold the little red Button on the USB BT mini-receiver it will enable the other mode. Hold the red button on the BT dongle and plug it into the computer, and after 3-5 seconds of holding the button, the Bluetooth icon will appear in the system tray. [http://ubuntuforums.org/showthread.php?t=1332197 Discussion]<br />
<br />
=== hcitool scan: Device not found ===<br />
* On some Dell laptops (e.g. Studio 15) you have to switch the Bluetooth mode from HID to HCI using<br />
# hid2hci<br />
<br />
{{Note|hid2hci is no longer in the $PATH, it is under /lib/udev/hid2hci, but udev should run it automatically for you.}}<br />
<br />
* If the device won't show up and you have a Windows operating system on your machine, try booting it and enable the bluetooth adapter from windows.<br />
<br />
* Sometimes also this simple command helps:<br />
# hciconfig hci0 up<br />
<br />
=== rfkill unblock: Do not unblock ===<br />
<br />
If youre device still soft blocked and you run connman.<br />
<br />
Try this:<br />
$ connmanctl enable bluetooth<br />
<br />
=== My computer isn't visible ===<br />
Can't discover computer from your phone? Enable PSCAN and ISCAN:<br />
# enable PSCAN and ISCAN<br />
$ hciconfig hci0 piscan <br />
# check it worked<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{Note | Check DiscoverableTimeout and PairableTimeout in /etc/bluetooth/main.conf}}<br />
<br />
Try changing device class in /etc/bluetooth/main.conf as following<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
=== Bluetooth is disabled when starting GNOME ===<br />
If you have {{ic|dbus}} and {{ic|bluetooth}} backgrounded (@) in your {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, it might happen that {{ic|bluetooth}} will be disabled when starting up GNOME. To solve this, make sure {{ic|dbus}} is not backgrounded.<br />
<br />
=== Sennheiser MM400 Headset connection problems ===<br />
If your {{ic|Sennheiser MM400 Headset}} immediately disconnects after connecting as {{ic|Headset Service}} with Blueman, try to connect it as {{ic|Audio Sink}}. Afterwards you can change the headset's {{ic|Audio Profile}} to {{ic|Telephony Duplex}} with a right click in Blueman.<br />
With this option headset functionality will be available although the headset was only connected as {{ic|Audio Sink}} in first place and no disconnection will happen (tested with bluez 4.96-3, pulseaudio 1.1-1 and blueman 1.23-2).<br />
<br />
=== My device is paired but no sound is played from it ===<br />
Try to first inspect '''/var/log/messages.log'''<br />
{{bc|# tail /var/log/messages.log<br />
Jan 12 20:08:58 localhost pulseaudio[1584]: [pulseaudio] module-bluetooth-device.c: Service not connected<br />
Jan 12 20:08:58 localhost pulseaudio[1584]: [pulseaudio] module-bluetooth-device.c: Bluetooth audio service not available}}<br />
<br />
If you see such messages, try first:<br />
{{bc|# pactl load-module module-bluetooth-device}}<br />
<br />
If the module fails to work, do this workaround:<br />
Open '''/etc/bluetooth/audio.conf''' and add after '''[General]''' (on a new line)<br />
{{bc|Enable&#61;Socket}}<br />
Then restart the bluetooth daemon with {{ic|/etc/rc.d/bluetooth restart}}.<br />
Pair again your device, and you should find it in the pulseaudio settings (advanced settings for the sound)<br />
<br />
[http://wiki.gentoo.org/index.php?title=Bluetooth_Headset&redirect=no More information on Gentoo Wiki]<br />
<br />
If after fixing this you still can't get sound, try using blueman (this is the only one that works for me), make sure that notify-osd is installed or it might show you weird error messages like this one: "Stream setup failed"<br />
<br />
fail (/usr/lib/python2.7/site-packages/blueman/gui/manager/ManagerDeviceMenu.py:134)<br />
fail (DBusException(dbus.String(u'Stream setup failed'),),)<br />
<br />
== See also ==<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo Linux Bluetooth Guide]<br />
*[http://en.opensuse.org/HCL:Bluetooth openSUSE Bluetooth Hardware Compatibility List]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone (Linux Gazette)]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]<br />
*[http://www.elstel.org/MobilePhone.html Bluetooth for Your Mobile Phone: Bluetooth Pairing, Data Synchronization, Photo Download, Internet Dial-Up (Tethering)]<br />
*[http://www.elstel.org/MobilePhone.html Bluetooth Pairing and Applications for Synchronizing Phone Numbers, SMS-messages, Phone Call Entries, your Calendar and Time; Tethering]</div>Wfxhttps://wiki.archlinux.org/index.php?title=Bluetooth&diff=271962Bluetooth2013-08-21T11:16:59Z<p>Wfx: /* Troubleshooting */</p>
<hr />
<div>[[Category:Bluetooth]]<br />
[[cs:Bluetooth]]<br />
[[de:Bluetooth]]<br />
[[es:Bluetooth]]<br />
[[fr:Bluetooth]]<br />
[[it:Bluetooth]]<br />
[[ru:Bluetooth]]<br />
[[zh-CN:Bluetooth]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers the installation and use of Bluetooth on Arch Linux.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Bluetooth mouse configuration}}<br />
{{Article summary end}}<br />
<br />
{{Out of date|Several generations of various deprecated tools are mentioned. bluez4 and bluez are confused. This article needs cleanup from someone who knows what commands belong in which packages.}}<br />
<br />
[http://www.bluetooth.org/ Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. In Linux, the canonical implementation of the Bluetooth protocol stack is [http://www.bluez.org/ BlueZ].<br />
<br />
== Installation ==<br />
To use Bluetooth, [[pacman|install]] {{Pkg|bluez}}, available in the [[Official Repositories]]. The {{ic|dbus}} daemon(start automatically by systemd) is used to read settings and for PIN pairing, while the {{ic|bluetooth}} daemon is required for the Bluetooth protocol.<br />
<br />
Start the bluetooth service:<br />
# systemctl start bluetooth.service<br />
<br />
Enable the bluetooth service at system boot up:<br />
# systemctl enable bluetooth.service<br />
<br />
== Graphical front-ends ==<br />
<br />
The following packages allow for a graphical interface to customize Bluetooth.<br />
<br />
=== Blueman ===<br />
<br />
[http://blueman-project.org Blueman] is a full featured Bluetooth manager written in [[GTK+]] and, as such, is recommended for [[GNOME]],[[Xfce]], or [[LXDE]]. You can install Blueman with the package {{Pkg|blueman}}, available in the [[Official Repositories]].<br />
<br />
Be sure that {{ic|bluetooth}} daemon is running as described above, and the local bluetooth device is availabe by running {{ic|hcitool dev}}. If only {{ic|Devices:}} is dumped, the local bluetooth device is unavailable. You may run {{ic|systemctl restart bluetooth.service}} or toggle the wifi/bluetooth switch of your laptop {{ic|Ex. Fn+F3 in Acer Aspire}} or reboot to activat the local bluetooth device. If you run {{ic|blueman-applet}} without available local bluetooth device, the {{ic|Blueman tray icon}} won't appear.<br />
<br />
Then execute {{ic|blueman-applet}}, and the Blueman tray icon will show up. {{ic|/etc/xdg/autostart/blueman.desktop}} may have been created to autostart {{ic|Blueman}} when loggin into X in a system-wide manner. If not, to make the applet run after login into a graphical environment automatically, add {{ic|blueman-applet}} either under ''System -> Preferences -> Startup Applications'' (GNOME) or ''Xfce Menu -> Settings -> Session and Startup'' (Xfce). Various ways to autosrtart a program are listed in [[Autostarting]].<br />
<br />
In order for a user to add and manage Bluetooth devices using Blueman, the user must be added to the 'lp' group. See /etc/dbus-1/system.d/bluetooth.conf for the section that enables users of the 'lp' group to communicate with the Bluetooth daemon.<br />
<br />
{{Note|If you are running Blueman outside GNOME/GDM (e.g., in Xfce using the {{ic|startx}} command) you should add {{ic|. /etc/X11/xinit/xinitrc.d/*}} on top of your {{ic|~/.xinitrc}} to make Nautilus capable to browse your devices.}}<br />
<br />
To receive files don't forget to right click on the ''Blueman tray icon -> Local Services -> Transfer -> File Receiving" and tick the square box next to "Enabled".<br />
<br />
==== Script for Thunar ====<br />
If you are not using Nautilus (for example Thunar) you may find the following script useful:<br />
{{hc|obex_thunar.sh|<br />
#!/bin/bash<br />
fusermount -u ~/bluetooth<br />
obexfs -b $1 ~/bluetooth<br />
thunar ~/bluetooth<br />
}}<br />
Now you will need to move the script to an appropriate location (e.g., {{ic|/usr/bin}}). After that, mark it as executable:<br />
{{bc|chmod +x /usr/bin/obex_thunar.sh}}<br />
The last step is to change the line in ''Blueman tray icon -> Local Services -> Transfer -> Advanced'' to {{ic|obex_thunar.sh %d}}.<br />
<br />
=== GNOME Bluetooth ===<br />
<br />
[http://live.gnome.org/GnomeBluetooth GNOME Bluetooth] is a fork of the old ''bluez-gnome'' and is focused on integration with the [[GNOME]] desktop environment. GNOME Bluetooth is required by {{Pkg|gnome-shell}}, so you should already have it installed if you are running GNOME 3. Otherwise, it can be installed with the package {{Pkg|gnome-bluetooth}}. Note that gnome-shell, gnome-bluetooth <= 3.8 depend upon {{Pkg|bluez4}}. From gnome-shell 3.10 onwards, {{Pkg|bluez}} will be supported. More information regarding the GNOME migration to {{Pkg|bluez}} can be found [http://worldofgnome.org/gnome-3-10-port-to-bluez-5/ here] (June 2013 blog post).<br />
<br />
Run {{ic|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''.<br />
<br />
To add a Bluetooth entry to the ''SendTo'' menu in Thunar's file properties menu, see instructions [http://thunar.xfce.org/pwiki/documentation/sendto_menu here].<br />
<br />
=== BlueDevil ===<br />
<br />
The Bluetooth tool for [[KDE]] is [https://projects.kde.org/projects/extragear/base/bluedevil BlueDevil]. It can be installed with the package {{Pkg|bluedevil}}, available in the [[Official Repositories]].<br />
<br />
Make sure {{ic|bluetooth}} daemon is running, as described above. You should get a Bluetooth icon both in Dolphin and in the system tray, from which you can configure BlueDevil and detect Bluetooth devices by clicking the icon. You can also configure BlueDevil from the KDE System Settings<br />
<br />
=== Fluxbox, Openbox, other WM ===<br />
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:<br />
* bluetooth-applet -- tray icon with access to settings, pairing wizard, management of known devices<br />
* /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<br />
<br />
if you're receiving an error during transmission and/or there's no file received add this into<br />
<br />
{{ic|/etc/dbus-1/system.d/bluetooth.conf}}<br />
<policy user="your_user_id"><br />
<allow own="org.bluez"/><br />
<allow send_destination="org.bluez"/><br />
<allow send_interface="org.bluez.Agent"/><br />
</policy><br />
<br />
* bluetooth-wizard -- for new devices to be paired<br />
* bluetooth-properties -- accessible also via bluetooth-applet icon<br />
* gnome-file-share-properties -- permissions on receiving files via bluetooth<br />
* bluez-sendto -- gui for sending files to a remote device<br />
<br />
== Bluez Utils ==<br />
<br />
The package {{Pkg|bluez-utils}} contains various commands,<br />
which are useful to configure and troubleshoot Bluetooth<br />
from the command line.<br />
<br />
=== hciconfig ===<br />
<br />
Print name and basic information about all the Bluetooth devices installed in the system:<br />
$ hciconfig<br />
<br />
To activate a device, use:<br />
# hciconfig <device-name> up<br />
<br />
=== hcitool ===<br />
<br />
To scan for remote devices:<br />
$ hcitool scan<br />
<br />
== Pairing ==<br />
Many bluetooth devices require [http://en.wikipedia.org/wiki/Bluetooth#Pairing pairing].<br />
The exact procedure depends on the devices involved and their input functionality.<br />
<br />
=== with the current bluez (bluez5) ===<br />
<br />
Start the {{ic|bluetoothctl}} interactive command. There you can input {{ic|help}} to get a list of available commands. <br />
* Enter {{ic|devices}} to get the MAC Address of the device with which you want to pair.<br />
* Enter {{ic|pair <MAC Address>}} to do the pairing.<br />
* Finally, use {{ic|connect <MAC Address>}} to establish a connection.<br />
<br />
=== with bluez4 ===<br />
<br />
The procedure on a mobile may be as follows:<br />
* The computer sends a connect request to the mobile. <br />
* A pin, determined by the computer, is prompted for at the mobile<br />
* The same key must be re-entered at the computer.<br />
<br />
To pair with a device without using the gnome-bluez package, the ''bluez-simple-agent'' utility that comes with the bluez package can be used. This utility depends on three packages from [extra]:<br />
<br />
# pacman -S python2-dbus python2-gobject dbus-glib<br />
<br />
First, scan for external devices:<br />
$ hcitool scan<br />
<br />
Run the script as root:<br />
<br />
# bluez-simple-agent<br />
<br />
The message "Agent registered" should be returned, press control-c to quit. <br />
<br />
Below is a basic example of pairing with a specific device. The script will ask for the passcode, enter the code and confirm with enter.<br />
<br />
# bluez-simple-agent hci0 00:11:22:33:AA:BB<br />
<br />
{{note|bluez-simple-agent is only needed once for pairing a device, not every time you want to connect.}}<br />
<br />
See the Examples section below for pairing examples with various devices.<br />
<br />
== Using Obex for sending and receiving files ==<br />
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.<br />
<br />
To install;<br />
# pacman -S obexfs<br />
<br />
and then your phone can then be mounted by running <br />
$ obexfs -b <devices mac address> /mountpoint<br />
<br />
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs<br />
<br />
For devices don't support Obex FTP service, check if Obex Object Push is supported.<br />
<br />
# sdptool browse XX:XX:XX:XX:XX:XX<br />
<br />
Read the output, look for Obex Object Push, remember the channel for this service. If supported, you can use ussp-push to send files to this device:<br />
<br />
# ussp-push XX:XX:XX:XX:XX:XX@CHANNEL file wanted_file_name_on_phone<br />
<br />
== Examples ==<br />
<br />
=== Siemens S55 ===<br />
<br />
This is what I did to connect to my S55. (I have not figured out how to initiate the connection from the phone)<br />
* The steps under installation<br />
* <br />
$> hcitool scan<br />
Scanning ...<br />
XX:XX:XX:XX:XX:XX NAME<br />
$> B=XX:XX:XX:XX:XX:XX<br />
Start the simple-agent in a second terminal<br />
$> su -c bluez-simple-agent <br />
Password: <br />
Agent registered<br />
Back to the first console <br />
$> obexftp -b $B -l "Address book"<br />
# Phone ask for pin, I enter it and answer yes when asked if I want to save the device<br />
...<br />
<file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" /><br />
...<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"<br />
Browsing 00:01:E3:6B:FF:D7 ...<br />
Channel: 5<br />
Connecting...done<br />
Receiving "Address book/5F07.adr"... Sending "Address book"... done<br />
Disconnecting...done<br />
$> obexftp -b 00:01:E3:6B:FF:D7 -p a <br />
...<br />
Sending "a"... done<br />
Disconnecting...done<br />
<br />
=== Logitech Mouse MX Laser / M555b ===<br />
<br />
To quickly test the connection:<br />
<br />
$> hidd --connect XX:XX:XX:XX:XX:XX<br />
<br />
For automated reconnection, use your desktop wizard to configure the bluetooth mouse.<br />
If your desktop environment doesn't includes support for this task, see the [[Bluetooth mouse manual configuration]] guide.<br />
<br />
=== Motorola V900 ===<br />
<br />
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:<br />
<br />
cd ~/<br />
mkdir bluetooth-temp<br />
obexfs -n xx:yy:zz:... ~/bluetooth-temp<br />
cd ~/bluetooth-temp<br />
<br />
and browse... Only audio, video, and pictures are available when you do this.<br />
<br />
=== Motorola RAZ ===<br />
<br />
> pacman -S obextool obexfs obexftp openobex bluez<br />
<br />
> lsusb<br />
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
> hciconfig hci0 up<br />
<br />
> hciconfig<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
> hcitool dev<br />
Devices:<br />
hci0 00:16:41:97:BA:5E<br />
<br />
'''Attention: make sure that bluetooth on your phone is enabled and your phone is visible! <br />
'''<br />
<br />
> hcitool scan<br />
Scanning ...<br />
00:1A:1B:82:9B:6D [quirxi]<br />
<br />
> hcitool inq<br />
Inquiring ...<br />
00:1A:1B:82:9B:6D clock offset: 0x1ee4 class: 0x522204<br />
<br />
> l2ping 00:1A:1B:82:9B:6D<br />
Ping: 00:1A:1B:82:9B:6D from 00:16:41:97:BA:5E (data size 44) ...<br />
44 bytes from 00:1A:1B:82:9B:6D id 0 time 23.94ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 1 time 18.85ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 2 time 30.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 3 time 18.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 4 time 17.88ms<br />
44 bytes from 00:1A:1B:82:9B:6D id 5 time 17.88ms<br />
6 sent, 6 received, 0% loss<br />
<br />
> hcitool name 00:1A:1B:82:9B:6D<br />
[quirxi]<br />
<br />
# hciconfig -a hci0<br />
hci0: Type: BR/EDR Bus: USB<br />
BD Address: 00:16:41:97:BA:5E ACL MTU: 1017:8 SCO MTU: 64:8<br />
UP RUNNING<br />
RX bytes:9740 acl:122 sco:0 events:170 errors:0<br />
TX bytes:2920 acl:125 sco:0 commands:53 errors:0<br />
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3<br />
Link policy:<br />
Link mode: SLAVE ACCEPT<br />
Name: 'BCM2045'<br />
Class: 0x000000<br />
Service Classes: Unspecified<br />
Device Class: Miscellaneous,<br />
HCI Version: 2.0 (0x3) Revision: 0x204a<br />
LMP Version: 2.0 (0x3) Subversion: 0x4176<br />
Manufacturer: Broadcoml / Corporation (15)<br />
<br />
> hcitool info 00:1A:1B:82:9B:6D<br />
Requesting information ...<br />
BD Address: 00:1A:1B:82:9B:6D<br />
Device Name: [quirxi]<br />
LMP Version: 1.2 (0x2) LMP Subversion: 0x309<br />
Manufacturer: Broadcom Corporation (15)<br />
Features: 0xff 0xfe 0x0d 0x00 0x08 0x08 0x00 0x00<br />
<3-slot packets> <5-slot packets> <encryption> <slot offset><br />
<timing accuracy> <role switch> <hold mode> <sniff mode><br />
<RSSI> <channel quality> <SCO link> <HV2 packets><br />
<HV3 packets> <A-law log> <CVSD> <power control><br />
<transparent SCO> <AFH cap. slave> <AFH cap. master><br />
<br />
'''Edit your main.conf and enter the proper class for your phone ( Class = 0x100100 ):'''<br />
> vim /etc/bluetooth/main.conf<br />
<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100<br />
Class = 0x100100<br />
<br />
> /etc/rc.d/dbus start<br />
:: Starting D-BUS system messagebus <br />
[DONE]<br />
<br />
> /etc/rc.d/bluetooth start<br />
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd<br />
[DONE]<br />
:: Starting bluetooth subsystem: bluetoothd<br />
<br />
'''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 !!'''<br />
> /usr/bin/bluez-simple-agent hci0 00:1A:1B:82:9B:6D<br />
RequestPinCode (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
Enter PIN Code: 0000<br />
Release<br />
New device (/org/bluez/10768/hci0/dev_00_1A_1B_82_9B_6D)<br />
<br />
'''Now you can browse the filesystem of your phone with obexftp:'''<br />
> obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l<br />
Connecting..\done<br />
Tried to connect for 448ms<br />
Receiving "(null)"...-<?xml version="1.0" ?><br />
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd"><br />
<folder-listing><br />
<parent-folder /><br />
<folder name="audio" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="video" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
<folder name="picture" size="0" type="folder" modified="20101010T132323Z" user-perm="RW" /><br />
</folder-listing><br />
done<br />
Disconnecting..\done<br />
<br />
'''Or you can mount your phone into a directory on your computer and treat it like a normal file system:'''<br />
<br />
> groupadd bluetooth<br />
> mkdir /mnt/bluetooth<br />
> chown root:bluetooth /mnt/bluetooth<br />
> chmod 775 /mnt/bluetooth<br />
> usermod -a -G bluetooth arno<br />
<br />
> obexfs -b 00:1A:1B:82:9B:6D /mnt/bluetooth/<br />
> l /mnt/bluetooth/<br />
total 6<br />
drwxr-xr-x 1 root root 0 10. Okt 13:25 .<br />
drwxr-xr-x 5 root root 4096 10. Okt 10:08 ..<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 audio<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 picture<br />
drwxr-xr-x 1 root root 0 10. Okt 2010 video<br />
<br />
=== Pairing with an iPhone using bluez-simple-agent ===<br />
<br />
Assuming a bluetooth device called hci0 and an iPhone that showed up in a hcitool scan as '00:00:DE:AD:BE:EF':<br />
<br />
# bluez-simple-agent hci0 00:00:DE:AD:BE:EF<br />
Passcode:<br />
<br />
=== Headset and Alsa Devices ===<br />
==== by referencing the bluetooth device in asound.conf ====<br />
1. First if you have not already, install bluez<br />
# pacman -S bluez<br />
2. Scan for your device<br />
$ hcitool (-i <optional hci#>***) scan<br />
3. Pair your headset with your device<br />
$ bluez-simple-agent (optional hci# ***) XX:XX:XX:XX:XX:XX<br />
and put in your pin (0000 or 1234, etc)<br />
4. Add this to your/etc/asound.conf file<br />
#/etc/asound.conf<br />
<br />
pcm.btheadset {<br />
type plug<br />
slave {<br />
pcm {<br />
type bluetooth<br />
device XX:XX:XX:XX:XX:XX <br />
profile "auto"<br />
} <br />
} <br />
hint {<br />
show on<br />
description "BT Headset"<br />
} <br />
}<br />
ctl.btheadset {<br />
type bluetooth<br />
} <br />
<br />
5. Check to see if it has been added to alsa devices<br />
$ aplay -L<br />
<br />
6. Now play with aplay:<br />
$ aplay -D btheadset /path/to/audio/file<br />
<br />
or Mplayer:<br />
$ mplayer -ao alsa:device=btheadset /path/to/audio/or/video/file<br />
<br />
*** To find hci# for a usb dongle, type in <br />
$ hcitool dev<br />
<br />
==== by using bluez-tools from the AUR ====<br />
You can use {{aur|bluez-tools}} from the [[AUR]] with pulseaudio to stream audio to a bluetooth headset. <br />
Find the MAC of the headset:<br />
$ hcitool scan<br />
Connect to the headset:<br />
$ bt-audio -c XX:XX:XX:XX:XX:XX<br />
Open pulseaudio volume control:<br />
$ pavucontrol<br />
The headset should show up in the Configuration tab.<br />
<br />
=== Microsoft Bluetooth Mobile Keyboard 6000 ===<br />
<br />
1. Scan for your device<br />
$ hcitool (-i <optional hci#>***) scan<br />
Scanning ...<br />
00:11:22:33:44:55 Microsoft Bluetooth Mobile Keyboard 6000<br />
<br />
<br />
2. On second console run as root (do not terminate):<br />
# bluez-simple-agent<br />
Agent registered<br />
<br />
3. Back on first console run:<br />
$ bluez-simple-agent hci0 00:11:22:33:44:55<br />
Enter PIN Code: 1234<br />
(now enter that pin on the keyboard and press enter)<br />
Release<br />
New device (/org/bluez/5373/hci0/dev_00_11_22_33_44_55)<br />
<br />
4.<br />
$ bluez-test-device trusted 00:11:22:33:44:55<br />
<br />
5.<br />
$ bluez-test-input connect 00:11:22:33:44:55<br />
<br />
No your keyboard should work. You can terminate bluez-simple-agent on second console with Ctrl-C<br />
<br />
== Troubleshooting ==<br />
<br />
=== Segfaults in Bluez 4.95 ===<br />
If bluetoothd stops working after enabling or disabling your bluetooth device via rfkill or gnome-bluetooth applet, look at your dmesg output. If it looks like:<br />
<br />
bluetoothd[2330]: segfault at 1 ip 00007fcef2327b75 sp 00007fff9f769cb0 error 4 in libglib-2.0.so.0.2800.8[7fcef22ca000+e9000]<br />
<br />
then you should consider downgrading to 4.94 (just grab the PKGBUILD/etc from arch and change version to 4.94 and correct the md5sum for bluez) or wait for an update of bluez. [https://bugs.archlinux.org/task/25088?project=1&openedfrom=-1+week Here] is a (arch) bug report about it.<br />
<br />
=== passkey-agent ===<br />
$> passkey-agent --default 1234<br />
Can't register passkey agent<br />
The name org.bluez was not provided by any .service files<br />
You probably started {{ic|/etc/rc.d/bluetooth}} before {{ic|/etc/rc.d/dbus}}<br />
$> hciconfig dev<br />
# (no listing)<br />
Try running {{ic|hciconfig hc0 up}}<br />
<br />
=== Blueman ===<br />
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).<br />
# rm -rf /var/lib/bluetooth<br />
# reboot<br />
<br />
If you see a notification saying '''Incoming file over Bluetooth''' then this means that the device isn't marked as trusted. Mark it as trusted and try again (looking at the code, it looks like some buttons should be displayed in the notification, but I don't see them).<br />
<br />
=== gnome-bluetooth ===<br />
If you see this when trying to enable receiving files in bluetooth-properties:<br />
Bluetooth OBEX start failed: Invalid path<br />
Bluetooth FTP start failed: Invalid path<br />
Then run:<br />
# pacman -S xdg-user-dirs<br />
$ xdg-user-dirs-update<br />
You can edit the paths using:<br />
$ vi ~/.config/user-dirs.dirs<br />
<br />
=== Bluetooth USB Dongle ===<br />
If you are using a USB dongle, you should check that your Bluetooth dongle is recognized. You can do that by inspecting {{ic|/var/log/messages.log}} when plugging in the USB dongle (or running {{ic|journalctl -f}} with systemd). It should look something like the following (look out for hci):<br />
<br />
# tail -f /var/log/messages.log<br />
Feb 20 15:00:24 hostname kernel: [ 2661.349823] usb 4-1: new full-speed USB device number 3 using uhci_hcd<br />
Feb 20 15:00:24 hostname bluetoothd[4568]: HCI dev 0 registered<br />
Feb 20 15:00:24 hostname bluetoothd[4568]: Listening for HCI events on hci0<br />
Feb 20 15:00:25 hostname bluetoothd[4568]: HCI dev 0 up<br />
Feb 20 15:00:25 hostname bluetoothd[4568]: Adapter /org/bluez/4568/hci0 has been enabled<br />
<br />
For a list of supported hardware please refer to the [[Bluetooth#Resources|resources]] section on this page.<br />
<br />
If you only get the first two lines, you may see that it found the device but you need to bring it up.<br />
Example:<br />
<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0<br />
DOWN <br />
RX bytes:0 acl:0 sco:0 events:0 errors:0<br />
TX bytes:0 acl:0 sco:0 commands:0 errors:<br />
sudo hciconfig hci0 up<br />
hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8<br />
UP RUNNING <br />
RX bytes:348 acl:0 sco:0 events:11 errors:0<br />
TX bytes:38 acl:0 sco:0 commands:11 errors:0<br />
<br />
If this fails with an error like:<br />
Operation not possible due to RF-kill<br />
it could be due either to the {{ic|rfkill}} utility, in which case it should be resolved with<br />
# rfkill unblock all<br />
or, it could simply be the hardware switch of the computer. The hardware bluetooth switch (at least sometimes) controls access to USB bluetooth dongles also. Flip/press this switch and try bringing the device up again.<br />
<br />
To verify that the device was detected you can use {{ic|hcitool}} which is part of the {{ic|bluez-utils}}. You can get a list of available devices and their identifiers and their MAC address by issuing:<br />
<br />
$ hcitool dev<br />
Devices:<br />
hci0 00:1B:DC:0F:DB:40<br />
<br />
More detailed informations about the device can be retrieved by using {{ic|hciconfig}}.<br />
<br />
$ hciconfig -a hci0<br />
hci0: Type: USB<br />
BD Address: 00:1B:DC:0F:DB:40 ACL MTU: 310:10 SCO MTU: 64:8<br />
UP RUNNING PSCAN ISCAN <br />
RX bytes:1226 acl:0 sco:0 events:27 errors:0<br />
TX bytes:351 acl:0 sco:0 commands:26 errors:0<br />
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80<br />
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 <br />
Link policy: RSWITCH HOLD SNIFF PARK <br />
Link mode: SLAVE ACCEPT <br />
Name: 'BlueZ (0)'<br />
Class: 0x000100<br />
Service Classes: Unspecified<br />
Device Class: Computer, Uncategorized<br />
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c<br />
Manufacturer: Cambridge Silicon Radio (10)<br />
<br />
=== Logitech Bluetooth USB Dongle ===<br />
There are Logitech dongles (ex. Logitech MX5000) that can work in two modes Embedded and HCI. In embedded mode dongle emulates a USB device so it seems to your PC that your using a normal USB mouse/keyoard.<br />
<br />
If you hold the little red Button on the USB BT mini-receiver it will enable the other mode. Hold the red button on the BT dongle and plug it into the computer, and after 3-5 seconds of holding the button, the Bluetooth icon will appear in the system tray. [http://ubuntuforums.org/showthread.php?t=1332197 Discussion]<br />
<br />
=== hcitool scan: Device not found ===<br />
* On some Dell laptops (e.g. Studio 15) you have to switch the Bluetooth mode from HID to HCI using<br />
# hid2hci<br />
<br />
{{Note|hid2hci is no longer in the $PATH, it is under /lib/udev/hid2hci, but udev should run it automatically for you.}}<br />
<br />
* If the device won't show up and you have a Windows operating system on your machine, try booting it and enable the bluetooth adapter from windows.<br />
<br />
* Sometimes also this simple command helps:<br />
# hciconfig hci0 up<br />
<br />
=== rfkill unblock: Do not unblock ===<br />
You cant unblock youre device and use connman try:<br />
$ connmanctl enable bluetooth<br />
<br />
=== My computer isn't visible ===<br />
Can't discover computer from your phone? Enable PSCAN and ISCAN:<br />
# enable PSCAN and ISCAN<br />
$ hciconfig hci0 piscan <br />
# check it worked<br />
$ hciconfig <br />
hci0: Type: USB<br />
BD Address: 00:12:34:56:78:9A ACL MTU: 192:8 SCO MTU: 64:8<br />
'''UP RUNNING PSCAN ISCAN'''<br />
RX bytes:20425 acl:115 sco:0 events:526 errors:0<br />
TX bytes:5543 acl:84 sco:0 commands:340 errors:0<br />
<br />
{{Note | Check DiscoverableTimeout and PairableTimeout in /etc/bluetooth/main.conf}}<br />
<br />
Try changing device class in /etc/bluetooth/main.conf as following<br />
# Default device class. Only the major and minor device class bits are<br />
# considered.<br />
#Class = 0x000100 (from default config)<br />
Class = 0x100100<br />
<br />
This was the only solution to make my computer visible for my phone. <br />
<br />
=== Nautilus cannot browse files ===<br />
If nautilus doesn't open and show this error:<br />
Nautilus cannot handle obex: locations. Couldn't display "obex://[XX:XX:XX:XX:XX:XX]/".<br />
Install gvfs-obexftp package:<br />
# pacman -S gvfs-obexftp<br />
<br />
=== Bluetooth is disabled when starting GNOME ===<br />
If you have {{ic|dbus}} and {{ic|bluetooth}} backgrounded (@) in your {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, it might happen that {{ic|bluetooth}} will be disabled when starting up GNOME. To solve this, make sure {{ic|dbus}} is not backgrounded.<br />
<br />
=== Sennheiser MM400 Headset connection problems ===<br />
If your {{ic|Sennheiser MM400 Headset}} immediately disconnects after connecting as {{ic|Headset Service}} with Blueman, try to connect it as {{ic|Audio Sink}}. Afterwards you can change the headset's {{ic|Audio Profile}} to {{ic|Telephony Duplex}} with a right click in Blueman.<br />
With this option headset functionality will be available although the headset was only connected as {{ic|Audio Sink}} in first place and no disconnection will happen (tested with bluez 4.96-3, pulseaudio 1.1-1 and blueman 1.23-2).<br />
<br />
=== My device is paired but no sound is played from it ===<br />
Try to first inspect '''/var/log/messages.log'''<br />
{{bc|# tail /var/log/messages.log<br />
Jan 12 20:08:58 localhost pulseaudio[1584]: [pulseaudio] module-bluetooth-device.c: Service not connected<br />
Jan 12 20:08:58 localhost pulseaudio[1584]: [pulseaudio] module-bluetooth-device.c: Bluetooth audio service not available}}<br />
<br />
If you see such messages, try first:<br />
{{bc|# pactl load-module module-bluetooth-device}}<br />
<br />
If the module fails to work, do this workaround:<br />
Open '''/etc/bluetooth/audio.conf''' and add after '''[General]''' (on a new line)<br />
{{bc|Enable&#61;Socket}}<br />
Then restart the bluetooth daemon with {{ic|/etc/rc.d/bluetooth restart}}.<br />
Pair again your device, and you should find it in the pulseaudio settings (advanced settings for the sound)<br />
<br />
[http://wiki.gentoo.org/index.php?title=Bluetooth_Headset&redirect=no More information on Gentoo Wiki]<br />
<br />
If after fixing this you still can't get sound, try using blueman (this is the only one that works for me), make sure that notify-osd is installed or it might show you weird error messages like this one: "Stream setup failed"<br />
<br />
fail (/usr/lib/python2.7/site-packages/blueman/gui/manager/ManagerDeviceMenu.py:134)<br />
fail (DBusException(dbus.String(u'Stream setup failed'),),)<br />
<br />
== See also ==<br />
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo Linux Bluetooth Guide]<br />
*[http://en.opensuse.org/HCL:Bluetooth openSUSE Bluetooth Hardware Compatibility List]<br />
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone (Linux Gazette)]<br />
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]<br />
*[http://www.elstel.org/MobilePhone.html Bluetooth for Your Mobile Phone: Bluetooth Pairing, Data Synchronization, Photo Download, Internet Dial-Up (Tethering)]<br />
*[http://www.elstel.org/MobilePhone.html Bluetooth Pairing and Applications for Synchronizing Phone Numbers, SMS-messages, Phone Call Entries, your Calendar and Time; Tethering]</div>Wfx