Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/bluetooth increase some diagnostics



details:   https://anonhg.NetBSD.org/src/rev/a26a48c9b422
branches:  trunk
changeset: 783427:a26a48c9b422
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Dec 20 11:17:47 2012 +0000

description:
increase some diagnostics

diffstat:

 sys/dev/bluetooth/bthidev.c |  18 +++++++++++-------
 sys/dev/bluetooth/btmagic.c |  17 +++++++++++------
 2 files changed, 22 insertions(+), 13 deletions(-)

diffs (135 lines):

diff -r b27693cf2f5b -r a26a48c9b422 sys/dev/bluetooth/bthidev.c
--- a/sys/dev/bluetooth/bthidev.c       Thu Dec 20 11:13:53 2012 +0000
+++ b/sys/dev/bluetooth/bthidev.c       Thu Dec 20 11:17:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bthidev.c,v 1.23 2012/12/20 11:13:53 plunky Exp $      */
+/*     $NetBSD: bthidev.c,v 1.24 2012/12/20 11:17:47 plunky Exp $      */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.23 2012/12/20 11:13:53 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.24 2012/12/20 11:17:47 plunky Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -193,6 +193,7 @@
        int locs[BTHIDBUSCF_NLOCS];
        int maxid, rep, dlen;
        int vendor, product;
+       int err;
 
        /*
         * Init softc
@@ -337,8 +338,9 @@
         * start bluetooth connections
         */
        mutex_enter(bt_lock);
-       if ((sc->sc_flags & BTHID_RECONNECT) == 0)
-               bthidev_listen(sc);
+       if ((sc->sc_flags & BTHID_RECONNECT) == 0
+           && (err = bthidev_listen(sc)) != 0)
+               aprint_error_dev(self, "failed to listen (%d)\n", err);
 
        if (sc->sc_flags & BTHID_CONNECTING)
                bthidev_connect(sc);
@@ -561,8 +563,10 @@
        }
 
        err = l2cap_setopt(sc->sc_ctl, &sc->sc_mode);
-       if (err)
+       if (err) {
+               aprint_error_dev(sc->sc_dev, "l2cap_setopt failed (%d)\n", err);
                return err;
+       }
 
        bdaddr_copy(&sa.bt_bdaddr, &sc->sc_laddr);
        err = l2cap_bind(sc->sc_ctl, &sa);
@@ -802,7 +806,7 @@
        sc->sc_state = BTHID_CLOSED;
 
        if (sc->sc_int == NULL) {
-               aprint_normal_dev(sc->sc_dev, "disconnected\n");
+               aprint_normal_dev(sc->sc_dev, "disconnected (%d)\n", err);
                sc->sc_flags &= ~BTHID_CONNECTING;
 
                if (sc->sc_flags & BTHID_RECONNECT)
@@ -834,7 +838,7 @@
        sc->sc_state = BTHID_CLOSED;
 
        if (sc->sc_ctl == NULL) {
-               aprint_normal_dev(sc->sc_dev, "disconnected\n");
+               aprint_normal_dev(sc->sc_dev, "disconnected (%d)\n", err);
                sc->sc_flags &= ~BTHID_CONNECTING;
 
                if (sc->sc_flags & BTHID_RECONNECT)
diff -r b27693cf2f5b -r a26a48c9b422 sys/dev/bluetooth/btmagic.c
--- a/sys/dev/bluetooth/btmagic.c       Thu Dec 20 11:13:53 2012 +0000
+++ b/sys/dev/bluetooth/btmagic.c       Thu Dec 20 11:17:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btmagic.c,v 1.4 2012/12/20 11:13:53 plunky Exp $       */
+/*     $NetBSD: btmagic.c,v 1.5 2012/12/20 11:17:47 plunky Exp $       */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.4 2012/12/20 11:13:53 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.5 2012/12/20 11:17:47 plunky Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -272,6 +272,7 @@
        struct wsmousedev_attach_args wsma;
        const struct sysctlnode *node;
        prop_object_t obj;
+       int err;
 
        /*
         * Init softc
@@ -392,7 +393,8 @@
         * start bluetooth connections
         */
        mutex_enter(bt_lock);
-       btmagic_listen(sc);
+       if ((err = btmagic_listen(sc)) != 0)
+               aprint_error_dev(self, "failed to listen (%d)\n", err);
        btmagic_connect(sc);
        mutex_exit(bt_lock);
 }
@@ -533,8 +535,11 @@
        }
 
        err = l2cap_setopt(sc->sc_ctl, &sc->sc_mode);
-       if (err)
+       if (err) {
+               printf("%s: l2cap_setopt failed (%d)\n",
+                   device_xname(sc->sc_dev), err);
                return err;
+       }
 
        bdaddr_copy(&sa.bt_bdaddr, &sc->sc_laddr);
        err = l2cap_bind(sc->sc_ctl, &sa);
@@ -885,7 +890,7 @@
        }
 
        if (sc->sc_int == NULL) {
-               printf("%s: disconnected\n", device_xname(sc->sc_dev));
+               printf("%s: disconnected (%d)\n", device_xname(sc->sc_dev), err);
                CLR(sc->sc_flags, BTMAGIC_CONNECTING);
                sc->sc_state = BTMAGIC_WAIT_CTL;
        } else {
@@ -911,7 +916,7 @@
        }
 
        if (sc->sc_ctl == NULL) {
-               printf("%s: disconnected\n", device_xname(sc->sc_dev));
+               printf("%s: disconnected (%d)\n", device_xname(sc->sc_dev), err);
                CLR(sc->sc_flags, BTMAGIC_CONNECTING);
                sc->sc_state = BTMAGIC_WAIT_CTL;
        } else {



Home | Main Index | Thread Index | Old Index