Ubuntu 18.04 Pairing Apple Magic Keyboard 1, says 'paired' but no input from keyboard

Solution 1:

I got the same problem in Feb. 2020, with Ubuntu 18.04 and Apple Magic Bluetooth Wireless Keyboard.

TL;DR: When Apple Magic Keyboard connected, it automatically activates the Num Lock mode. One needs to press / disable the Num Lock key (although there is no such key on the Magic Wireless Keyboard, and that was the trick in my case).

The output of bluetoothctl seemed fine:

Device MY:IP:AD:DR:ES:
    Name: Apple Wireless Keyboard
    Alias: Apple Wireless Keyboard
    Class: 0x00002540
    Icon: input-keyboard
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: yes
    UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    Modalias: usb:v05ACp0255d0050
    RSSI: -52

I was not able to type on Apple keyboard, but I noticed that when I typed letters I got digits m > 0, j > 1, k -> 2 and so on. This seems that Numlock or numpad was activated when the keyboard was connected.

Indeed, check it with the Settings > Region & Language > Input Sources and press the Keyboard icon (small keyboard icon).

I saw that Num Lock was active:

indicator

So, I plugged in another keyboard with a Num Lock key, and pressed the Num Lock on that keyboard. Since then, the Apple Magic Keyboard is working normally.

If anybody knows how to generate a Num Lock key event on the system without pressing the key on another keyboard, the script or command would be helpful.