Apple Magic mouse frequently disconnects and reconnects

5,092

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

Share:
5,092

Related videos on Youtube

Jeremy McMinis
Author by

Jeremy McMinis

Updated on September 18, 2022

Comments

  • Jeremy McMinis
    Jeremy McMinis over 1 year

    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?

  • Lari Hotari
    Lari Hotari over 8 years
    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.
  • eridani
    eridani about 8 years
    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
  • Tim Richardson
    Tim Richardson almost 6 years
    With my Thinkpad T480 and ubuntu 18.04, this fix seems to work