summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netbt/hci.h5
-rw-r--r--sys/netbt/hci_event.c15
-rw-r--r--sys/netbt/hci_link.c18
3 files changed, 34 insertions, 4 deletions
diff --git a/sys/netbt/hci.h b/sys/netbt/hci.h
index 581451c5da8..700bceb2e59 100644
--- a/sys/netbt/hci.h
+++ b/sys/netbt/hci.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hci.h,v 1.6 2007/06/01 02:46:11 uwe Exp $ */
+/* $OpenBSD: hci.h,v 1.7 2007/06/19 08:12:34 uwe Exp $ */
/* $NetBSD: hci.h,v 1.10 2007/04/21 06:15:23 plunky Exp $ */
/*-
@@ -55,7 +55,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: hci.h,v 1.6 2007/06/01 02:46:11 uwe Exp $
+ * $Id: hci.h,v 1.7 2007/06/19 08:12:34 uwe Exp $
* $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
*/
@@ -2192,6 +2192,7 @@ void hci_sco_start(struct hci_link *);
void hci_sco_complete(struct hci_link *, int);
struct hci_link *hci_link_alloc(struct hci_unit *);
void hci_link_free(struct hci_link *, int);
+struct hci_link *hci_link_lookup_state(struct hci_unit *, uint16_t, uint16_t);
struct hci_link *hci_link_lookup_bdaddr(struct hci_unit *, bdaddr_t *, uint16_t);
struct hci_link *hci_link_lookup_handle(struct hci_unit *, uint16_t);
diff --git a/sys/netbt/hci_event.c b/sys/netbt/hci_event.c
index f70690d0b75..91973c9e515 100644
--- a/sys/netbt/hci_event.c
+++ b/sys/netbt/hci_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hci_event.c,v 1.4 2007/06/01 03:21:41 uwe Exp $ */
+/* $OpenBSD: hci_event.c,v 1.5 2007/06/19 08:12:35 uwe Exp $ */
/* $NetBSD: hci_event.c,v 1.6 2007/04/21 06:15:23 plunky Exp $ */
/*-
@@ -239,6 +239,7 @@ static void
hci_event_command_status(struct hci_unit *unit, struct mbuf *m)
{
hci_command_status_ep ep;
+ struct hci_link *link;
KASSERT(m->m_pkthdr.len >= sizeof(ep));
m_copydata(m, 0, sizeof(ep), (caddr_t)&ep);
@@ -256,6 +257,17 @@ hci_event_command_status(struct hci_unit *unit, struct mbuf *m)
* post processing of pending commands
*/
switch(letoh16(ep.opcode)) {
+ case HCI_CMD_CREATE_CON:
+ switch (ep.status) {
+ case 0x12: /* Invalid HCI command parameters */
+ DPRINTF("(%s) Invalid HCI command parameters\n",
+ unit->hci_devname);
+ while ((link = hci_link_lookup_state(unit,
+ HCI_LINK_ACL, HCI_LINK_WAIT_CONNECT)) != NULL)
+ hci_link_free(link, ECONNABORTED);
+ break;
+ }
+ break;
default:
break;
}
@@ -480,6 +492,7 @@ hci_event_con_compl(struct hci_unit *unit, struct mbuf *m)
break;
case 0x08: /* "Connection Timed Out" */
+ case 0x10: /* "Connection Accept Timeout Exceeded" */
err = ETIMEDOUT;
break;
diff --git a/sys/netbt/hci_link.c b/sys/netbt/hci_link.c
index a62cc8a3ead..4b3842b99b8 100644
--- a/sys/netbt/hci_link.c
+++ b/sys/netbt/hci_link.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hci_link.c,v 1.3 2007/06/06 18:32:55 uwe Exp $ */
+/* $OpenBSD: hci_link.c,v 1.4 2007/06/19 08:12:35 uwe Exp $ */
/* $NetBSD: hci_link.c,v 1.11 2007/04/21 06:15:23 plunky Exp $ */
/*-
@@ -991,6 +991,22 @@ hci_link_free(struct hci_link *link, int err)
}
/*
+ * Lookup HCI link by type and state.
+ */
+struct hci_link *
+hci_link_lookup_state(struct hci_unit *unit, uint16_t type, uint16_t state)
+{
+ struct hci_link *link;
+
+ TAILQ_FOREACH(link, &unit->hci_links, hl_next) {
+ if (link->hl_type == type && link->hl_state == state)
+ break;
+ }
+
+ return link;
+}
+
+/*
* Lookup HCI link by address and type. Note that for SCO links there may
* be more than one link per address, so we only return links with no
* handle (ie new links)