Difference between revisions of "Bluetooth"

From ArchWiki
Jump to: navigation, search
(Installation: dbus is started by systemd.)
m (DualBoot with Windows: link to discussion)
 
(207 intermediate revisions by 85 users not shown)
Line 5: Line 5:
 
[[fr:Bluetooth]]
 
[[fr:Bluetooth]]
 
[[it:Bluetooth]]
 
[[it:Bluetooth]]
 +
[[ja:Bluetooth]]
 
[[ru:Bluetooth]]
 
[[ru:Bluetooth]]
[[zh-CN:Bluetooth]]
+
[[zh-hans:Bluetooth]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|Covers the installation and use of Bluetooth on Arch Linux.}}
+
{{Related|Bluez4}}
{{Article summary heading|Related}}
+
{{Related|Bluetooth mouse}}
{{Article summary wiki|Bluetooth mouse configuration}}
+
{{Related|Bluetooth headset}}
{{Article summary end}}
+
{{Related|Blueman}}
 
+
{{Related articles end}}
 
[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].
 
[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].
  
 
== Installation ==
 
== Installation ==
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.
 
  
Start the bluetooth service:
+
[[Install]] the {{Pkg|bluez}} and {{Pkg|bluez-utils}} packages. The {{Pkg|bluez}} package provides the Bluetooth protocol stack, and the {{Pkg|bluez-utils}} package provides the {{ic|bluetoothctl}} utility.
  # systemctl start bluetooth.service
+
 
 +
Load the generic bluetooth driver, if not already loaded:
 +
  # modprobe btusb
 +
 
 +
