Source-Changes-HG archive

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

[src/netbsd-6]: src Pull up following revision(s) (requested by plunky in tic...



details:   https://anonhg.NetBSD.org/src/rev/da90ec561331
branches:  netbsd-6
changeset: 775610:da90ec561331
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Jan 07 04:15:12 2013 +0000

description:
Pull up following revision(s) (requested by plunky in ticket #769):
        sys/dev/bluetooth/bthidev.c: revision 1.23
        sys/dev/bluetooth/bthidev.c: revision 1.24
        usr.sbin/btdevctl/btdevctl.8: revision 1.8
        sys/dev/bluetooth/btmagic.c: revision 1.4
        sys/dev/bluetooth/btmagic.c: revision 1.5
when no link-mode is specified, explicitly set a mode of (int)0
otherwise l2cap_setmode() will fail during connection setup
for bthidev.c, this fixes a problem with Microsoft Wedge Touch
mouse (which may not be able to authenticate)
for btmagic.c, include this fix in case somebody tries that
related to PR/47286
increase some diagnostics
add a comment pointing out that the link-mode may need to be
changed manually, for devices which cannot authenticate
for PR/47286

diffstat:

 sys/dev/bluetooth/bthidev.c  |  21 +++++++++++++--------
 sys/dev/bluetooth/btmagic.c  |  20 +++++++++++++-------
 usr.sbin/btdevctl/btdevctl.8 |   8 +++++---
 3 files changed, 31 insertions(+), 18 deletions(-)

diffs (191 lines):

diff -r ff211784ad0c -r da90ec561331 sys/dev/bluetooth/bthidev.c
--- a/sys/dev/bluetooth/bthidev.c       Sat Jan 05 23:38:02 2013 +0000
+++ b/sys/dev/bluetooth/bthidev.c       Mon Jan 07 04:15:12 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bthidev.c,v 1.21.2.1 2012/04/03 17:31:19 riz Exp $     */
+/*     $NetBSD: bthidev.c,v 1.21.2.2 2013/01/07 04:15:12 riz Exp $     */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.21.2.1 2012/04/03 17:31:19 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.21.2.2 2013/01/07 04:15:12 riz 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
@@ -241,7 +242,8 @@
 
                aprint_verbose(" %s %s", BTDEVmode,
                                         prop_string_cstring_nocopy(obj));
-       }
+       } else
+               sockopt_setint(&sc->sc_mode, 0);
 
        obj = prop_dictionary_get(dict, BTHIDEVcontrolpsm);
        if (prop_object_type(obj) == PROP_TYPE_NUMBER) {
@@ -336,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);
@@ -560,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);
@@ -801,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)
@@ -833,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 ff211784ad0c -r da90ec561331 sys/dev/bluetooth/btmagic.c
--- a/sys/dev/bluetooth/btmagic.c       Sat Jan 05 23:38:02 2013 +0000
+++ b/sys/dev/bluetooth/btmagic.c       Mon Jan 07 04:15:12 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btmagic.c,v 1.1.22.1 2012/04/03 17:31:20 riz Exp $     */
+/*     $NetBSD: btmagic.c,v 1.1.22.2 2013/01/07 04:15:12 riz Exp $     */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.1.22.1 2012/04/03 17:31:20 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.1.22.2 2013/01/07 04:15:12 riz 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
@@ -306,7 +307,8 @@
 
                aprint_verbose(" %s %s", BTDEVmode,
                    prop_string_cstring_nocopy(obj));
-       }
+       } else
+               sockopt_setint(&sc->sc_mode, 0);
 
        aprint_normal(": 3 buttons, W and Z dirs\n");
        aprint_naive("\n");
@@ -391,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);
 }
@@ -532,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);
@@ -884,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 {
@@ -910,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 {
diff -r ff211784ad0c -r da90ec561331 usr.sbin/btdevctl/btdevctl.8
--- a/usr.sbin/btdevctl/btdevctl.8      Sat Jan 05 23:38:02 2013 +0000
+++ b/usr.sbin/btdevctl/btdevctl.8      Mon Jan 07 04:15:12 2013 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: btdevctl.8,v 1.7 2010/10/12 21:49:08 wiz Exp $
+.\" $NetBSD: btdevctl.8,v 1.7.8.1 2013/01/07 04:15:12 riz Exp $
 .\"
 .\" Copyright (c) 2006 Itronix Inc.
 .\" All rights reserved.
@@ -51,7 +51,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 11, 2010
+.Dd December 26, 2012
 .Dt BTDEVCTL 8
 .Os
 .Sh NAME
@@ -101,7 +101,7 @@
 Connection link mode.
 The following modes are supported:
 .Pp
-.Bl -tag -compact
+.Bl -tag -width encrypt -compact
 .It none
 clear previously set mode.
 .It auth
@@ -120,6 +120,8 @@
 by default, or
 .Sq encrypt
 for keyboard devices.
+If the device cannot handle authentication, then the mode will need
+to be cleared manually.
 .It Fl q
 Ignore any cached data and perform a SDP query for the given
 .Ar service .



Home | Main Index | Thread Index | Old Index