Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/bluetooth I had a complaint that it was difficult to...



details:   https://anonhg.NetBSD.org/src/rev/05a4bd9939fa
branches:  trunk
changeset: 746846:05a4bd9939fa
user:      plunky <plunky%NetBSD.org@localhost>
date:      Fri Aug 21 10:01:25 2009 +0000

description:
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.

diffstat:

 sys/dev/bluetooth/bthidev.c |  34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diffs (68 lines):

diff -r 9eb8641772b1 -r 05a4bd9939fa sys/dev/bluetooth/bthidev.c
--- a/sys/dev/bluetooth/bthidev.c       Fri Aug 21 09:40:51 2009 +0000
+++ b/sys/dev/bluetooth/bthidev.c       Fri Aug 21 10:01:25 2009 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index