5

I have an Apple Magic Mouse that I am using on a Lenovo Thinkpad T440s with Ubuntu 14.04 installed. I have successfully paired the device and it works for short periods of time.

The mouse appears to disconnect for several seconds and then reconnect.

Occasionally, I get the error message that the batteries are low ( 0%). The batteries are new.

I have updated the kernel to the newest version in hopes that would solve the issue. It did not. How can I get it to stop disconnecting?

3 Answers3

10

I've had the same problem and recently I tried disabling eSCO mode in the bluetooth module:

echo 1 | sudo tee /sys/module/bluetooth/parameters/disable_esco
sudo /etc/init.d/bluetooth restart
# persist setting
echo "options bluetooth disable_esco=1" | sudo tee /etc/modprobe.d/bluetooth-tweaks.conf

The mouse's connection seems more stable now and I haven't seen a disconnect after tweaking this setting.

My laptop Lenovo W530 has a Broadcom Bluetooth adapter (internally usb is the interface).

If you have a Broadcom Bluetooth adapter, you might have to get a .hex firmware file from a windows driver and put it in /lib/firmware directory to support all Bluetooth features. More info in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1065400/comments/11 and https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1065400 .

Use hex2hcd to convert windows driver .hex file to .hcd: https://github.com/jessesung/hex2hcd

I found Broadcom .hex files in this windows driver package. Locate the Win7/Win32/bcbtums-win7x86-brcm.inf file and search for the USB ID of your adapter.

$ lsusb |grep Bluetooth
Bus 001 Device 006: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]

search for RAMUSB<usb product id in upper case>, for example RAMUSB21E6 for my adapter. There you will find the .hex file name:

[RAMUSB21E6.NTX86.hw.reg]
HKR,,LowerFilters, 0x00010000, "bcbtums"
HKR,,%RAMPatchFileName%,0x00000, "BCM20702A1_001.002.014.1315.1387.hex"
HKR,,%RemoteWakeEnabled%,0x00010001,1
HKR,,%DeviceRemoteWakeSupported%,0x00010001,1

In my case the file was Win7/Win32/BCM20702A1_001.002.014.1315.1387.hex

I then used hex2hcd to convert the file to /lib/firmware/fw-0a5c_21e6.hcd (again that file name contains the USB ids of your Broadcom USB Bluetooth adapter).

Lari Hotari
  • 241
  • 2
  • 7
  • 2
    I actually still kept getting problems with the connection and after buying a $4 bluetooth usb dongle from China, the problem went mostly away. I now get disconnects a few times in a day and it reconnects much faster. – Lari Hotari Jan 30 '16 at 17:45
  • 2
    This is the bluetooth usb dongle I got http://www.dx.com/p/ultra-mini-bluetooth-csr-4-0-usb-dongle-adapter-black-143276#.Vqz3a0LL-fk – Lari Hotari Jan 30 '16 at 17:48
  • Adding to this, after moving my `.hcd` file to `/lib/firmware/`, running `dmesg | grep Bluetooth` and restarting found that it wasn't being loaded. dmesg informed me with this line `Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e8.hcd not found` so i renamed my file and moved it to `/lib/firmware/brcm/BCM20702A1-0a5c-21e8.hcd`. After restarting and checking dmesg seems it loaded correctly: `Bluetooth: hci0: BCM20702A1 (001.002.014) build 1459` – eridani Mar 13 '16 at 22:46
  • With my Thinkpad T480 and ubuntu 18.04, this fix seems to work – Tim Richardson Jun 25 '18 at 12:31
0

I also suffer from this issue, but recently I've found a way to considerably improve the situation, I get fewer disconnects (by an order of magnitude), and much faster re-connect.

OS: OpenSuse Tumbleweed latest

Hardware: HP ZBook 3

Trackpad: Apple Magic Trackpad v1

BT adapter: ID 8087:0a2b Intel

  1. disable ESCO echo 1 | sudo tee /sys/module/bluetooth/parameters/disable_esco
  2. create (or edit, if you already have one) /etc/bluetooth/main.conf
    [General]
    MultiProfile = multiple
    FastConnectable = true
    [GATT]
    Channels = 5
    [Policy]
    ReconnectAttempts=50
    ReconnectIntervals=1,1,1,2,2,2,3,3,3,3
    AutoEnable=true
    
  3. restart Bluetooth sudo systemctl restart bluetooth

