Logitech k810 Bluetooth keyboard (updated 5/11/2014)

I get exactly this:
Code:
[ember@Unix /usr/home/ember]$ hccontrol -n ubt0hci inquiry
Inquiry complete. Status: No error [00]
[ember@Unix /usr/home/ember]$
and
Code:
[ember@Unix /usr/home/ember]$ sudo service bluetooth start ubt0
Password:
/etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0
[ember@Unix /usr/home/ember]$ sudo service bluetooth start ubt0
[ember@Unix /usr/home/ember]$

Works with the second try all the time. My keyboard is on.
 
Add your device to /etc/bluetooth/hosts
Code:
BD_ADDR      lg-kbd

Add an entry to the /etc/bluetooth/hcsecd.conf file:
Code:
device {
        bdaddr  BD_ADDR;
        name    "lg-kbd";
        key     nokey;
        pin     "1234";
}

Edit /etc/bluetooth/ubt0.conf
Code:
authentication_enable="NO"
connectable="YES"
discoverable="YES"
hci_debug_level="4"
l2cap_debug_level="4"
local_name="lg"
role_switch="YES"

# service bluetooth restart ubt0
# service hcsecd restart

Note that BD_ADDR in the output are 6 hexadecimal bytes separated by colons.
 
I made it without success. On boot I get tons of errors:
Code:
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
kbd3 at vkbd7
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=4
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=12
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=4
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=4
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=4
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=4
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=4
ng_l2cap_lower_rcvmsg: ubt0l2cap - HCI node is up, bdaddr: 0:2:72:32:f1:29, pkt_size=1021 bytes, num_pkts=8
kbd3 at vkbd8
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
kbd3 at vkbd9
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
kbd3 at vkbd10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
kbd3 at vkbd11
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
kbd3 at vkbd12
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
kbd3 at vkbd13
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=4
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
ng_hci_process_event: ubt0hci - got HCI event=0x4, length=10
ng_hci_process_event: ubt0hci - got HCI event=0xf, length=4
ng_hci_process_event: ubt0hci - got HCI event=0x12, length=8
ng_hci_process_event: ubt0hci - got HCI event=0x3, length=11
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=6
ng_hci_process_event: ubt0hci - got HCI event=0x17, length=6
ng_hci_process_event: ubt0hci - got HCI event=0xe, length=10
ng_hci_process_event: ubt0hci - got HCI event=0x5, length=4
ng_l2cap_con_fail: ubt0l2cap - ACL connection failed, result=19
ng_hci_lp_discon_ind: ubt0hci - SCO hook is not connected or not valid, hook=0
 
Comment this lines in /etc/bluetooth/ubt0.conf to hide those messages.
Code:
hci_debug_level="4"
l2cap_debug_level="4"
 
The problem is that you don't have configured bthidd.conf

To figure out the name of the bluetooth HCI node, running:
# hccontrol read_node_list

The node name will be something like 'ubt0hci', replace HCI_NODE_name below with this name.
# hccontrol -n HCI_NODE_name inquiry

If fails again try running # hccontrol -n HCI_NODE_name read_BD_ADDR

You need to register the device with bthidd(8)()
# bthidcontrol -a BD_ADDR query >> /etc/bluetooth/bthidd.conf

Modify too the BD_ADDR in the following files:
/etc/bluetooth/hosts
/etc/bluetooth/hcsecd.conf
 
Here is the problem. hccontrol read_node_list returns
Code:
Name            ID       Num hooks
ubt0hci         00000033         3
so I run hccontrol -n ubt0hci inquiry and this returns
Code:
Inquiry complete. Status: No error [00]

Finally I tried hccontrol -n HCINODE Read_BD_ADDR and the result was
Code:
Could not execute command "Read_BD_ADDR". Operation timed out

It doesn't return the BD_ADDR
 
