22

This has been asked, and answered, a million times before. And I think I've read almost all those questions and answers, and tried as many of the solutions as I can.

However, I still can't get the mouse to automatically reconnect after a sleep, or a shutdown, or any cessation of use. I'm using a Microsoft Sculpt Comfort Mouse under Kubuntu 14.04, 64bit. I can connect manually, of course.

My latest effort was to add the lines

<!-- Microsoft Sculpt Comfort mouse -->
<device oui="28:18:78:" name="Microsoft Sculpt Comfort Mouse" pin="0000"/>    

to /usr/share/kde4/apps/bluedevilwizard/pin-code-database.xml and then restart bluetooth with

sudo service bluetooth restart

But nothing. The mouse still has to be manually paired.

And just now, after trying a few hcitool commands - the mouse won't connect at all! All I now get are timeout messages. I don't know what I've done, but as of now the mouse refuses to connect at all.

I'm a bit confused here....

7 Answers 7

17

Try to use different tool to pair your Bluetooth device, e.g. blueman-manager (probably Bluetooth device is not "trusted").

I'm using Ubuntu 14.04 and have Microsoft Sculpt Comfort Mouse. When pairing mouse in Ubuntu's Bluetooth settings dialog, mouse doesn't reconnect after suspend/resume and even after some time of idle.

I unpaired mouse, paired and "trusted" it in blueman-manager and now it works like a charm.

2
  • Trully! I removed the device, then I made all the process via blueman-manager than set as "trust", it really autoreconnects now! Thanks!
    – insign
    Jan 25, 2015 at 16:09
  • Still works in Ubuntu 18.04, but had to apt-get install blueman, and sudo blueman-manager Apr 5, 2019 at 16:41
9

It works on Ubuntu 17.10 I think every distro with bluetoothctl is supported:

  1. Run in terminal bluetoothctl In $bluetooth command line type devices. You will see list of available devices.
  2. Type trust 00:XX:XX:XX:XX:XX Where number started with 00: is a divice you wish to connect.
  3. Type ctrl+d or quit to exit.
  4. If You want to automatically connect Your device on startup, open Startup Applications and add new one.

    • Press Add
    • Name launcher like My startup BT connection
    • In command type bash -c 'echo -e "connect 00:XX:XX:XX:XX:XX \nquit" | bluetoothctl'

You can also setup a keyboard shortcut with same command to lunch, and connect You device with press of a button.

Have fun :)

3
  • 1
    Thanks! Is there actually a reason why you didn't use just bluetoothctl connect 00:XX:XX:XX:XX:XX? It seems to work well too. Did you also discovered that adding bash -c 'echo -e "connect 00:XX:XX:XX:XX:XX \nquit" | bluetoothctl' through Ubuntu's Startup Application adds a second backslash to \nquit, so that it looks like this bash -c 'echo -e "connect 00:XX:XX:XX:XX:XX \\nquit" | bluetoothctl' within the appropriate .desktop file in ~/.config/autostart?
    – DMT
    Aug 8, 2018 at 20:23
  • In my case, trust <> is the key!
    – Vimos
    Jan 5, 2020 at 4:57
  • I can't recall why i did it through bash -c 'echo -e "connect 00:XX:XX:XX:XX:XX \nquit" | bluetoothctl' probably just bluetoothctl connect 00:XX:XX:XX:XX:XX will work as well. I can't verify it now since switched to macos. May 29, 2020 at 11:23
3

Try it again but remove this part name="Microsoft Sculpt Comfort Mouse"

If it's not that then you probably have the wrong OUI.

I believe it's the first half of your bluetooth mouse's address.

OUI stands for Organizational Unique Identifier. Basically the first half of your MAC address says it's made by Microsoft, though mice from the same company may have different OUIs for whatever reason.

For this step start from scratch and lets start the process of elimination.

Uninstall/purge blueman-manager or any extra bluetooth software. Go vanilla and just leave the original Ubuntu bluetooth software to rule out any conflicts.

  1. Press the bluetooth mouse's discovery mode.

  2. Open a terminal and type the command hcitool scan

  3. Then paste the first half of your bluetooth address as the OUI.

Make sure to include the last colon like so oui="xx:xx:xx:"

So if your bluetooth mouse's address is AB:CD:EF:GH:IJ:KL

It would look like this:

<device oui="AB:CD:EF:" type="mouse" name="Microsoft Sculpt Comfort Mouse" pin="0000"/>

Insert that line with the rest of the entries in

/usr/share/gnome-bluetooth/pin-code-database.xml

IMPORTANT: Insert at the beginning of the file, just below the starting <devices> tag - because the entries match in the order of appearance!

I'd restart after this just to make sure everything's in order.

This should solve most reconnection issues because Ubuntu doesn't know or store the PIN # when you pair the first time when it tries to reconnect.

NOTE: In other Linux distros, the path of the file pin-code-database.xml may be different!

1
  • Plus: a simple way by just using the original Ubuntu bluetooth software: remove the bluetooth device if it had been connected, then try to connect the device with modified PIN options using customized PIN code 0000, tested with ThinkPad Bluetooth Laser Mouse Feb 18, 2017 at 5:09
1

I am sure if you are pairing your mouse incorrectly it wont work. I was having the exact same issue. My Microsoft Sculpt Comfort Mouse paired fine and then I left the computer for the day. The screensaver came on and a few hours later I came back to use my computer and my mouse was not working. I probably paired it incorrectly the first time as well. So, I searched through the internet and tried multiple things from the Ubuntu community including removing and repairing my mouse at which point it would not repair. I figured out that I was not actually pairing it correctly each time I paired. The correct steps to pair this mouse that worked are below:

  1. Open Bluetooth manager (should work with any manager, but I used specifically Bluetooth manager)
  2. Press and hold down the pairing button on the bottom of the mouse until you get a solid flashing blue light (slowly flashing about 1 flash per second)
  3. Click search in Bluetooth manager

    • Click the Microsoft Sculpt Comfort Mouse, and then click the key icon (pairing icon)
    • Once the mouse pairs, click the golden star icon within the Bluetooth Manager so the mouse is trusted.
    • Now that the mouse is paired and trusted, click setup, choose input service and then click "forward". When you see "Device added and connected successfully" click close.
1
  • If you're still having the same issue, check out my answer!
    – Tek
    Feb 5, 2015 at 15:29
1

None of the answers listed here worked for me, but I paired the device using the commandline tool bluetoothctl and it reconnected automatically. What I did was:

  • Set the mouse to discoverable
  • run bluetoothctl (list the Mac addess of my mouse)
  • run pair <MAC> (within bluetoothctl which paired the device)
0

I had the same problem with this mouse, and I found the solution using the second approach mentioned here: https://unix.stackexchange.com/questions/177998/bluetooth-mouse-disconnects

In short, create a rule file, namely "99-bluetooth.rules", in "/etc/udev/" and add this line in it:

ACTION=="add", SUBSYSTEM=="bluetooth", ATTR{product}=="Microsoft Bluetooth Mouse        ", ATTR{power/control}="on"

This solved my issue, I hope it helps you too.

0

Confirmed. Using standard bluetooth packages editing the pin-code-database.xml file also enabled the reconnection of a Lenovo Thinkpad Bluetooth Laser mouse after system reboot. Here's the setting I used:

<device oui="F0:65:DD:" type="mouse" name="ThinkPad Bluetooth Laser Mouse" pin="0000"/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .