Subject: Re: btconfig: SIOCSBTFLAGS: Resource temporarily unavailable
To: Berndt Josef Wulf <wulf@ping.net.au>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 07/16/2006 09:27:33
On Sun, 16 Jul 2006, Berndt Josef Wulf wrote:

> /var/log/message:
> Jul 16 16:27:46  /netbsd: hci_usrreq: ATTACH
> Jul 16 16:27:46  /netbsd: hci_usrreq: CONTROL
> Jul 16 16:27:46  /netbsd: hci_ioctl: cmd 0xc0386205
> Jul 16 16:27:46  /netbsd: hci_usrreq: CONTROL
> Jul 16 16:27:46  /netbsd: hci_ioctl: cmd 0xc0386208
> Jul 16 16:27:46  /netbsd: hci_send_cmd: (ubt0) opcode (003|0003)
> Jul 16 16:27:46  /netbsd: hci_event: (ubt0) event COMMAND COMPLETE
> Jul 16 16:27:46  /netbsd: hci_event_command_compl: (ubt0) opcode (003|0003)
> num_cmd_pkts = 1
> Jul 16 16:27:46  /netbsd: hci_send_cmd: (ubt0) opcode (004|0009)
> Jul 16 16:27:46  /netbsd: hci_send_cmd: (ubt0) opcode (004|0005)
> Jul 16 16:27:46  /netbsd: hci_send_cmd: (ubt0) opcode (004|0003)
> Jul 16 16:27:47  /netbsd: ubt_recv_acl_complete: status=CANCELLED (6)
> Jul 16 16:27:47  /netbsd: hci_usrreq: DETACH
>
> Let me know if you want me to do any further testing...

Ok thanks, this is most interesting.. we reset the device on enable
(because I found that after a reboot the controller can still contain
previous state that we have no way of knowing about) and after this, it
does not respond.  I wonder if the Dell 350 module needs some kind of
extra kick start, will investigate..   are there any BIOS options
available to you regarding this module?

In the meantime, you can try the patch below which cuts out the reset and
see if it solves the problem for you?

iain

--- sys/netbt/hci_unit.c.orig	2006-06-19 16:44:45.000000000 +0100
+++ sys/netbt/hci_unit.c	2006-07-16 09:21:21.000000000 +0100
@@ -139,7 +139,15 @@
 	 */
 	unit->hci_flags |= BTF_INIT;

-	err = hci_send_cmd(unit, HCI_CMD_RESET, NULL, 0);
+	err = hci_send_cmd(unit, HCI_CMD_READ_BDADDR, NULL, 0);
+	if (err)
+		goto bad2;
+
+	err = hci_send_cmd(unit, HCI_CMD_READ_BUFFER_SIZE, NULL, 0);
+	if (err)
+		goto bad2;
+
+	err = hci_send_cmd(unit, HCI_CMD_READ_LOCAL_FEATURES, NULL, 0);
 	if (err)
 		goto bad2;