NetBSD Problem Report #46992

From ryo_on@yk.rim.or.jp  Thu Sep 20 15:27:37 2012
Return-Path: <ryo_on@yk.rim.or.jp>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id C6AC763E3D3
	for <gnats-bugs@gnats.netbsd.org>; Thu, 20 Sep 2012 15:27:36 +0000 (UTC)
Message-Id: <20120920152736.C6AC763E3D3@www.NetBSD.org>
Date: Thu, 20 Sep 2012 15:27:36 +0000 (UTC)
From: ryoon@NetBSD.org
Reply-To: ryoon@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: USB BlueTooth device on Apple MacBook Air 5,1 should be identified as ubt0
X-Send-Pr-Version: 3.95

>Number:         46992
>Category:       kern
>Synopsis:       USB BlueTooth device on Apple MacBook Air 5,1 should be identified as ubt0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 20 15:30:00 +0000 2012
>Closed-Date:    Sun Dec 23 22:02:19 +0000 2012
>Last-Modified:  Sun Dec 23 22:02:19 +0000 2012
>Originator:     Ryo ONODERA
>Release:        NetBSD 6.99.11
>Organization:

>Environment:


System: NetBSD tellurium.elements.tetera.org 6.99.11 NetBSD 6.99.11 (NODKWEDGE) #60: Thu Sep 20 23:50:48 JST 2012 root@tellurium.elements.tetera.org:/usr/obj/sys/arch/amd64/compile/NODKWEDGE amd64
Architecture: x86_64
Machine: amd64
>Description:
USB BlueTooth device on MacBook Air 5,1 (mid 2012) should be identified as
ubt0 at uhub5.
But uaa->class in ubt_match function in sys/dev/usb/ubt.c is
0xff (UDCLASS_VENDOR) instead of correct 0xe0 (UDCLASS_WIRELESS).
My patches forces 0x821f identified as ubt.

% dmesg
(snip)
ugen0 at uhub5 port 3
ugen0: Apple Inc. Bluetooth USB Host Controller, rev 2.00/0.86, addr 7
(snip)

% sudo usbdevs -v|grep -i bluetooth
    port 3 addr 7: full speed, self powered, config 1, Bluetooth USB Host Controller(0x821f), Apple Inc.(0x05ac), rev 0.86


With the attached patches, 0x821f is identified as ubt0 and works fine
with BlueTooth mouse.

% dmesg
(snip)
ubt0 at uhub5 port 3
ubt0: Apple Inc. Bluetooth USB Host Controller, rev 2.00/0.86, addr 7
(snip)





>How-To-Repeat:
Boot NetBSD current on Apple MacBook Air (mid 2012).

>Fix:

Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.626
diff -u -r1.626 usbdevs
--- usbdevs	10 Aug 2012 02:39:32 -0000	1.626
+++ usbdevs	20 Sep 2012 15:15:16 -0000
@@ -831,6 +831,7 @@
 product APPLE IPHONE_3GS	0x1294	iPhone 3GS
 product APPLE IPAD		0x129a	Apple iPad
 product APPLE ETHERNET		0x1402	Apple USB to Ethernet
+product APPLE BLUETOOTH_HOST_C	0x821f	Bluetooth USB Host Controller

 /* ArkMicroChips products */
 product ARKMICROCHIPS USBSERIAL 0x0232	USB-UART Controller
Index: ubt.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ubt.c,v
retrieving revision 1.48
diff -u -r1.48 ubt.c
--- ubt.c	2 Jun 2012 21:36:45 -0000	1.48
+++ ubt.c	20 Sep 2012 15:15:17 -0000
@@ -316,6 +316,16 @@
 	{ USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033NF },
 };

+/*
+ * Some device returns wrong class (UDCLASS_VENDOR).
+ * To force to detect, Add
+ * { VendorID, ProductID }
+ * to the ubt_force_detect list.
+ */
+static const struct usb_devno ubt_force_detect[] = {
+	{ USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HOST_C },
+};
+
 int 
 ubt_match(device_t parent, cfdata_t match, void *aux)
 {
@@ -331,6 +341,9 @@
 	    && uaa->proto == UDPROTO_BLUETOOTH)
 		return UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO;

+	if (usb_lookup(ubt_force_detect, uaa->vendor, uaa->product))
+		return UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO;
+
 	return UMATCH_NONE;
 }



>Release-Note:

>Audit-Trail:
From: Ryo ONODERA <ryo_on@yk.rim.or.jp>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/46992: USB BlueTooth device on Apple MacBook Air 5,1
 should be identified as ubt0
Date: Tue, 02 Oct 2012 00:38:45 +0900 (JST)

 Hi,

 Could anyone review these patches?
 More investigation is needed?

 --
 Ryo ONODERA // ryo_on@yk.rim.or.jp
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/46992: USB BlueTooth device on Apple MacBook Air 5,1 should
 be identified as ubt0
Date: Mon, 1 Oct 2012 17:59:15 +0000

 On Mon, Oct 01, 2012 at 03:40:03PM +0000, Ryo ONODERA wrote:
  >  Hi,
  >  
  >  Could anyone review these patches?
  >  More investigation is needed?

 I would say ask on tech-kern, and if nobody responds there, just commit...

 -- 
 David A. Holland
 dholland@netbsd.org

From: Ryo ONODERA <ryo_on@yk.rim.or.jp>
To: gnats-bugs@NetBSD.org, dholland-bugs@NetBSD.org
Cc: 
Subject: Re: kern/46992: USB BlueTooth device on Apple MacBook Air 5,1
 should be identified as ubt0
Date: Tue, 02 Oct 2012 19:10:28 +0900 (JST)

 From: David Holland <dholland-bugs@NetBSD.org>, Date: Mon,  1 Oct 2012 18:00:24 +0000 (UTC)

 >  I would say ask on tech-kern, and if nobody responds there, just commit...

 I have posted as
 http://mail-index.netbsd.org/tech-kern/2012/10/02/msg014057.html .

 Thank you.

 --
 Ryo ONODERA // ryo_on@yk.rim.or.jp
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


State-Changed-From-To: open->closed
State-Changed-By: ryoon@NetBSD.org
State-Changed-When: Sun, 23 Dec 2012 22:02:19 +0000
State-Changed-Why:
Committed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.