Bluetooth

From openSUSE

(Difference between revisions)
(The Bluetooth LED on my laptop is off)
m (Troubleshooting.)
Line 91: Line 91:
The functionality to recognize the type of the BT device must be provided. Either default (or any other prepared) PIN is send or the user is asked via the gnome BT applet bluetooth-applet for the PIN.
The functionality to recognize the type of the BT device must be provided. Either default (or any other prepared) PIN is send or the user is asked via the gnome BT applet bluetooth-applet for the PIN.
-
===Troubleshooting.===
+
===Troubleshooting===
====The Bluetooth LED on my laptop is off====
====The Bluetooth LED on my laptop is off====
-
(<tt>sudo hcitool scan</tt> says: <tt>Device is not available: No such device</tt>)
+
(<tt>''sudo hcitool scan''</tt> says: <tt>''Device is not available: No such device''</tt>)
Laptops often have a dedicated LED showing the status.  
Laptops often have a dedicated LED showing the status.  

Revision as of 21:52, 31 October 2009

Contents

Bluetooth and related Topics

This article is a stub!
This article needs to be expanded. You are welcome to help in line with the openSUSE:Wiki Style Guidelines.

openSUSE 11.1

The following information is a fix to bug 461369 [1]. "hcitool cc <bt addr>" reports "Can't connect: Input/output error", and "bluetoothd -nd" reports that it can't connect to d-bus. This is a problem with the bluetooth kernel driver not working properly. The solution is to "modprobe btusb reset=1" as root. Then add the following line to your /etc/modprobe.conf.local file (again, as root):

options btusb reset=1

This should allow bluetooth to function after subsequent reboots.

If this workaround doesn't resolve the problem, you can try to change the /etc/dbus-1/system.conf file. You should comment the lines:

       <allow send_requested_reply="true" send_type="method_return"/>
       <allow send_requested_reply="true" send_type="error"/>

And add the following ones:

       <!-- Fix to avoid access denials on PackageKit and others -->
       <allow send_requested_reply="true" />

The resulting file should appear as following:

       <!-- allow sending valid replies -->
       <!-- commented out part
       <allow send_requested_reply="true" send_type="method_return"/>
       <allow send_requested_reply="true" send_type="error"/>
       -->
       <!-- Newly added line to fix permission problems -->
       <allow send_requested_reply="true" />

Then restart the computer.

If you are having issues with kde's bluetooth frontends on 11.1 try installing gnome-bluetooth and bluez-gnome, and running bluetooth-applet. This does not work, but it gives you something to occupy your time. Or, go back to 10.3.

Downgrading the Bluetooth Stack

Another alternative is to remove the Bluetooth software that is packed with 11.1, which is BlueZ 4.x and install the previous that shipped with 11.0, which is BlueZ 3.x. To do that, RPMs would be easier, however they are no longer available, it is possible to accomplish that following this tutorial [2] currently in Portuguese.

Quick and Dirty

This should at least get you going if your bluetooth is working, but your KDE/Gnome app is broken (as is most).

       Put your device in discover mode        
       # hcitool scan
       Scanning ...
       XX:XX:XX:XX:XX:XX       Microsoft Bluetooth Notebook Mouse 5000
       # hidd --connect XX:XX:XX:XX:XX:XX

Mouse / device should now work until it sleeps.

The only problem is finding which 11.1 rpm contains hidd... According to a SuSE forum post [3], it was removed several versions ago and has not been put back in.

HOWTOs

Most of the HOWTOs linked from the Bluez.org Wiki apply pretty well to recent openSUSE releases, so unless we have more extensive documentation here, it might be a good idea to read those.

Bluetooth Audio

Bluetooth audio is not yet working as smoothly as we would like. However, a HOWTO to get things going is available here.

Activating / deactivating bluetooth

To save energy on a laptop and to be protected against bluetooth hacks, the bluetooth module should be enabled only when needed. Use the Fn-key combination (e.g. Fn + F5, depending on your laptop model) to switch it on/off.

Input Devices

  • Note that in 11.1, the KDE input wizard is not working correctly. Please use the bluetooth-applet (package bluez-gnome) for now. This might not work. OpenSuSE 10.3 Bluetooth works reliably. 11.1 does not.
  • How to connect your input devices using kinputwizard. This might not work.
  • More good information is on the Bluez Wiki Input Devices HOWTO Page. This page assumes a working knowledge of DBus utilities and python programming.

RFCOMM Devices (aka "Dialup")

Gnome

There is a bug in in 10.3 where the hidd command has been disabled , and you are not able pair bluetooth devices. See bugzilla [[4]] This was not a problem in 10.2. To work around this, do not enable bluetooth from YaST. Re-install Gnome bluetooth packages as well as KDE Kinputwizard. run gnome tools from the control panel, and use kinputwizard to pair your device. Once paired you can use gnome bluetooth applet as per normal.

For 10.3, you can grab an updated bluez-gnome package from GNOME:Community. This will allow you to pair and connect input devices. Install gnome-vfs-obexftp in order to browse obex serving devices.

Pairing the devices in Gnome

The pairing of the bluetooth (BT) devices is a communication procedure. In our case between the BT controller and a BT device.

The standard procedure comprises:

  1. controller scans for available devices
  2. user choose the device to pair with
  3. controller and device exchange the PIN

If the device has an input/output capabilities the user can type the PIN. The communication between the BT controller and the user goes through the dbus and gnome BT applet bluetooth-applet .

If the device has not an input/output capabilities either default PIN 0000 is used or in worse case an fixed PIN different from the default is used.

The functionality to recognize the type of the BT device must be provided. Either default (or any other prepared) PIN is send or the user is asked via the gnome BT applet bluetooth-applet for the PIN.

Troubleshooting

The Bluetooth LED on my laptop is off

(sudo hcitool scan says: Device is not available: No such device)

Laptops often have a dedicated LED showing the status. E.g. a Lenovo X60s has its Bluetooth hardware indicator between the WLAN and the Num-Lock indicator.

Bluetooth does not work while the LED is off. A Lenovo x60s laptop has a hardware switch below its front edge, which must be pushed to the right-hand side, to enable Bluetooth and WLAN.

If the WLAN-LED is on, but the Bluetooth-LED remains off, try hitting Fn-F5. This is sometimes needed after suspend/resume.

Can I use the hcitool utility to pair or connect the bluetooth device?

The hcitool provides the user with the capability to communicate on the low-level with the bluetooth (BT) device. Unfortunately this utility is not supposed to be used for pairing or connecting the BT devices from the command line. The package bluez-test comprises small program written in python /usr/bin/simple-agent which can be used for this purpose. The /usr/bin/simple-agent is a text file. The complexity of the pairing or connecting the BT device can be seen from the content of this file. While the /usr/bin/simple-agent and other programs from the bluez-test package are not in production state it is recommended to use them for testing and development purposes only. The production desktops user is supposed to use the bluetooth-applet from the bluez-gnome package to communicate with the BT devices. From the upstream mailing lists I deduce that it can not be expected that this situation is going to be changed.

The system sees the BT keyboard/mouse as usb devices in HID mode, how do I switch to HCI mode ?

Blueooth (BT) keyboard/mouse sets are equipped with proprietary usb bluetooth dongle and works as a standard usb keyboard/mouse from the computer point of view. After the startup the usb dongle is running in the "Human interface device" (HID) mode. This behaviour enables to use the BT keyboard/mouse with BIOS only. Then, when the system is booted and the bluetooth subsystem is operational the usb dongle can be switched to to the "Host Controller Interface" (HCI) mode. Then the usb dongle operates as a BT controller and the keyboard/mouse are connected to the system as BT devices. The utility hid2hci should cover the whole transfer, but it works only for a couple of devices (just reported, I have seen none). Generally I have seen either the BT keyboard/mouse is used in the HID mode with the proprietary usb bluetooth dongle or the BT keyboard/mouse is used as a secondary input coupled to other bt HCI controller (typically notebook).

How can I analyze the bluetooth protocol.

If you want to analyze the bluetooth protocol you can use hcidump and wireshark. For example to see the BT device responding to hcitool scan command do the following:

  1. put the BT device into the pairing mode
  2. as a root issue command hcidump -t -w test
  3. as a user issue command hcitool scan; wait for the command to complete
  4. stop the hcidump -t -w test with Ctrl-C
  5. start wireshark and open the test file.

I can't get my mouse working.

The mouse has to be put into the "pairing mode". To put a bluetooth device into the pairing mode means:

"The process of establishing a new relationship between two Bluetooth enabled devices. During this process a link key is exchanged (either before connection establishment was requested or during connecting phase)."

as described in [1]. How to put into the "pairing mode" your specific device shall be described in the manual. If you need help with putting the mouse into the pairing mode post the model of the mouse and attach the manual if possible.

To solve this problem we have to be sure that the mouse can be seen. We need the following information.

  1. check the output of # hciconfig -a (to be sure, that the adapter is working)
  2. then put the mouse into the pairing mode (otherwise the mouse can not be seen)
  3. check the output of # hcitool scan (to check that the adapter sees the mouse)

The BT_ADDR of your mouse shell be listed in the output in step 3. If the mouse is not listed then try with other mouse to rule out the HW problem.

[1] http://www.bluetooth.com/Bluetooth/Technology/Glossary/