2

I've already taken a look at these posts: How do I get the Apple Wireless Keyboard Working in 10.10? and How do I get the Apple Wireless Keyboard Working in 10.10?, but none seem to resolve the problem I'm facing.

In brief, I am able to connect to the keyboard and the keyboard works just fine. But after I shutdown the system and turn it on again, the keyboard won't be connected to the system anymore.

My guess is that Apple Magic Keyboard 2 thinks it's connected to the system so it's not in pairing mode anymore and hence not receiving any connections, but actually it's not connected. (Maybe ubuntu lost connection ? Maybe when shutting down last night, ubuntu forogt to properly disconnect the keyboard) ?

First when it was not connected (after I turned on the PC), it was listed in bluetooth devices and present in bluetoothctl devices. Also info showed it as paired and trusted, but not connected. I first tried to issue connect MAC_ADDR, but the following was thrown:

bluetoothctl:

Failed to connect: org.bluez.Error.Failed

syslog:

Can't get HIDP connection info
connect error: Host is down (112)

I then tried removing the device and connecting it back again, but after I removed it from bluetoothctl, It's not even detected anymore ! (That's why I guessed the keyboard is not in pairing mode anymore and thinks it's connected)

Do you have any idea how can I get it to work reliably ? I can't waste an hour every day or so after each Off/On of the system.

Thanks !

SpiXel
  • 171
  • For anyone coming to this page trying to connect an Apple magic trackpad, here is an important tip that is not anywhere I've looked: When you do the steps above, DON'T LET GO OF THE BUTTON on the trackpad! It has to be held, occasionally blinking, for the entire set of steps (at least after the remove... until the end). It is not enough to hold it for a step, release, then hold for the next step. This will give partial results, which is confusing, or it will connect and then disconnect immediately. I hope I can save someone else the frustration. Or my future self, when I search for this again – Jeremy Feb 14 '20 at 06:32

1 Answers1

5

Okay, answering my own question here, I seem to have found a way that works, consistently.

Everytime the bluetooth has problems connecting, do the following:

  1. Remove the already paired device from bluetooth UI (select it, and click -, this step is definitely important)
  2. Do the following in a terminal:

    bluetoothctl
    ->power off
    ->power on
    ->scan on // this should find the keyboard in seconds, if It didn't, turn the keyboard off and on again.

    ->trust MAC_ADDR
    ->pair MAC_ADDR
    ->connect MAC_ADDR

This procedure has worked consistently for me. You might be able to remove the devices also from the bluetoothctl's CMD (remove MAC_ADDR), but it didn't work for me once and I found removing from the UI more consistent.

Hope this helps someone.

SpiXel
  • 171
  • 1
    Hi @SpiXel, I'm contemplating buying this keyboard, but every bluetooth keyboard I've tried has ultimately proved to be a lemon, i..e, the bluetooth connection becomes erratic for no apparent reason. Has the connection remained ok for you? Also, I presume there's a way to put all of those bluetoothctl into a script? Finally, I called Apple about the keyboard, and the tier 1 person (didn't sound at all knowledgeable) said the keyboard would only work on Apple. Presumably, she didn't know what she was talking about? – Leo Simon Mar 24 '17 at 15:56
  • 1
    @LeoSimon well the connection was nearly stable (some delays could be seen sometimes, but negligible). But in many cases the keyboard lost it's paired status with the laptop and I had to redo all these steps. All in all it was a pain and I ended up ditching the apple keyboard for a logitech one with wireless dongle. – SpiXel Mar 29 '17 at 09:03
  • 1
    what a pain, thanks for the information. I'm trying to avoid dongles because they are so easily lost, lose connections, etc. One would hope that eventually somebody would be able build a workable dongleless bluetooth keyboard, surely not rocket science. – Leo Simon Mar 29 '17 at 13:18