Running command as root. As user I get Permission denied
Code:
[CMD]bthidcontrol -a 00:02:72:32:f1:29 query >> /etc/bluetooth/bthidd.conf[/CMD]
Could not perform SDP query on the device 00:02:72:32:f1:29. No route to host (65)
 
Code:
[ember@Unix /etc/bluetooth]$ sudo bthidcontrol -a 00:02:72:32:f1:29 query >> /etc/bluetooth/bthidd.conf
bash: /etc/bluetooth/bthidd.conf: Permission denied
and
Code:
[ember@Unix /etc/bluetooth]$ su root
Password:
You have mail.
root@Unix:/etc/bluetooth # bthidcontrol -a 00:02:72:32:f1:29 query >> /etc/bluetooth/bthidd.conf
Could not perform SDP query on the device 00:02:72:32:f1:29. No route to host (65)
root@Unix:/etc/bluetooth #
Tried both. How must I write? Just open the file and add the line. I have already changed both hosts and hcsecd.conf

hosts
Code:
00:02:72:32:f1:29 lg-kbd
and
hcsecd.conf
Code:
device {
        bdaddr  00:02:72:32:f1:29;
        name    "lg-kbd";
        key     nokey;
        pin     "1234";
}
 
If it shows the following error message
Code:
Could not perform SDP query on the device 00:02:72:32:f1:29. No route to host (65)
this is because stack was not set properly and as far as system concerns you don't have active bluetooth devices. Let's ignore for now bthidd.conf because need be debugged with hcidump(1).

Restart bluetooth, hcsecd and sdpd:

# service bluetooth restart ubt0
# service hcsecd restart
# service sdpd restart
# service bthidd restart
 
Code:
[ember@Unix ~]$ sudo service bluetooth restart ubt0
Password:
[ember@Unix ~]$ sudo service hcsecd restart
Stopping hcsecd.
Waiting for PIDS: 4194.
Starting hcsecd.
[ember@Unix ~]$ sudo service sdpd restart
Stopping sdpd.
Starting sdpd.
[ember@Unix ~]$
Ok. Done! No errors
 
Code:
sudo bthidcontrol -a lg-kbd Query
Could not perform SDP query on the device 00:02:72:32:f1:29. No route to host (65)
and
Code:
[ember@Unix /usr/ports/comms/hcidump]$ sudo hcidump -x
HCIDump - HCI packet analyzer ver 1.5
device: any snap_len: 65535 filter: 0xffffffffffffffff
< HCI Command: Create Connection(0x01|0x0005) plen 13
  84 68 E5 F2 50 00 18 CC 00 00 00 00 01 
> HCI Event: Command Status(0x0f) plen 4
  00 01 05 04 
> HCI Event: Connect Complete(0x03) plen 11
  04 0C 00 84 68 E5 F2 50 00 01 00 
< HCI Command: Create Connection(0x01|0x0005) plen 13
  E1 FB E3 F2 50 00 18 CC 00 00 00 00 01 
> HCI Event: Command Status(0x0f) plen 4
  00 01 05 04 
> HCI Event: Connect Complete(0x03) plen 11
  04 0C 00 E1 FB E3 F2 50 00 01 00 
< HCI Command: Create Connection(0x01|0x0005) plen 13
  84 68 E5 F2 50 00 18 CC 00 00 00 00 01 
> HCI Event: Command Status(0x0f) plen 4
  00 01 05 04 
> HCI Event: Connect Complete(0x03) plen 11
  04 0C 00 84 68 E5 F2 50 00 01 00 
< HCI Command: Create Connection(0x01|0x0005) plen 13
  E1 FB E3 F2 50 00 18 CC 00 00 00 00 01 
> HCI Event: Command Status(0x0f) plen 4
  00 01 05 04
 
@cpu82, do we have any news? I really love this keyboard but I hate that it works on Mac, Xoom, iPhone, but not on my FreeBSD. I still hope.
 
