diff options
| author | plunky <plunky@NetBSD.org> | 2009-08-21 10:01:25 +0000 |
|---|---|---|
| committer | plunky <plunky@NetBSD.org> | 2009-08-21 10:01:25 +0000 |
| commit | d97471da968998c990fcc7c57bec49e61e45e5ec (patch) | |
| tree | c213168dbdcdfc915350630636448b35db3c44e7 /sys/dev/bluetooth | |
| parent | b1aca4e8f529360162e602c8c7408d4e2cff3189 (diff) | |
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 (limited to 'sys/dev/bluetooth')
| -rw-r--r-- | sys/dev/bluetooth/bthidev.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/sys/dev/bluetooth/bthidev.c b/sys/dev/bluetooth/bthidev.c index be6c3a05306..929e5137a98 100644 --- a/sys/dev/bluetooth/bthidev.c +++ b/sys/dev/bluetooth/bthidev.c @@ -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 @@ bthidev_ctl_newconn(void *arg, struct sockaddr_bt *laddr, { 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 @@ bthidev_int_newconn(void *arg, struct sockaddr_bt *laddr, { 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; |
