Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jul 2013 15:21:12 GMT
From:      Anil Gulati <anilg@users.sourceforge.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/180722: bluetooth takes 30-50 attempts to pair to keyboard and will not re-connect
Message-ID:  <201307211521.r6LFLCoH006346@oldred.freebsd.org>
Resent-Message-ID: <201307211530.r6LFU05x081334@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         180722
>Category:       kern
>Synopsis:       bluetooth takes 30-50 attempts to pair to keyboard and will not re-connect
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 21 15:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Anil Gulati
>Release:        FreeBSD 9.1-RELEASE
>Organization:
AnilG
>Environment:
FreeBSD engine.local 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243826: Tue Dec  4 06:55:39 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

/boot/loader.conf:
loader_logo="none"
ng_ubt_load="YES" # for Broadcom BCM20702A0 Targus ACB75AU Bluetooth adaptor
ubtbcmfw_load="YES"
sem_load="YES"

/usr/src/sys/modules/netgraph/bluetooth/ubt
patched http://www.freebsd.org/cgi/query-pr.cgi?pr=174707 for FreeBSD 9.1.

/etc/rc.conf:
..
devfs_system_ruleset="localrules"
hcsecd_enable="YES"
sdpd_enable="YES"
bthidd_enable="YES"
..

# kldstat -v | grep bt
4 uhub/ng_ubt
5 uhub/ubtbcmfw
533 ng_btsocket
# kldstat -v | grep l2cap
532 ng_l2cap
# kldstat -v | grep kbd
535 vkbd
467 atkbdc/atkbd

# hccontrol read_node_list
Name    ID       Num hooks
ubt0hci 00000007 3

# hccontrol -n ubt0hci inquiry
Inquiry result, num_responses=1
Inquiry result #0
BD_ADDR: 00:1f:20:75:7c:75
Page Scan Rep. Mode: 0x1
Page Scan Period Mode: 00
Page Scan Mode: 00
Class: 00:25:40
Clock offset: 0x4072
Inquiry complete. Status: No error [00]

# hccontrol -n ubt0hci remote_name_request 00:1f:20:75:7c:75
BD_ADDR: 00:1f:20:75:7c:75
Name: Logitech K810

/etc/bluetooth/hosts:
00:1f:20:75:7c:75 logitech_k810

/etc/bluetooth/hcsecd.conf:
device {
	bdaddr	00:1f:20:75:7c:75;
	name	"logitech_k810";
	key	nokey;
	pin	nopin;
}
device {
	bdaddr	00:00:00:00:00:00;
	name	"default_entry";
	key	nokey;
	pin	nopin;
}

/etc/bluetooth/ubt0.conf:
present but default
i.e. comments only

# bthidcontrol -a 00:1f:20:75:7c:75 query >> /etc/bluetooth/bthidd.conf
/etc/bluetooth/bthidd.conf:
device {
	bdaddr			00:1f:20:75:7c:75;
	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 
	};
}

>Description:
For a first time pair attempt Logitech K810 bluetooth keyboard
takes 30-50 attempts or more before it pairs and keystrokes work.
This takes up to 20 minutes or more to establish pair.

If keyboard paired and connected it is not recognised after reboot.
In order to pair / connect to keyboard again it is necessary to
delete /var/db/hcsecd.keys /var/db/bthidd.hids,
restart services bluetooth, hcsecd and bthidd,
then press the connect button on the keyboard
and then wait for another pair (20 minutes or so).

When keyboard switched off and on again it seems no reconnect happens.
"closed control connection" is logged in messages but nothing after that.
I type on keyboard and press the connect button again but no logging
and no re-connect - keystrokes not recognised.

Problem also experienced by sk8hardiefast on forums.
Description in this thread:
http://forums.freebsd.org/showthread.php?t=39679&page=3

I've configured no pin to simplify.

Pair attempts can be seen progressing in messages:
..
Jul 21 22:49:13 engine kernel: WARNING: attempt to domain_add(bluetooth) after domainfinalize()
Jul 21 22:49:13 engine kernel: WARNING: attempt to domain_add(netgraph) after domainfinalize()
..
Jul 21 22:55:28 engine bthidd[1999]: Got signal 15, total number of signals 1
Jul 21 22:55:28 engine bthidd[2322]: Opening outbound session for 00:1f:20:75:7c:75 (new_device=1, reconnect_initiate=1)
Jul 21 22:55:28 engine kernel: kbd3 at vkbd0
Jul 21 22:55:29 engine bthidd[2322]: Could not connect to 00:1f:20:75:7c:75. Connection reset by peer (54)
Jul 21 22:55:48 engine bthidd[2322]: Opening outbound session for 00:1f:20:75:7c:75 (new_device=1, reconnect_initiate=1)
Jul 21 22:55:48 engine kernel: kbd3 at vkbd1
Jul 21 22:55:51 engine bthidd[2322]: Could not connect to 00:1f:20:75:7c:75. Connection reset by peer (54)
..
Jul 21 23:04:48 engine bthidd[2322]: Opening outbound session for 00:1f:20:75:7c:75 (new_device=1, reconnect_initiate=1)
Jul 21 23:04:48 engine kernel: kbd3 at vkbd28
Jul 21 23:04:49 engine bthidd[2322]: Could not connect to 00:1f:20:75:7c:75. Connection reset by peer (54)
Jul 21 23:05:08 engine bthidd[2322]: Opening outbound session for 00:1f:20:75:7c:75 (new_device=1, reconnect_initiate=1)
Jul 21 23:05:08 engine kernel: kbd3 at vkbd29
Jul 21 23:05:09 engine bthidd[2322]: Could not connect to 00:1f:20:75:7c:75. Connection reset by peer (54)
Jul 21 23:05:28 engine bthidd[2322]: Opening outbound session for 00:1f:20:75:7c:75 (new_device=1, reconnect_initiate=1)
Jul 21 23:05:28 engine kernel: kbd3 at vkbd30
..
Jul 22 01:09:41 engine bthidd[2322]: Remote device 00:1f:20:75:7c:75 has closed control connection

>How-To-Repeat:
Assuming this is not restricted to the Logitech K810 keyboard
I guess the best way to reproduce is get ubt Broadcom Bluetooth adapter
and attempt to connect any bluetooth keyboard.
Note ubt driver is patched (see environment).

>Fix:
Sorry, I don't know how.

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307211521.r6LFLCoH006346>