Last edited by a moderator:
Good morning @cpu82. Here in Greece is 9:30 in the morning, I just woke up and I drink coffee :D First of all, I spoke with the developer. I didn't make it but was not his mistake. I had no Xserver and I tried to troubleshot the keyboard, using the same keyboard and sending mail with him on tablet. But I have a big progress. Here is all we made:
/etc/rc.conf
Code:
hcsecd_enable="YES"
sdpd_enable="YES"
bthidd_enable="YES"

kldstat
Code:
Id Refs Address            Size     Name
 1   52 0xffffffff80200000 1323408  kernel
 2    1 0xffffffff81524000 29e0     coretemp.ko
 3    1 0xffffffff81527000 70b8     acpi_video.ko
 4    1 0xffffffff8152f000 c824e0   nvidia.ko
 5    3 0xffffffff821b2000 484f8    linux.ko
 6    3 0xffffffff821fb000 59a80    vboxdrv.ko
 7    1 0xffffffff82255000 6668     sem.ko
 8    1 0xffffffff8225c000 8538     ng_ubt.ko
 9    8 0xffffffff82265000 15330    netgraph.ko
10    2 0xffffffff8227b000 13278    ng_hci.ko
11    4 0xffffffff8228f000 2f98     ng_bluetooth.ko
12    1 0xffffffff82292000 16538    ng_l2cap.ko
13    1 0xffffffff82412000 3dff     linprocfs.ko
14    1 0xffffffff82416000 697e     if_lagg.ko
15    1 0xffffffff8241d000 1695e    ng_btsocket.ko
16    1 0xffffffff82434000 1e29     ng_socket.ko
17    2 0xffffffff82436000 2951     vboxnetflt.ko
18    1 0xffffffff82439000 1579     ng_ether.ko
19    1 0xffffffff8243b000 3fea     vboxnetadp.ko
20    1 0xffffffff8243f000 4fb9     vkbd.ko
21    1 0xffffffff82444000 a9bb     fuse.ko

hccontrol inquiry
Code:
Inquiry result, num_responses=1
Inquiry result #0
	BD_ADDR: lg-kbd
	Page Scan Rep. Mode: 0x1
	Page Scan Period Mode: 00
	Page Scan Mode: 00
	Class: 00:25:40
	Clock offset: 0x5d4a
Inquiry complete. Status: No error [00]

/etc/bluetooth/hosts
Code:
hcsecd.conf       hcsecd.conf_back  hosts             
[ember@Unix ~]$ more /etc/bluetooth/hosts 
# $Id: hosts,v 1.1 2003/05/21 17:48:40 max Exp $
# $FreeBSD: release/9.1.0/etc/bluetooth/hosts 152286 2005-11-10 19:09:22Z emax $
#
# Bluetooth Host Database
#
# This file should contain the Bluetooth addresses and aliases for hosts.
#
# BD_ADDR               Name [ alias0 alias1 ... ]

# 00:11:22:33:44:55     phone

00:1f:20:4d:f2:c5 lg-kbd

/etc/bluetooth/hcsecd.conf
Code:
# $Id: hcsecd.conf,v 1.1 2003/05/26 22:50:47 max Exp $
# $FreeBSD: release/9.1.0/etc/bluetooth/hcsecd.conf 158726 2006-05-18 17:53:49Z emax $
#
# HCI security daemon configuration file
#
# Format:
#
# device {
#       option  value ;
# }
#
# Possible options and values
#
# Options       Values
# ----------------------------------
# bdaddr        xx:xx:xx:xx:xx:xx ;     - remote device BD_ADDR
# name          "any char" ;            - to set user friendly device name
# key           0x11223344 | nokey ;    - to set link key for the device
# pin           "secret" | nopin ;      - to PIN code for the device
#
# Notes:
#
#       Currently there is no way to select keys/PIN code based on which
#       local device received the request. Everything is based on remote
#       device BD_ADDR.
#
#       "nokey" means that no link key has been defined and we should
#               send Link_Key_Negative_Reply command to the device.
#
#       "nopin" means that no PIN code has been defined and we should
#               send PIN_Code_Negative_Reply command to the device
#

