I just got the pairing to work myself in linux... I did the following:
I'm on Linux Mint
First I got the name of the bluetooth device using hcitool inq while the device was discoverable:
$ hcitool inq
Inquiring ...
00:1F:20:3D:7A:4A clock offset: 0x14b4 class: 0x002540
Then I got identified the device:
$ hcitool scan
Scanning ...
00:1F:20:3D:7A:4A Logitech K760
This is the keyboard I was trying to connect. :)
Next I needed the name of the bluetooth adapter as a device:
$ hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: E0:2A:82:02:5D:EF ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN ISCAN
RX bytes:5150 ac1:0 sco:0 events:262 errors:0
TX bytes:1272 ac1:0 sco:0 commands:116 errors:0
Armed with this information, we can now use the simple agent:
$ bluez-simple-agent hci0 00:1F:20:3D:7A:4A
DisplayPasskey (/org/bluez/791/hci0/dev_00_1F_20_3D_7A_4A, 123456)
At this point, you can type the passkey which is the number after the comma in the parenthesis, on the bluetooth keyboard. then hit enter and you'll get:
Release
New Device (/org/bluez/791/hci0/dev_00_1F_20_3D_7A_4A)
Next we need to link up the keyboard to the input system:
hidd --connect 00:1F:20:3D:7A:4A
At this point I realized I made two mistakes: the tool wasn't installed...
$ sudo aptitude install bluez-compat
<all sorts of wonderful stuff you don't need to see here>
... and I didn't run as root:
$ hidd --connect 00:1F:20:3D:7A:4A
HID create error 13 (permission denied)
$ sudo !! # yes if you put this command in
# after failing to run a command that requires elevation,
# it will run as though sudo'ed, the shell subs !! for
# the last command
sudo hidd --connect 00:1F:20:3D:7A:4A
Can't get device information: host is down
At this point, the keyboard had lost "discoverable" status (the blue light wasn't blinking anymore, so I pressed the discover key, then on the old keyboard, hit the up arrow, and enter to repeat the command:
$ sudo hidd --connect 00:1F:20:3D:7A:4A
$ _
The command gives no output if it succeeds, the device is now paired, and ready to use as a keyboard.
Enjoy!
I finally got the fn key working! I had to compile my own kernel module to do so. I think I coulda solved it in an easier way, but here's what I did:
I found this bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/942184
The very first patch posted on that page had my solution: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/942184/+attachment/2788714/+files/alu2011.patch
Then I proceeded to patch and modify my modules following the article and first comment on
http://www.codewhirl.com/2012/04/how-to-compile-a-single-module-in-ubuntu-linux/
I didn't apply the entire patch, only the lines referring to USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI
with ID 0x0255, since this ID was missing in the kernel source I got. I tried this because I noticed the number 0255 in the syslog earlier: generic-bluetooth 0005:05AC:0255.0006: input,hi...
I don't really fully understand how I did it, but it works!
Here's some Xev output, pressing the left arrow key, first with, and then without fn key:
KeyPress event, serial 34, synthetic NO, window 0x3000001,
root 0x15d, subw 0x3000002, time 1502136, (40,28), root:(1235,427),
state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 34, synthetic NO, window 0x3000001,
root 0x15d, subw 0x3000002, time 1502635, (40,28), root:(1235,427),
state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 34, synthetic NO, window 0x3000001,
root 0x15d, subw 0x3000002, time 1504023, (40,28), root:(1235,427),
state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 34, synthetic NO, window 0x3000001,
root 0x15d, subw 0x3000002, time 1504235, (40,28), root:(1235,427),
state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
The Fn key is not registered as a separate key I can have fun xmodmapping with, but this is sufficient for my goals, turning an apple keyboard into a happy-hacking-like by remapping a few keys.
It appears this is all a known bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/911064
Best Answer
Usually, if you'll wait a moment when the MAC shows up, it'll replace it with the device's name.
At least that's how it happens on my system.
Many keyboards and small devices default to '0000' as their PIN, and the system automatically tries that in many cases. Are you sure the keyboard isn't connected? Try it.
EDIT:
I pulled this from another of my answers concerning getting a BT keyboard to pair before login, it might be helpful for you too. I used it a bunch when the BT pairing system in KDE didn't seem to work properly (never would accept PIN... hmmm, sound familiar?) (a later update finally fixed it, now working properly)
From unix.SE: 'how to get my bluetooth keyboard to be recognized before log-in'
I occasionally use the following script to add bluetooth keyboards to my systems, it adds it at a system level, rather than a user level, which seems to make things work right from the boot, and my keyboard(s) are usable from the login prompt.
As written, you'll need bash (v4.0+ hopefully) and the bluez package, which supplies the bluez-simple-agent, bluez-test-device, bluez-test-input programs.
Most of the code below is to implement a list to allow you to choose which device, it really just boils down to the last 6 (non-comment) lines, if you know your BT MAC Address, you can replace all the choice stuff with a static assignment.