Then [[start]] the {{ic|bluetooth.service}} systemd unit. You can [[enable]] it to start automatically at boot time.
 +
 
 +
{{Note|
 +
* By default the bluetooth daemon will only give out bnep0 devices to users that are a member of the {{ic|lp}} group. Make sure to add your user to that group if you intend to connect to a bluetooth tether. You can change the group that is required in the file {{ic|/etc/dbus-1/system.d/bluetooth.conf}}.
 +
* Some Bluetooth adapters are bundled with a Wi-Fi card (e.g. [http://www.intel.com/content/www/us/en/wireless-products/centrino-advanced-n-6235.html Intel Centrino]). These require that the Wi-Fi card is firstly enabled (typically a keyboard shortcut on a laptop) in order to make the Bluetooth adapter visible to the kernel.
 +
* Some Bluetooth cards (e.g. Broadcom) conflict with the network adapter. Thus, you need to make sure that your Bluetooth device get connected before the network service boot.
 +
* Some tools such as hcitool and hciconfig have been deprecated upstream, and are no longer included in {{Pkg|bluez-utils}}. Since these tools will no longer be updated, it is recommended that scripts be updated to avoid using them. If you still desire to use them, install {{AUR|bluez-utils-compat}}. See {{Bug|53110}} and [https://www.spinics.net/lists/linux-bluetooth/msg69239.html the Bluez mailing list] for more information. }}
 +
 
 +
== Configuration via the CLI ==
 +
=== Bluetoothctl ===
 +
Pairing a device from the shell is one of the simplest and most reliable options.  The exact procedure depends on the devices involved and their input functionality.  What follows is a general outline of pairing a device using {{ic|/usr/bin/bluetoothctl}}:
 +
 
 +
Start the {{ic|bluetoothctl}} interactive command. There one can input {{ic|help}} to get a list of available commands.
 +
* Possibly select a default controller by inputting {{ic|select ''MAC Address''}}
 +
* Turn the power to the controller on by entering {{ic|power on}}. It is off by default.
 +
* Enter {{ic|devices}} to get the MAC Address of the device with which to pair.
 +
* Enter device discovery mode with {{ic|scan on}} command if device is not yet on the list.
 +
* Turn the agent on with {{ic|agent on}}.
 +
* Enter {{ic|pair ''MAC Address''}} to do the pairing (tab completion works).
 +
* If using a device without a PIN, one may need to manually trust the device before it can reconnect successfully. Enter {{ic|trust ''MAC Address''}} to do so.
 +
* Finally, use {{ic|connect ''MAC_address''}} to establish a connection.
 +
 
 +
An example session may look this way:
 +
# bluetoothctl
 +
[NEW] Controller 00:10:20:30:40:50 pi [default]
 +
[bluetooth]# agent KeyboardOnly
 +
Agent registered
 +
[bluetooth]# default-agent
 +
Default agent request successful
 +
[bluetooth]# scan on
 +
Discovery started
 +
[CHG] Controller 00:10:20:30:40:50 Discovering: yes
 +
[NEW] Device 00:12:34:56:78:90 myLino
 +
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes
 +
[bluetooth]# pair 00:12:34:56:78:90
 +
Attempting to pair with 00:12:34:56:78:90
 +
[CHG] Device 00:12:34:56:78:90 Connected: yes
 +
[CHG] Device 00:12:34:56:78:90 Connected: no
 +
[CHG] Device 00:12:34:56:78:90 Connected: yes
 +
Request PIN code
 +
[agent] Enter PIN code: 1234
 +
[CHG] Device 00:12:34:56:78:90 Paired: yes
 +
Pairing successful
 +
[CHG] Device 00:12:34:56:78:90 Connected: no
 +
[bluetooth]# connect 00:12:34:56:78:90
 +
Attempting to connect to 00:12:34:56:78:90
 +
[CHG] Device 00:12:34:56:78:90 Connected: yes
 +
Connection successful
 +
 
 +
====Auto power-on after boot====
 +
By default, your Bluetooth adapter will not power on after a reboot. The former method by using {{ic|hciconfig hci0 up}} is deprecated, see the [http://www.bluez.org/release-of-bluez-5-35/ release note]. Now you just need to add the line {{ic|1=AutoEnable=true}} in {{ic|/etc/bluetooth/main.conf}} at the bottom in the {{ic|[Policy]}} section:
 +
{{hc|1=/etc/bluetooth/main.conf|2=
 +
[Policy]
 +
AutoEnable=true
 +
}}
  
Enable the bluetooth service at system boot up:
+
====Deprecated method using hciconfig====
# systemctl enable bluetooth.service
+
In order to have the device active after a reboot, a udev rule is needed:
  
== Graphical front-ends ==
+
{{hc|/etc/udev/rules.d/10-local.rules|2=
 +
# Set bluetooth power up
 +
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig %k up"}}
  
The following packages allow for a graphical interface to customize Bluetooth.
+
{{Tip|Replace {{ic|1=KERNEL=="hci0"}} with {{ic|1=KERNEL=="hci[0-9]*"}} to match all interfaces.}}
  
=== Blueman ===
+
After a suspend/resume-cycle, the device can be powered on automatically using a custom ''systemd'' service:
  
[http://blueman-project.org Blueman] is a full featured Bluetooth manager written in [[GTK+]] and, as such, is recommended for [[GNOME]] or [[Xfce]]. You can install Blueman with the package {{Pkg|blueman}}, available in the [[Official Repositories]].
+
{{hc|/etc/systemd/system/bluetooth-auto-power@.service|<nowiki>
 +
[Unit]
 +
Description=Bluetooth auto power on
 +
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target
  
Be sure that {{ic|bluetooth}} daemon is running as described above (added to rc.conf after dbus), and execute {{ic|blueman-applet}}. To make the applet run on login add {{ic|blueman-applet}} either under ''System -> Preferences -> Startup Applications'' (GNOME) or ''Xfce Menu -> Settings -> Session and Startup'' (Xfce).
+
[Service]
 +
Type=oneshot
 +
ExecStart=/usr/bin/hciconfig %i up
  
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.
+
[Install]
 +
WantedBy=suspend.target
 +
</nowiki>}}
  
{{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.}}
+
[[Enable]] an instance of the unit using your bluetooth device name, for example {{ic|bluetooth-auto-power@hci0.service}}.
  
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".
+
== Configuration with a graphical front-end ==
  
==== Script for Thunar ====
+
The following packages allow for a graphical interface to customize Bluetooth.
If you are not using Nautilus (for example Thunar) you may find the following script useful:
 
{{hc|obex_thunar.sh|
 
#!/bin/bash
 
fusermount -u ~/bluetooth
 
obexfs -b $1 ~/bluetooth
 
thunar ~/bluetooth
 
}}
 
Now you will need to move the script to an appropriate location (e.g., {{ic|/usr/bin}}). After that, mark it as executable:
 
{{bc|chmod +x /usr/bin/obex_thunar.sh}}
 
The last step is to change the line in ''Blueman tray icon -> Local Services -> Transfer -> Advanced'' to {{ic|obex_thunar.sh %d}}.
 
  
 
=== GNOME Bluetooth ===
 
=== GNOME Bluetooth ===
  
[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}}.
+
[https://wiki.gnome.org/Projects/GnomeBluetooth GNOME Bluetooth] is [[GNOME]]'s Bluetooth tool. The {{Pkg|gnome-bluetooth}} package provides the back-end, {{Pkg|gnome-shell}} provides the status monitor applet, and {{Pkg|gnome-control-center}} provides the configuration front-end GUI that can be accessed by typing Bluetooth on the Activities overview, or with the {{ic|gnome-control-center bluetooth}} command. You can also launch the {{ic|bluetooth-sendto}} command directly to send files to a remote device.
  
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''.
+
To receive files, you must install the {{Pkg|gnome-user-share}} package. You can then go to ''Settings -> Sharing'' to authorize receiving files from paired devices over Bluetooth.
  
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].
+
{{Tip|To add a Bluetooth entry to the ''Send To'' menu in Thunar's file properties menu, see instructions [http://docs.xfce.org/xfce/thunar/send-to here]. (The command that needs to be configured is {{ic|bluetooth-sendto %F}}).}}
  
=== BlueDevil ===
+
=== Bluedevil ===
  
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]].
+
[https://projects.kde.org/projects/kde/workspace/bluedevil Bluedevil] is [[KDE]]'s Bluetooth tool. It can be [[installed]] with the package {{Pkg|bluedevil}} (KDE Plasma 5).
  
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
+
If there is no Bluetooth icon visible in Dolphin and in the system tray, enable it in the system tray options or add a widget. You can configure Bluedevil and detect Bluetooth devices by clicking the icon. An interface is also available from the KDE System Settings.
  
=== Fluxbox, Openbox, other WM ===
+
=== Blueberry ===
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
+
''Blueberry'' is an alternative front-end for GNOME Bluetooth, which works in all desktop environments. It can be installed with the {{Pkg|blueberry}} package. It provides a configuration tool (''blueberry'') and a system tray applet (''blueberry-tray'').
  
{{ic|/etc/dbus-1/system.d/bluetooth.conf}}
+
=== Blueman ===
  <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
+
See [[Blueman]].
* 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
 
  
== Manual configuration ==
+
== Using Obex for sending and receiving files ==
 +
=== ObexFS ===
 +
Another option, rather than using KDE or Gnome Bluetooth packages, is ObexFS which allows for the mounting of phones which are treated like any other filesystem.
 +
{{Note|To use ObexFS, one needs a device that provides an ObexFTP service.}}
  
To configure BlueZ manually, you may need to edit the configuration files in {{ic|/etc/bluetooth}}. These are:
+
Install {{Pkg|obexfs}} and mount supported phones by running:
  audio.conf
+
  $ obexfs -b ''MAC_address_of_device'' /mountpoint
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 {{ic|main.conf}}.
+
Once you have finished, to unmount the device use the command:
 +
$ fusermount -u /mountpoint
  
=== Audio streaming ===
+
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs
If you would like to enable audio streaming from your device to your computer, you must modify {{ic|audio.conf}} and add this to the {{ic|[General]}} section:
 
  Enable=Socket
 
  
== Pairing ==
+
{{Note|Ensure that the bluetooth device you are mounting is '''not''' set to mount ''read-only''. You should be able to do this from the device's settings. If the device is mounted ''read-only'' you may encounter a permissions error when trying to transfer files to the device.}}
Many bluetooth devices require [http://en.wikipedia.org/wiki/Bluetooth#Pairing pairing].
 
The exact procedure depends on the devices involved and their input functionality.
 
  
The procedure on a mobile may be as follows:
+
=== ObexFTP transfers ===
* 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 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 two packages from [extra]:
+
If your device supports the Obex FTP service but you do not wish to mount the device you can transfer files to and from the device using the obexftp command.
  
# pacman -S python2-dbus python2-gobject
+
To send a file to a device run the command:
  
First, scan for external devices:
+
  $ obexftp -b ''MAC_address_of_device'' -p /path/to/file
  $ hcitool scan
 
  
Run the script as root:
+
To retrieve a file from a device run the command:
  
  # bluez-simple-agent
+
  $ obexftp -b ''MAC_address_of_device'' -g filename
  
The message "Agent registered" should be returned, press control-c to quit.  
+
{{Note|Ensure that the file you are retrieving is in the device's ''exchange folder''. If the file is in a subfolder of the exchange folder then provide the correct path in the command.}}
  
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.
+
=== Obex Object Push ===
 +
For devices that do not support Obex FTP service, check if Obex Object Push is supported.
  
  # bluez-simple-agent hci0 00:11:22:33:AA:BB
+
  # sdptool browse ''XX:XX:XX:XX:XX:XX''
  
{{note|bluez-simple-agent is only needed once for pairing a device, not every time you want to connect.}}
+
Read the output, look for Obex Object Push, remember the channel for this service.  If supported, one can use {{pkg|ussp-push}} to send files to this device:
  
See the Examples section below for pairing examples with various devices.
+
# ussp-push ''XX:XX:XX:XX:XX:XX''@''CHANNEL'' ''file'' ''wanted_file_name_on_phone''
  
== Using Obex for sending and receiving files ==
+
=== Using your computer's speakers as a bluetooth headset ===
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.
 
  
To install;
+
This can allow you to do things such as playing what is on your phone through your computer speakers.
# pacman -S obexfs
 
  
and then your phone can then be mounted running as root
+
Add the following to the file {{ic|/etc/bluetooth/audio.conf}} (create it if not present):
# obexfs -b <devices mac address> /mountpoint
 
  
For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs
+
[General]
 +
Enable=Source
  
For devices don't support Obex FTP service, check if Obex Object Push is supported.
+
More info in:
 +
* [[Bluetooth headset]]
 +
* https://gist.github.com/joergschiller/1673341
 +
* http://www.lightofdawn.org/blog/?viewDetailed=00031
  
# sdptool browse XX:XX:XX:XX:XX:XX
+
== Audio ==
  
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:
+
In order to be able to use audio equipment like bluetooth headphones, you need to install the additional {{Pkg|pulseaudio-bluetooth}} package.
  
# ussp-push XX:XX:XX:XX:XX:XX@CHANNEL file wanted_file_name_on_phone
+
Please have a look at the [[Bluetooth headset]] page for more information about bluetooth audio and bluetooth headsets.
  
== Examples ==
+
In order to enable your system to be detected as an A2DP sink (e.g. to play music from your phone via your computer speakers), add {{ic|1=Enable=Source,Sink,Media,Socket}} under {{ic|[General]}} in {{ic|/etc/bluetooth/audio.conf}}.
  
=== Siemens S55 ===
+
== Troubleshooting ==
  
This is what I did to connect to my S55. (I have not figured out how to initiate the connection from the phone)
+
=== Shell command _____ is missing from bluez-utils ===
* The steps under installation
+
Some tools have been marked as deprecated and removed from the package. At this time they are still available in the AUR package {{AUR|bluez-utils-compat}}. Their functionality is partially covered by new tools, while some things have yet to be implemented with the new [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/ D-Bus API]:
+
{| class="wikitable" style="max-width: 50em;"
  $> hcitool scan
+
|-
  Scanning ...
+
! Deprecated tool
          XX:XX:XX:XX:XX:XX  NAME
+
! Most likely replacement
  $> B=XX:XX:XX:XX:XX:XX
+
|-
Start the simple-agent in a second terminal
+
| gatttool || btgatt-client, [D-Bus Gatt API https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt]
  $> su -c bluez-simple-agent
+
|-
  Password:
+
| hciattach || btattach
  Agent registered
+
|-
Back to the first console 
+
| hciconfig || btmgmt (and bluetoothctl?)
  $> 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
+
| hcidump || btmon (and btsnoop)
  ...
+
|-
  <file name="5F07.adr" size="78712" modified="20030101T001858" user-perm="WD" group-perm="" />
+
| hcitool || missing, [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/device-api.txt D-Bus Device API] available
  ...
+
|-
  $> obexftp -b 00:01:E3:6B:FF:D7 -g "Address book/5F07.adr"
+
| rfcomm
  Browsing 00:01:E3:6B:FF:D7 ...
+
| rowspan="2" | missing, implement with [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/profile-api.txt D-Bus Profile1 API]?
  Channel: 5
+
|-
  Connecting...done
+
| ciptool
  Receiving "Address book/5F07.adr"... Sending "Address book"... done
+
|-
  Disconnecting...done
+
| style="vertical-align: top;" | sdptool
  $> obexftp -b 00:01:E3:6B:FF:D7 -p a                     
+
| missing, functionality seems to be scattered over different D-Bus objects: [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/profile-api.txt Profile], [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/advertising-api.txt Advertising], and the UUIDs arrays in [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/device-api.txt device] and [https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/adapter-api.txt adapter].  
  ...
+
|}
  Sending "a"... done
 
  Disconnecting...done
 
  
=== Logitech Mouse MX Laser / M555b ===
+
=== bluetoothctl ===
 +
If bluetoothctl cannot find any controller, the bluetooth device may be blocked. Try to unblock it using {{Pkg|rfkill}}:
  
To quickly test the connection:
+
# rfkill unblock bluetooth
  
$> hidd --connect XX:XX:XX:XX:XX:XX
+
=== gnome-bluetooth ===
  
For automated reconnection, use your desktop wizard to configure the bluetooth mouse.
+
If you see this when trying to enable receiving files in bluetooth-properties:
If your desktop environment doesn't includes support for this task, see the [[Bluetooth mouse manual configuration]] guide.
+
Bluetooth OBEX start failed: Invalid path
 +
Bluetooth FTP start failed: Invalid path
 +
Then install {{Pkg|xdg-user-dirs}} and issue:
 +
$ xdg-user-dirs-update
 +
You can edit the paths using:
 +
$ vi ~/.config/user-dirs.dirs
  
=== Motorola V900 ===
+
=== Bluetooth USB Dongle ===
  
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:
+
If you are using a USB dongle, you should check that your Bluetooth dongle is recognized. You can do that by running {{ic|journalctl -f}} when you have plugged in the USB dongle (or inspecting {{ic|/var/log/messages.log}}). It should look something like the following (look out for hci):
  
  cd ~/
+
{{bc|
  mkdir bluetooth-temp
+
Feb 20 15:00:24 hostname kernel: [ 2661.349823] usb 4-1: new full-speed USB device number 3 using uhci_hcd
  obexfs -n xx:yy:zz:... ~/bluetooth-temp
+
Feb 20 15:00:24 hostname bluetoothd[4568]: HCI dev 0 registered
  cd ~/bluetooth-temp
+
Feb 20 15:00:24 hostname bluetoothd[4568]: Listening for HCI events on hci0
 +
Feb 20 15:00:25 hostname bluetoothd[4568]: HCI dev 0 up
 +
Feb 20 15:00:25 hostname bluetoothd[4568]: Adapter /org/bluez/4568/hci0 has been enabled
 +
}}
  
and browse... Only audio, video, and pictures are available when you do this.
+
If you only get the first two lines, you may see that it found the device but you need to bring it up.
 +
Example:
  
=== Motorola RAZ ===
+
{{hc|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:
 +
}}
  
  > pacman -S obextool obexfs obexftp openobex bluez
+
  # hciconfig hci0 up
  
> lsusb
+
{{hc|hciconfig -a hci0|
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
hci0: Type: USB
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
BD Address: 00:02:72:C4:7C:06 ACL MTU: 377:10 SCO MTU: 64:8
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
UP RUNNING
Bus 002 Device 002: ID 03f0:171d Hewlett-Packard Wireless (Bluetooth + WLAN) Interface [Integrated Module]
+
RX bytes:348 acl:0 sco:0 events:11 errors:0
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
+
        TX bytes:38 acl:0 sco:0 commands:11 errors:0
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
+
}}
  
  > hciconfig hci0 up
+
If this fails with an error like:
 +
  Operation not possible due to RF-kill
 +
it could be due either to the {{ic|rfkill}} utility, in which case it should be resolved with
 +
# rfkill unblock all
 +
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.
  
> hciconfig
+
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:
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
+
{{hc|$ hcitool dev|
Devices:
+
Devices:
        hci0   00:16:41:97:BA:5E
+
        hci0 00:1B:DC:0F:DB:40
 +
}}
  
'''Attention: make sure that bluetooth on your phone is enabled and your phone is visible!
+
More detailed information about the device can be retrieved by using {{ic|hciconfig}}.
'''
 
  
> hcitool scan
+
{{hc|$ hciconfig -a hci0|
Scanning ...
+
hci0:  Type: USB
        00:1A:1B:82:9B:6D      [quirxi]
+
        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 inq
+
==== Audio devices start to skip at short distance from dongle ====
Inquiring ...
 
        00:1A:1B:82:9B:6D      clock offset: 0x1ee4    class: 0x522204
 
  
> l2ping 00:1A:1B:82:9B:6D
+
If other devices share the same USB host, they can [https://bbs.archlinux.org/viewtopic.php?pid=1440161#p1440161 interrupt communication with audio devices]. Make sure it is the only device attached to its bus. For example:
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
+
{{hc|$ lsusb|
[quirxi]
+
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
 +
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 +
Bus 001 Device 004: ID 048d:1345 Integrated Technology Express, Inc. Multi Cardreader
 +
Bus 001 Device 003: ID 0424:a700 Standard Microsystems Corp. 2 Port Hub
 +
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 +
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 +
}}
  
# hciconfig -a hci0
+
=== Logitech Bluetooth USB Dongle ===
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
+
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 you are using a normal USB mouse/keyoard.
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 ):'''
+
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]
> vim /etc/bluetooth/main.conf
 
  
  # Default device class. Only the major and minor device class bits are
+
Alternatively, you can install the {{Pkg|bluez-hid2hci}} package. When you connect your Logitech dongle it will automatically switch.
  # considered.
 
  #Class = 0x000100
 
  Class =  0x100100
 
  
> /etc/rc.d/dbus start
+
=== hcitool scan: Device not found ===
:: Starting D-BUS system messagebus
 
[DONE]
 
  
> /etc/rc.d/bluetooth start
+
* On some Dell laptops (e.g. Studio 15) you have to switch the Bluetooth mode from HID to HCI. Install the {{Pkg|bluez-hid2hci}} package, then [[udev]] should do this automatically. Alternatively, you can run this command to switch to HCI manually:
:: Stopping bluetooth subsystem:  pand dund rfcomm hidd  bluetoothd
+
  # /usr/lib/udev/hid2hci
[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 !!'''
+
* If the device will not show up and you have a Windows operating system on your machine, try booting it and enable the bluetooth adapter from windows.
> /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 you can browse the filesystem of your phone with obexftp:'''
+
* Sometimes also this simple command helps:
  > obexftp -v -b 00:1A:1B:82:9B:6D -B 9 -l
+
  # hciconfig hci0 up
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:'''
+
=== rfkill unblock: Do not unblock ===
  
> groupadd bluetooth
+
If your device still soft blocked and you run connman, try this:
> 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/
+
  $ connmanctl enable 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 ===
+
=== My computer is not visible ===
  
Assuming a bluetooth device called hci0 and an iPhone that showed up in a hcitool scan as '00:00:DE:AD:BE:EF':
+
Cannot discover computer from your phone? Enable PSCAN and ISCAN:
 +
# enable PSCAN and ISCAN
 +
$ hciconfig hci0 piscan
 +
# check it worked
 +
{{hc|$ 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
 +
}}
  
    # bluez-simple-agent hci0 00:00:DE:AD:BE:EF
+
{{Note|Check DiscoverableTimeout and PairableTimeout in {{ic|/etc/bluetooth/main.conf}}}}
    Passcode:
 
  
=== Headset and Alsa Devices  ===
+
Try changing device class in {{ic|/etc/bluetooth/main.conf}} as following:
1. First if you have not already, install bluez
+
  # Default device class. Only the major and minor device class bits are
# pacman -S bluez
+
  # considered.
2. Scan for your device
+
  #Class = 0x000100 (from default config)
$ hcitool (-i <optional hci#>***) scan
+
  Class = 0x100100
3. Pair your headset with your device
 
$ bluez-simple-agent (optional hci# ***) XX:XX:XX:XX:XX:XX
 
  and put in your pin (0000 or 1234, etc)
 
4. Add this to your/etc/asound.conf file
 
  #/etc/asound.conf
 
   
 
pcm.btheadset {
 
    type plug
 
    slave {
 
        pcm {
 
            type bluetooth
 
            device XX:XX:XX:XX:XX:XX
 
            profile "auto"
 
        } 
 
    } 
 
    hint {
 
        show on
 
        description "BT Headset"
 
    } 
 
  }
 
  ctl.btheadset {
 
  type bluetooth
 
 
  
5. Check to see if it has been added to alsa devices
+
This was the only solution to make my computer visible for my phone.
$ aplay -L
 
  
6. Now play with aplay:
+
=== Logitech keyboard does not pair ===
$ aplay -D btheadset /path/to/audio/file
 
 
 
or Mplayer:
 
$ mplayer -ao alsa:device=btheadset /path/to/audio/or/video/file
 
  
*** To find hci# for a usb dongle, type in
+
If you do not get the passkey when you try to pair your Logitech keyboard, type the following command:
  $ hcitool dev
+
  # hciconfig hci0 sspmode 0
  
== Troubleshooting ==
+
If after pairing, the keyboard still does not connect, check the output of {{ic|hcidump -at}}. If the latter indicates repeatedly connections-disconnections like the following message:
 +
 
 +
    status 0x00 handle 11 reason 0x13
 +
    Reason: Remote User Terminated Connection
 +
 
 +
then, the only solution for now is to install [[bluez4|the old Bluetooth stack]].
 +
 
 +
=== HSP/HFP profiles ===
  
=== Segfaults in Bluez 4.95 ===
+
bluez5 removed support for the HSP/HFP profiles (telephony headset for [[TeamSpeak]], [[Skype]], etc.). You need to install [[PulseAudio]] (>= version 6) or another application that implements HSP/HFP itself.
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:
 
  
bluetoothd[2330]: segfault at 1 ip 00007fcef2327b75 sp 00007fff9f769cb0 error 4 in libglib-2.0.so.0.2800.8[7fcef22ca000+e9000]
+
=== Thinkpad Bluetooth Laser Mouse problems ===
  
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.
+
If you are experiencing that your Thinkpad Bluetooth Laser Mouse rapidly connects and then (after a few milliseconds) disconnects again every few seconds (when you move the mouse or press a button), try pairing it with the code {{ic|0000}} instead pairing without a code.
  
=== passkey-agent ===
+
=== Foxconn / Hon Hai / Lite-On Broadcom device ===
$> passkey-agent --default 1234
 
Can't register passkey agent
 
The name org.bluez was not provided by any .service files
 
You probably started {{ic|/etc/rc.d/bluetooth}} before {{ic|/etc/rc.d/dbus}}
 
$> hciconfig dev
 
# (no listing)
 
Try running {{ic|hciconfig hc0 up}}
 
  
=== Blueman ===
+
Some of these devices require the firmware to be flashed into the device at boot. The firmware is not provided but can converted from a Microsoft Windows ''.hex'' file into a ''.hcd'' using [https://github.com/jessesung/hex2hcd hex2hcd] (which is installed with {{Pkg|bluez-utils}}).
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
 
  
=== gnome-bluetooth ===
+
In order to get the right ''.hex'' file, try searching the device vendor:product code obtained with ''lsusb'', for example:
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
 
Then run:
 
  # 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 {{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):
+
    Bus 002 Device 004: ID '''04ca:2006''' Lite-On Technology Corp. Broadcom BCM43142A0 Bluetooth Device
 +
    ...
  
# tail -f /var/log/messages.log
+
or
  Feb 20 15:00:24 hostname kernel: [ 2661.349823] usb 4-1: new full-speed USB device number 3 using uhci_hcd
 
  Feb 20 15:00:24 hostname bluetoothd[4568]: HCI dev 0 registered
 
  Feb 20 15:00:24 hostname bluetoothd[4568]: Listening for HCI events on hci0
 
  Feb 20 15:00:25 hostname bluetoothd[4568]: HCI dev 0 up
 
  Feb 20 15:00:25 hostname bluetoothd[4568]: Adapter /org/bluez/4568/hci0 has been enabled
 
  
For a list of supported hardware please refer to the [[Bluetooth#Resources|resources]] section on this page.
+
    Bus 004 Device 004: Id '''0489:e031''' Foxconn / Hon Hai
  
If you only get the first two lines, you may see that it found the device but you need to bring it up.
+
Alternatively, boot into Windows (a virtual machine installation will suffice) and get the firmware name from the Device Manager utility. If you want to know the model of your device but cannot see it in ''lsusb'', you might see it in ''lsusb -v'' as {{ic|iProduct}}.
Example:
 
  
hciconfig -a hci0
+
The ''.hex'' file can be extracted from the downloaded Windows driver without having to run Windows for it. Download the right driver, for example [http://www.fujitsupc.com/downloads/mobile/BLUETOOTH_WIDCOMM_V6.5.0.3100_WIN7-32_FPC46-1771-01.EXE Bluetooth Widcomm] (listed among the drivers for [http://support.fujitsupc.com/CS/Portal/supportsearch.do?srch=DOWNLOADS&Series=P%20Series&Model=P771&ProductType=Notebook%20PC Lifebook P771]), which contains the drivers for many Broadcomm devices. In case of Bluetooth Widcomm, the driver is a self-extracting RAR archive, so it can be extracted using ''{{Pkg|unrar}} x''. To find out which of the many ''.hex'' files is the right one for you, look in the file {{ic|Win32/bcbtums-win7x86-brcm.inf}} and search for {{ic|[RAMUSB'''E031'''.CopyList]}}, where {{ic|E031}} should be replaced with the product code (the second hex number in ''lsusb'') of your device in upper-case. Underneath you should see the file name of the right ''.hex'' file.
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
 
  
If this fails with an error like:
+
Once you have the ''.hcd'' file, copy it into {{ic|/lib/firmware/brcm/BCM.hcd}} - this filename is suggested by {{ic|dmesg}} and it may change in your case so check your ''dmesg'' output in order to verify. Then reload the ''btusb'' module:
Operation not possible due to RF-kill
 
it could be due either to the {{ic|rfkill}} utility, in which case it should be resolved with
 
# rfkill unblock all
 
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.
 
  
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:
+
# rmmod btusb
 +
# modprobe btusb
  
$ hcitool dev
+
In some cases (with older kernels?), you have to flash the ''.hcd'' file with the ''brcm_patchram_plus'' utility, provided by {{AUR|brcm_patchram_plus-git}}{{Broken package link|{{aur-mirror|brcm_patchram_plus-git}}}}. First, make sure in ''dmesg'' that the device is recognized by ''btusb'' as a bluetooth device. Then, run the following (replace ''04ca 2006'' with your vendor product pair):
Devices:
 
        hci0 00:1B:DC:0F:DB:40
 
  
More detailed informations about the device can be retrieved by using {{ic|hciconfig}}.
+
# echo '04ca 2006' > /sys/bus/usb/drivers/btusb/new_id
 +
   
 +
Turn on the device:
  
  $ hciconfig -a hci0
+
  # hciconfig hci0 up
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)
 
  
=== Logitech Bluetooth USB Dongle ===
+
Flash the firmware:
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.
 
  
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]
+
# brcm_patchram_plus_usb --patchram fw-04ca_2006.hcd hci0
  
=== hcitool scan: Device not found ===
+
The device should now be available. See [https://bbs.archlinux.org/viewtopic.php?id=162688 BBS#162688] for information on making these changes persistent.
* On some Dell laptops (e.g. Studio 15) you have to switch the Bluetooth mode from HID to HCI using
 
# hid2hci
 
  
{{Note|hid2hci is no longer in the $PATH, it is under /lib/udev/hid2hci, but udev should run it automatically for you.}}
+
=== Device connects, then disconnects after a few moments ===
  
* 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.
+
If you see messages like the following in {{ic|journalctl}} output, and your device fails to connect or disconnects shortly after connecting:
  
* Sometimes also this simple command helps:
+
bluetoothd: Unable to get connect data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
  # hciconfig hci0 up
+
  bluetoothd: connect error: Connection refused (111)
  
=== My computer isn't visible ===
+
This may be because you have already paired the device with another operating system using the same bluetooth adapter (e.g., dual-booting).  Some devices can't handle multiple pairings associated with the same MAC address (i.e., bluetooth adapter). You can fix this by re-pairing the device. Start by removing the device:
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
 
  
{{Note | Check DiscoverableTimeout and PairableTimeout in /etc/bluetooth/main.conf}}
+
$ bluetoothctl
 +
[bluetooth]# devices
 +
Device XX:XX:XX:XX:XX:XX My Device
 +
[bluetooth]# remove XX:XX:XX:XX:XX:XX
  
Try changing device class in /etc/bluetooth/main.conf as following
+
Then [[restart]] {{ic|bluetooth.service}}, turn on your bluetooth adapter, make your device discoverable, re-scan for devices, and re-pair your device. Depending on your bluetooth manager, you may need to perform a full reboot in order to re-discover the device.
# 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.
+
=== Device does not connect with an error in journal ===
  
=== Nautilus cannot browse files ===
+
If you see a message like the following in {{ic|journalctl}} output while trying to connect to a device:
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 ===
+
a2dp-source profile connect failed for 9C:64:40:22:E1:3F: Protocol not available
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.
 
  
=== Sennheiser MM400 Headset connection problems ===
+
try installing {{Pkg|pulseaudio-bluetooth}} and restarting pulseaudio. This error can manifest even while using only file transfer.
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.
 
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).
 
  
=== My device is paired but no sound is played from it ===
+
=== Device does not show up in scan ===
Try to first inspect '''/var/log/messages.log'''
 
{{bc|# tail /var/log/messages.log
 
Jan 12 20:08:58 localhost pulseaudio[1584]: [pulseaudio] module-bluetooth-device.c: Service not connected
 
Jan 12 20:08:58 localhost pulseaudio[1584]: [pulseaudio] module-bluetooth-device.c: Bluetooth audio service not available}}
 
  
If you see such messages, try first:
+
Some devices using bluetooth low energy do not appear when scanning with bluetoothctl, for example the Logitech MX Master. The simplest way I've found to connect them is by installing {{aur|bluez-utils-compat}}, then:
{{bc|# pactl load-module module-bluetooth-device}}
 
  
If the module fails to work, do this workaround:
+
# systemctl start bluetooth.service
Open '''/etc/bluetooth/audio.conf''' and add after '''[General]''' (on a new line)
+
# bluetoothctl
{{bc|Enable&#61;Socket}}
+
[NEW] Controller (MAC) myhostname [default]
Then restart the bluetooth daemon with {{ic|/etc/rc.d/bluetooth restart}}.
+
[bluetooth]# power on
Pair again your device, and you should find it in the pulseaudio settings (advanced settings for the sound)
+
[CHG] Controller (MAC) Class: 0x0c010c
 +
Changing power on succeeded
 +
[CHG] Controller (MAC) Powered: yes
 +
[bluetooth]# scan on
 +
Discovery started
 +
[CHG] Controller (MAC) Discovering: yes
  
[http://wiki.gentoo.org/index.php?title=Bluetooth_Headset&redirect=no More information on Gentoo Wiki]
+
In another terminal:
  
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"
+
# hcitool lescan
  
fail (/usr/lib/python2.7/site-packages/blueman/gui/manager/ManagerDeviceMenu.py:134)
+
Wait until your device shows up, then Ctrl+C hcitool. bluetoothctl should now see your device and pair normally.
fail (DBusException(dbus.String(u'Stream setup failed'),),)
 
  
== See also ==
+
=== DualBoot with Windows ===
*[http://www.gentoo.org/doc/en/bluetooth-guide.xml Gentoo Linux Bluetooth Guide]
+
{{Accuracy|Needs at the least a link to a valid bug report.|section=DualBoot bluetooth}}
*[http://en.opensuse.org/HCL:Bluetooth openSUSE Bluetooth Hardware Compatibility List]
+
If you reboot from Windows into Linux without a complete power interruption it is sometimes not possible to use bluetooth.
*[http://linuxgazette.net/109/oregan3.html Accessing a Bluetooth phone (Linux Gazette)]
+
A workaround is to turn off completely your computer and turn it on again. This will reset internal states of the bluetooth controller.
*[http://www.adamish.com/blog/#a000361 Bluetooth computer visibility]
 

Latest revision as of 07:54, 10 June 2017

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 BlueZ.

Installation

Install the bluez and bluez-utils packages. The bluez package provides the Bluetooth protocol stack, and the bluez-utils package provides the bluetoothctl utility.

Load the generic bluetooth driver, if not already loaded:

# modprobe btusb

Then start the bluetooth.service systemd unit. You can enable it to start automatically at boot time.

Note:
  • By default the bluetooth daemon will only give out bnep0 devices to users that are a member of the lp group. Make sure to add your user to that group if you intend to connect to a bluetooth tether. You can change the group that is required in the file /etc/dbus-1/system.d/bluetooth.conf.
  • Some Bluetooth adapters are bundled with a Wi-Fi card (e.g. Intel Centrino). These require that the Wi-Fi card is firstly enabled (typically a keyboard shortcut on a laptop) in order to make the Bluetooth adapter visible to the kernel.
  • Some Bluetooth cards (e.g. Broadcom) conflict with the network adapter. Thus, you need to make sure that your Bluetooth device get connected before the network service boot.
  • Some tools such as hcitool and hciconfig have been deprecated upstream, and are no longer included in bluez-utils. Since these tools will no longer be updated, it is recommended that scripts be updated to avoid using them. If you still desire to use them, install bluez-utils-compatAUR. See FS#53110 and the Bluez mailing list for more information.

Configuration via the CLI

Bluetoothctl

Pairing a device from the shell is one of the simplest and most reliable options. The exact procedure depends on the devices involved and their input functionality. What follows is a general outline of pairing a device using /usr/bin/bluetoothctl:

Start the bluetoothctl interactive command. There one can input help to get a list of available commands.

  • Possibly select a default controller by inputting select MAC Address
  • Turn the power to the controller on by entering power on. It is off by default.
  • Enter devices to get the MAC Address of the device with which to pair.
  • Enter device discovery mode with scan on command if device is not yet on the list.
  • Turn the agent on with agent on.
  • Enter pair MAC Address to do the pairing (tab completion works).
  • If using a device without a PIN, one may need to manually trust the device before it can reconnect successfully. Enter trust MAC Address to do so.
  • Finally, use connect MAC_address to establish a connection.

An example session may look this way:

# bluetoothctl 
[NEW] Controller 00:10:20:30:40:50 pi [default]
[bluetooth]# agent KeyboardOnly 
Agent registered
[bluetooth]# default-agent 
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:10:20:30:40:50 Discovering: yes
[NEW] Device 00:12:34:56:78:90 myLino
[CHG] Device 00:12:34:56:78:90 LegacyPairing: yes
[bluetooth]# pair 00:12:34:56:78:90
Attempting to pair with 00:12:34:56:78:90
[CHG] Device 00:12:34:56:78:90 Connected: yes
[CHG] Device 00:12:34:56:78:90 Connected: no
[CHG] Device 00:12:34:56:78:90 Connected: yes
Request PIN code
[agent] Enter PIN code: 1234
[CHG] Device 00:12:34:56:78:90 Paired: yes
Pairing successful
[CHG] Device 00:12:34:56:78:90 Connected: no
[bluetooth]# connect 00:12:34:56:78:90
Attempting to connect to 00:12:34:56:78:90
[CHG] Device 00:12:34:56:78:90 Connected: yes
Connection successful

Auto power-on after boot

By default, your Bluetooth adapter will not power on after a reboot. The former method by using hciconfig hci0 up is deprecated, see the release note. Now you just need to add the line AutoEnable=true in /etc/bluetooth/main.conf at the bottom in the [Policy] section:

/etc/bluetooth/main.conf
[Policy]
AutoEnable=true

Deprecated method using hciconfig

In order to have the device active after a reboot, a udev rule is needed:

/etc/udev/rules.d/10-local.rules
# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig %k up"
Tip: Replace KERNEL=="hci0" with KERNEL=="hci[0-9]*" to match all interfaces.

After a suspend/resume-cycle, the device can be powered on automatically using a custom systemd service:

/etc/systemd/system/bluetooth-auto-power@.service
[Unit]
Description=Bluetooth auto power on
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target

[Service]
Type=oneshot
ExecStart=/usr/bin/hciconfig %i up

[Install]
WantedBy=suspend.target

Enable an instance of the unit using your bluetooth device name, for example bluetooth-auto-power@hci0.service.

Configuration with a graphical front-end

The following packages allow for a graphical interface to customize Bluetooth.

GNOME Bluetooth

GNOME Bluetooth is GNOME's Bluetooth tool. The gnome-bluetooth package provides the back-end, gnome-shell provides the status monitor applet, and gnome-control-center provides the configuration front-end GUI that can be accessed by typing Bluetooth on the Activities overview, or with the gnome-control-center bluetooth command. You can also launch the bluetooth-sendto command directly to send files to a remote device.

To receive files, you must install the gnome-user-share package. You can then go to Settings -> Sharing to authorize receiving files from paired devices over Bluetooth.

Tip: To add a Bluetooth entry to the Send To menu in Thunar's file properties menu, see instructions here. (The command that needs to be configured is bluetooth-sendto %F).

Bluedevil

Bluedevil is KDE's Bluetooth tool. It can be installed with the package bluedevil (KDE Plasma 5).

If there is no Bluetooth icon visible in Dolphin and in the system tray, enable it in the system tray options or add a widget. You can configure Bluedevil and detect Bluetooth devices by clicking the icon. An interface is also available from the KDE System Settings.

Blueberry

Blueberry is an alternative front-end for GNOME Bluetooth, which works in all desktop environments. It can be installed with the blueberry package. It provides a configuration tool (blueberry) and a system tray applet (blueberry-tray).

Blueman

See Blueman.

Using Obex for sending and receiving files

ObexFS

Another option, rather than using KDE or Gnome Bluetooth packages, is ObexFS which allows for the mounting of phones which are treated like any other filesystem.

Note: To use ObexFS, one needs a device that provides an ObexFTP service.

Install obexfs and mount supported phones by running:

$ obexfs -b MAC_address_of_device /mountpoint

Once you have finished, to unmount the device use the command:

$ fusermount -u /mountpoint

For more mounting options see http://dev.zuckschwerdt.org/openobex/wiki/ObexFs

Note: Ensure that the bluetooth device you are mounting is not set to mount read-only. You should be able to do this from the device's settings. If the device is mounted read-only you may encounter a permissions error when trying to transfer files to the device.

ObexFTP transfers

If your device supports the Obex FTP service but you do not wish to mount the device you can transfer files to and from the device using the obexftp command.

To send a file to a device run the command:

$ obexftp -b MAC_address_of_device -p /path/to/file

To retrieve a file from a device run the command:

$ obexftp -b MAC_address_of_device -g filename
Note: Ensure that the file you are retrieving is in the device's exchange folder. If the file is in a subfolder of the exchange folder then provide the correct path in the command.

Obex Object Push

For devices that do not support Obex FTP service, check if Obex Object Push is supported.

# sdptool browse XX:XX:XX:XX:XX:XX

Read the output, look for Obex Object Push, remember the channel for this service. If supported, one can use ussp-push to send files to this device:

# ussp-push XX:XX:XX:XX:XX:XX@CHANNEL file wanted_file_name_on_phone

Using your computer's speakers as a bluetooth headset

This can allow you to do things such as playing what is on your phone through your computer speakers.

Add the following to the file /etc/bluetooth/audio.conf (create it if not present):

[General]
Enable=Source

More info in:

Audio

In order to be able to use audio equipment like bluetooth headphones, you need to install the additional pulseaudio-bluetooth package.

Please have a look at the Bluetooth headset page for more information about bluetooth audio and bluetooth headsets.

In order to enable your system to be detected as an A2DP sink (e.g. to play music from your phone via your computer speakers), add Enable=Source,Sink,Media,Socket under [General] in /etc/bluetooth/audio.conf.

Troubleshooting

Shell command _____ is missing from bluez-utils

Some tools have been marked as deprecated and removed from the package. At this time they are still available in the AUR package bluez-utils-compatAUR. Their functionality is partially covered by new tools, while some things have yet to be implemented with the new D-Bus API:

Deprecated tool Most likely replacement
gatttool btgatt-client, [D-Bus Gatt API https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt]
hciattach btattach
hciconfig btmgmt (and bluetoothctl?)
hcidump btmon (and btsnoop)
hcitool missing, D-Bus Device API available
rfcomm missing, implement with D-Bus Profile1 API?
ciptool
sdptool missing, functionality seems to be scattered over different D-Bus objects: Profile, Advertising, and the UUIDs arrays in device and adapter.

bluetoothctl

If bluetoothctl cannot find any controller, the bluetooth device may be blocked. Try to unblock it using rfkill:

# rfkill unblock bluetooth

gnome-bluetooth

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

Then install xdg-user-dirs and issue:

$ 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 running journalctl -f when you have plugged in the USB dongle (or inspecting /var/log/messages.log). It should look something like the following (look out for hci):

Feb 20 15:00:24 hostname kernel: [ 2661.349823] usb 4-1: new full-speed USB device number 3 using uhci_hcd
Feb 20 15:00:24 hostname bluetoothd[4568]: HCI dev 0 registered
Feb 20 15:00:24 hostname bluetoothd[4568]: Listening for HCI events on hci0
Feb 20 15:00:25 hostname bluetoothd[4568]: HCI dev 0 up
Feb 20 15:00:25 hostname bluetoothd[4568]: Adapter /org/bluez/4568/hci0 has been enabled

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:
# 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

If this fails with an error like:

Operation not possible due to RF-kill

it could be due either to the rfkill utility, in which case it should be resolved with

# rfkill unblock all

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.

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 information 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)

Audio devices start to skip at short distance from dongle

If other devices share the same USB host, they can interrupt communication with audio devices. Make sure it is the only device attached to its bus. For example:

$ lsusb
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 048d:1345 Integrated Technology Express, Inc. Multi Cardreader
Bus 001 Device 003: ID 0424:a700 Standard Microsystems Corp. 2 Port Hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Logitech Bluetooth USB Dongle

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 you are using a normal USB mouse/keyoard.

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. Discussion

Alternatively, you can install the bluez-hid2hci package. When you connect your Logitech dongle it will automatically switch.

hcitool scan: Device not found

  • On some Dell laptops (e.g. Studio 15) you have to switch the Bluetooth mode from HID to HCI. Install the bluez-hid2hci package, then udev should do this automatically. Alternatively, you can run this command to switch to HCI manually:
# /usr/lib/udev/hid2hci
  • If the device will not show up and you have a Windows operating system on your machine, try booting it and enable the bluetooth adapter from windows.
  • Sometimes also this simple command helps:
# hciconfig hci0 up

rfkill unblock: Do not unblock

If your device still soft blocked and you run connman, try this:

$ connmanctl enable bluetooth

My computer is not visible

Cannot 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
Note: Check DiscoverableTimeout and PairableTimeout in /etc/bluetooth/main.conf

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.

Logitech keyboard does not pair

If you do not get the passkey when you try to pair your Logitech keyboard, type the following command:

# hciconfig hci0 sspmode 0

If after pairing, the keyboard still does not connect, check the output of hcidump -at. If the latter indicates repeatedly connections-disconnections like the following message:

   status 0x00 handle 11 reason 0x13
   Reason: Remote User Terminated Connection

then, the only solution for now is to install the old Bluetooth stack.

HSP/HFP profiles

bluez5 removed support for the HSP/HFP profiles (telephony headset for TeamSpeak, Skype, etc.). You need to install PulseAudio (>= version 6) or another application that implements HSP/HFP itself.

Thinkpad Bluetooth Laser Mouse problems

If you are experiencing that your Thinkpad Bluetooth Laser Mouse rapidly connects and then (after a few milliseconds) disconnects again every few seconds (when you move the mouse or press a button), try pairing it with the code 0000 instead pairing without a code.

Foxconn / Hon Hai / Lite-On Broadcom device

Some of these devices require the firmware to be flashed into the device at boot. The firmware is not provided but can converted from a Microsoft Windows .hex file into a .hcd using hex2hcd (which is installed with bluez-utils).

In order to get the right .hex file, try searching the device vendor:product code obtained with lsusb, for example:

   ...
   Bus 002 Device 004: ID 04ca:2006 Lite-On Technology Corp. Broadcom BCM43142A0 Bluetooth Device
   ...

or

   Bus 004 Device 004: Id 0489:e031 Foxconn / Hon Hai

Alternatively, boot into Windows (a virtual machine installation will suffice) and get the firmware name from the Device Manager utility. If you want to know the model of your device but cannot see it in lsusb, you might see it in lsusb -v as iProduct.

The .hex file can be extracted from the downloaded Windows driver without having to run Windows for it. Download the right driver, for example Bluetooth Widcomm (listed among the drivers for Lifebook P771), which contains the drivers for many Broadcomm devices. In case of Bluetooth Widcomm, the driver is a self-extracting RAR archive, so it can be extracted using unrar x. To find out which of the many .hex files is the right one for you, look in the file Win32/bcbtums-win7x86-brcm.inf and search for [RAMUSBE031.CopyList], where E031 should be replaced with the product code (the second hex number in lsusb) of your device in upper-case. Underneath you should see the file name of the right .hex file.

Once you have the .hcd file, copy it into /lib/firmware/brcm/BCM.hcd - this filename is suggested by dmesg and it may change in your case so check your dmesg output in order to verify. Then reload the btusb module:

# rmmod btusb
# modprobe btusb

In some cases (with older kernels?), you have to flash the .hcd file with the brcm_patchram_plus utility, provided by brcm_patchram_plus-gitAUR[broken link: archived in aur-mirror]. First, make sure in dmesg that the device is recognized by btusb as a bluetooth device. Then, run the following (replace 04ca 2006 with your vendor product pair):

# echo '04ca 2006' > /sys/bus/usb/drivers/btusb/new_id
    

Turn on the device:

# hciconfig hci0 up

Flash the firmware:

# brcm_patchram_plus_usb --patchram fw-04ca_2006.hcd hci0

The device should now be available. See BBS#162688 for information on making these changes persistent.

Device connects, then disconnects after a few moments

If you see messages like the following in journalctl output, and your device fails to connect or disconnects shortly after connecting:

bluetoothd: Unable to get connect data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
bluetoothd: connect error: Connection refused (111)

This may be because you have already paired the device with another operating system using the same bluetooth adapter (e.g., dual-booting). Some devices can't handle multiple pairings associated with the same MAC address (i.e., bluetooth adapter). You can fix this by re-pairing the device. Start by removing the device:

$ bluetoothctl
[bluetooth]# devices
Device XX:XX:XX:XX:XX:XX My Device
[bluetooth]# remove XX:XX:XX:XX:XX:XX

Then restart bluetooth.service, turn on your bluetooth adapter, make your device discoverable, re-scan for devices, and re-pair your device. Depending on your bluetooth manager, you may need to perform a full reboot in order to re-discover the device.

Device does not connect with an error in journal

If you see a message like the following in journalctl output while trying to connect to a device:

a2dp-source profile connect failed for 9C:64:40:22:E1:3F: Protocol not available

try installing pulseaudio-bluetooth and restarting pulseaudio. This error can manifest even while using only file transfer.

Device does not show up in scan

Some devices using bluetooth low energy do not appear when scanning with bluetoothctl, for example the Logitech MX Master. The simplest way I've found to connect them is by installing bluez-utils-compatAUR, then:

# systemctl start bluetooth.service
# bluetoothctl
[NEW] Controller (MAC) myhostname [default]
[bluetooth]# power on
[CHG] Controller (MAC) Class: 0x0c010c
Changing power on succeeded
[CHG] Controller (MAC) Powered: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller (MAC) Discovering: yes

In another terminal:

# hcitool lescan

Wait until your device shows up, then Ctrl+C hcitool. bluetoothctl should now see your device and pair normally.

DualBoot with Windows

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Needs at the least a link to a valid bug report. (Discuss in Talk:Bluetooth#DualBoot bluetooth)

If you reboot from Windows into Linux without a complete power interruption it is sometimes not possible to use bluetooth. A workaround is to turn off completely your computer and turn it on again. This will reset internal states of the bluetooth controller.