# Default entry is applied if no better match found
# It MUST have 00:00:00:00:00:00 as bdaddr
device {
        bdaddr  00:1f:20:4d:f2:c5;
        name    "lg-kbd";
        key     nokey;
        pin     "1234";
}

/etc/bluetooth/bthidd.conf
Code:
# $FreeBSD: release/9.1.0/usr.sbin/bluetooth/bthidd/bthidd.conf.sample 162128 2006-09-07 21:47:49Z emax $

bthidcontrol -a 00:1f:20:4d:f2:c5 Query
device {
	bdaddr			00:1f:20:4d:f2:c5;
	control_psm		0x11;
	interrupt_psm		0x13;
	reconnect_initiate	true;
	battery_power		true;
	normally_connectable	true;
	hid_descriptor		{
		0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01 
		0x75 0x01 0x95 0x08 0x05 0x07 0x19 0xe0 
		0x29 0xe7 0x15 0x00 0x25 0x01 0x81 0x02 
		0x95 0x01 0x75 0x08 0x81 0x03 0x95 0x05 
		0x75 0x01 0x05 0x08 0x19 0x01 0x29 0x05 
		0x91 0x02 0x95 0x01 0x75 0x03 0x91 0x03 
		0x95 0x06 0x75 0x08 0x15 0x00 0x26 0xff 
		0x00 0x05 0x07 0x19 0x00 0x29 0xff 0x81 
		0x00 0xc0 0x05 0x0c 0x09 0x01 0xa1 0x01 
		0x85 0x02 0x15 0x00 0x25 0x01 0x75 0x01 
		0x95 0x14 0x0a 0x94 0x01 0x0a 0x92 0x01 
		0x0a 0x83 0x01 0x0a 0x23 0x02 0x0a 0x8a 
		0x01 0x0a 0x82 0x01 0x0a 0x21 0x02 0x0a 
		0x30 0x00 0x0a 0x25 0x02 0x0a 0x23 0x02 
		0x0a 0x27 0x02 0x09 0xb6 0x09 0xb5 0x09 
		0xb8 0x09 0xcd 0x09 0xe9 0x09 0xea 0x09 
		0xe2 0x0a 0x24 0x02 0x09 0x30 0x81 0x02 
		0x95 0x01 0x75 0x04 0x81 0x03 0xc0 0x05 
		0x0c 0x09 0x01 0xa1 0x01 0x85 0x03 0x05 
		0x01 0x09 0x06 0xa1 0x02 0x05 0x06 0x09 
		0x20 0x15 0x00 0x26 0x14 0x00 0x75 0x08 
		0x95 0x01 0x81 0x02 0xc0 0xc0 0x05 0x01 
		0x09 0x80 0xa1 0x01 0x85 0x04 0x15 0x00 
		0x25 0x01 0x75 0x01 0x95 0x02 0x09 0x81 
		0x09 0x82 0x81 0x02 0x95 0x01 0x75 0x06 
		0x81 0x03 0xc0 0x05 0x0c 0x09 0x01 0xa1 
		0x01 0x85 0x05 0x05 0x01 0x09 0x06 0xa1 
		0x02 0x06 0x00 0xff 0x25 0x01 0x75 0x01 
		0x95 0x02 0x0a 0x03 0xfe 0x0a 0x04 0xfe 
		0x81 0x02 0x95 0x06 0x81 0x03 0xc0 0xc0 
		0x05 0x0c 0x09 0x01 0xa1 0x01 0x85 0xff 
		0x05 0x06 0x95 0x01 0x75 0x02 0x19 0x24 
		0x29 0x26 0x81 0x02 0x75 0x06 0x81 0x01 
		0xc0 0x06 0x00 0xff 0x09 0x01 0xa1 0x01 
		0x85 0x10 0x75 0x08 0x95 0x06 0x15 0x00 
		0x26 0xff 0x00 0x09 0x01 0x81 0x00 0x09 
		0x01 0x91 0x00 0xc0 0x06 0x00 0xff 0x09 
		0x02 0xa1 0x01 0x85 0x11 0x75 0x08 0x95 
		0x13 0x15 0x00 0x26 0xff 0x00 0x09 0x02 
		0x81 0x00 0x09 0x02 0x91 0x00 0xc0 
	};
}

