Module Name:    src
Committed By:   plunky
Date:           Fri Aug 21 10:01:25 UTC 2009

Modified Files:
        src/sys/dev/bluetooth: bthidev.c

Log Message:
I had a complaint that it was difficult to reconnect a device after
system crashes and reboots and I wonder if the reason was that we
were rejecting the connection for some reason. So, notify the console
if that happens.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/bluetooth/bthidev.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/bluetooth/bthidev.c
diff -u src/sys/dev/bluetooth/bthidev.c:1.17 src/sys/dev/bluetooth/bthidev.c:1.18
--- src/sys/dev/bluetooth/bthidev.c:1.17	Tue May 12 12:10:46 2009
+++ src/sys/dev/bluetooth/bthidev.c	Fri Aug 21 10:01:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.c,v 1.17 2009/05/12 12:10:46 cegger Exp $	*/
+/*	$NetBSD: bthidev.c,v 1.18 2009/08/21 10:01:25 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.17 2009/05/12 12:10:46 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.18 2009/08/21 10:01:25 plunky Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -700,12 +700,21 @@
 {
 	struct bthidev_softc *sc = arg;
 
-	if (bdaddr_same(&raddr->bt_bdaddr, &sc->sc_raddr) == 0
-	    || (sc->sc_flags & BTHID_CONNECTING)
+	if (bdaddr_same(&raddr->bt_bdaddr, &sc->sc_raddr) == 0)
+		return NULL;
+
+	if ((sc->sc_flags & BTHID_CONNECTING)
 	    || sc->sc_state != BTHID_WAIT_CTL
 	    || sc->sc_ctl != NULL
-	    || sc->sc_int != NULL)
+	    || sc->sc_int != NULL) {
+		aprint_verbose_dev(sc->sc_dev, "reject ctl newconn %s%s%s%s\n",
+		    (sc->sc_flags & BTHID_CONNECTING) ? " (CONNECTING)" : "",
+		    (sc->sc_state == BTHID_WAIT_CTL) ? " (WAITING)": "",
+		    (sc->sc_ctl != NULL) ? " (GOT CONTROL)" : "",
+		    (sc->sc_int != NULL) ? " (GOT INTERRUPT)" : "");
+
 		return NULL;
+	}
 
 	l2cap_attach(&sc->sc_ctl, &bthidev_ctl_proto, sc);
 	return sc->sc_ctl;
@@ -717,12 +726,21 @@
 {
 	struct bthidev_softc *sc = arg;
 
-	if (bdaddr_same(&raddr->bt_bdaddr, &sc->sc_raddr) == 0
-	    || (sc->sc_flags & BTHID_CONNECTING)
+	if (bdaddr_same(&raddr->bt_bdaddr, &sc->sc_raddr) == 0)
+		return NULL;
+
+	if ((sc->sc_flags & BTHID_CONNECTING)
 	    || sc->sc_state != BTHID_WAIT_INT
 	    || sc->sc_ctl == NULL
-	    || sc->sc_int != NULL)
+	    || sc->sc_int != NULL) {
+		aprint_verbose_dev(sc->sc_dev, "reject int newconn %s%s%s%s\n",
+		    (sc->sc_flags & BTHID_CONNECTING) ? " (CONNECTING)" : "",
+		    (sc->sc_state == BTHID_WAIT_INT) ? " (WAITING)": "",
+		    (sc->sc_ctl == NULL) ? " (NO CONTROL)" : "",
+		    (sc->sc_int != NULL) ? " (GOT INTERRUPT)" : "");
+
 		return NULL;
+	}
 
 	l2cap_attach(&sc->sc_int, &bthidev_int_proto, sc);
 	return sc->sc_int;

Reply via email to