After years of living with this problem, I still cannot get rid of it completely. What's weird is, when I first bought the trackpad (in 2011), I used it on a PC with Debian Etch, with a no-name el cheap-o dongle, and the disconnection issue wasn't there. The dongle is still alive, recently found it and tested it, but it now disconnects, like all my other devices.

Czar
  • 113
  • 4
-1

I believe the proper solution is the following edit to /etc/bluetooth/main.conf :

[General]

# Default adapter name
# Defaults to 'BlueZ X.YZ'
Name = BlueZ

# Default device class. Only the major and minor device class bits are
# considered. Defaults to '0x000000'.
Class = 0x000100

# How long to stay in discoverable mode before going back to non-discoverable
# The value is in seconds. Default is 180, i.e. 3 minutes.
# 0 = disable timer, i.e. stay discoverable forever
DiscoverableTimeout = 0

# Always allow pairing even if there are no agent registered
# Possible values: true, false
# Default: false
AlwaysPairable = false

# How long to stay in pairable mode before going back to non-discoverable
# The value is in seconds. Default is 0.
# 0 = disable timer, i.e. stay pairable forever
PairableTimeout = 0

# Use vendor id source (assigner), vendor, product and version information for
# DID profile support. The values are separated by ":" and assigner, VID, PID
# and version.
# Possible vendor id source values: bluetooth, usb (defaults to usb)
DeviceID = bluetooth:1234:5678:abcd

# Do reverse service discovery for previously unknown devices that connect to
# us. For BR/EDR this option is really only needed for qualification since the
# BITE tester doesn't like us doing reverse SDP for some test cases, for LE
# this disables the GATT client functionally so it can be used in system which
# can only operate as peripheral.
# Defaults to 'true'.
ReverseServiceDiscovery = true

# Enable name resolving after inquiry. Set it to 'false' if you don't need
# remote devices name and want shorter discovery cycle. Defaults to 'true'.
NameResolving = true

# Enable runtime persistency of debug link keys. Default is false which
# makes debug link keys valid only for the duration of the connection
# that they were created for.
DebugKeys = false

# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
ControllerMode = dual

# Enables Multi Profile Specification support. This allows to specify if
# system supports only Multiple Profiles Single Device (MPSD) configuration
# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple
# Devices (MPMD) configurations.
# Possible values: "off", "single", "multiple"
MultiProfile = off

# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
# however the tradeoff is increased power consumptions. This feature
# will fully work only on kernel version 4.1 and newer. Defaults to
# 'false'.
FastConnectable = false

# Default privacy setting.
# Enables use of private address.
# Possible values: "off", "device", "network"
# "network" option not supported currently
# Defaults to "off"
Privacy = off

[GATT]
# GATT attribute cache.
# Possible values:
# always: Always cache attributes even for devices not paired, this is
# recommended as it is best for interoperability, with more consistent
# reconnection times and enables proper tracking of notifications for all
# devices.
# yes: Only cache attributes of paired devices.
# no: Never cache attributes
# Default: always
Cache = always

# Minimum required Encryption Key Size for accessing secured characteristics.
# Possible values: 0 and 7-16. 0 means don't care.
# Defaults to 0
KeySize = 0

# Exchange MTU size.
# Possible values: 23-517
# Defaults to 517
ExchangeMTU = 517

[Policy]
#
# The ReconnectUUIDs defines the set of remote services that should try
# to be reconnected to in case of a link loss (link supervision
# timeout). The policy plugin should contain a sane set of values by
# default, but this list can be overridden here. By setting the list to
# empty the reconnection feature gets disabled.
ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb

# ReconnectAttempts define the number of attempts to reconnect after a link
# lost. Setting the value to 0 disables reconnecting feature.
ReconnectAttempts=7

# ReconnectIntervals define the set of intervals in seconds to use in between
# attempts.
# If the number of attempts defined in ReconnectAttempts is bigger than the
# set of intervals the last interval is repeated until the last attempt.
ReconnectIntervals=1,2,4,8,16,32,64

# AutoEnable defines option to enable all controllers when they are found.
# This includes adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'false'.
AutoEnable=false

It works fine for me.

ChanganAuto
  • 1,940
  • 8
  • 14
  • 21
a b
  • 1