bthidcontrol Known
Code:
00:1f:20:4d:f2:c5 lg-kbd

hcidump -x
Code:
HCIDump - HCI packet analyzer ver 1.5
device: any snap_len: 65535 filter: 0xffffffffffffffff
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0C 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0C 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0C 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0C 00 13

Is pairing incomplete? I have no pin request on hcidup
 
Last edited by a moderator:
This look good ;)

Add this line in /boot/loader.conf
Code:
vkbd_load="YES"

Be sure you've added in /etc/rc.conf
Code:
devd_enable="YES"
hcsecd_enable="YES"
sdpd_enable="YES"
bthidd_enable="YES"
bthidd_config="/etc/bluetooth/bthidd.conf"
bthidd_hids="/var/db/bthidd.hids"

To pairing your BT device: turn on your keyboard (set discoverable), enter the PIN, then press ENTER. If it doesn't work the first time, try again.
 
Ok. I made it except the last one. The developer told me to remove /var/db/bthidd.hids
This is my hcidump -x now:

Code:
HCIDump - HCI packet analyzer ver 1.5
device: any snap_len: 65535 filter: 0xffffffffffffffff
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0C 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0C 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0C 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0C 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0B 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0B 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0B 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0B 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0C 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0C 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0C 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0C 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0B 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0B 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0B 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0B 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0C 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0C 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0C 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0C 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0B 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0B 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0B 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0B 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0C 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0C 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0C 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0C 00 13 
> HCI Event: Connect Request(0x04) plen 10
  C5 F2 4D 20 1F 00 40 05 00 01 
< HCI Command: Accept Connection Request(0x01|0x0009) plen 7
  C5 F2 4D 20 1F 00 00 
> HCI Event: Command Status(0x0f) plen 4
  00 01 09 04 
> HCI Event: Role Change(0x12) plen 8
  00 C5 F2 4D 20 1F 00 00 
> HCI Event: Connect Complete(0x03) plen 11
  00 0B 00 C5 F2 4D 20 1F 00 01 00 
< HCI Command: Write Link Policy Settings(0x02|0x000d) plen 4
  0B 00 05 00 
> HCI Event: Command Complete(0x0e) plen 6
  01 0D 08 00 0B 00 
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
> HCI Event: Command Complete(0x0e) plen 10
  01 0C 04 00 C5 F2 4D 20 1F 00 
> HCI Event: Disconn Complete(0x05) plen 4
  00 0B 00 13

No pin request. This is the only think that I don't love on FreeBSD. You must die before some things going to work.
 
As stated in the bluetooth specification document, the Link Key Request Negative Reply command is used to reply to a Link Key Request event from the controller if the host does not have a stored Link Key for the connection with the other Bluetooth device specified by BD_ADDR.
Code:
<snip>
> HCI Event: Link Key Request(0x17) plen 6
  C5 F2 4D 20 1F 00 
< HCI Command: Link Key Request Negative Reply(0x01|0x000c) plen 6
  C5 F2 4D 20 1F 00 
<snip>

In order to perform authentication: if there is a match in the database, the key will be returned in the Link Key Request Reply command. In case there is no match in the database, the Link Key Request Negative Reply will be sent.

Try the following:
Code:
# service hcsecd stop
# rm /var/db/hcsecd.keys
# service hcsecd start
 
Back
Top