aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-11-30 06:17:26 -0500
committerMarcel Holtmann <marcel@holtmann.org>2008-11-30 06:17:26 -0500
commit7a9d4020533b5c0c615b6de3be154c9ff30b8cc9 (patch)
tree7d2957eb96f87f9ba8fcaf8c28aa7f4e93740fb6
parent12421b40b81d101d7535e03f1af197365adc932b (diff)
Bluetooth: Send HCI Reset command by default on device initialization
The Bluetooth subsystem was not using the HCI Reset command when doing device initialization. The Bluetooth 1.0b specification was ambiguous on how the device firmware was suppose to handle it. Almost every device was triggering a transport reset at the same time. In case of USB this ended up in disconnects from the bus. All modern Bluetooth dongles handle this perfectly fine and a lot of them actually require that HCI Reset is sent. If not then they are either stuck in their HID Proxy mode or their internal structures for inquiry and paging are not correctly setup. To handle old and new devices smoothly the Bluetooth subsystem contains a quirk to force the HCI Reset on initialization. However maintaining such a quirk becomes more and more complicated. This patch turns the logic around and lets the old devices disable the HCI Reset command. The only device where the HCI_QUIRK_NO_RESET is still needed are the original Digianswer devices and dongles with an early CSR firmware. CSR reported that they fixed this for version 12 firmware. The last official release of version 11 firmware is build ID 115. The first version 12 candidate was build ID 117. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--drivers/bluetooth/bpa10x.c2
-rw-r--r--drivers/bluetooth/btusb.c99
-rw-r--r--drivers/bluetooth/hci_ldisc.c4
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--net/bluetooth/af_bluetooth.c2
-rw-r--r--net/bluetooth/hci_core.c2
6 files changed, 54 insertions, 57 deletions
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index b936d8ce2728..4f0a57236d23 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -489,6 +489,8 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
489 489
490 hdev->owner = THIS_MODULE; 490 hdev->owner = THIS_MODULE;
491 491
492 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
493
492 err = hci_register_dev(hdev); 494 err = hci_register_dev(hdev);
493 if (err < 0) { 495 if (err < 0) {
494 hci_free_dev(hdev); 496 hci_free_dev(hdev);
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 0cd4a55dd5c4..5d97bedb83e0 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -41,25 +41,25 @@
41#define BT_DBG(D...) 41#define BT_DBG(D...)
42#endif 42#endif
43 43
44#define VERSION "0.3" 44#define VERSION "0.4"
45 45
46static int ignore_dga; 46static int ignore_dga;
47static int ignore_csr; 47static int ignore_csr;
48static int ignore_sniffer; 48static int ignore_sniffer;
49static int disable_scofix; 49static int disable_scofix;
50static int force_scofix; 50static int force_scofix;
51static int reset; 51
52static int reset = 1;
52 53
53static struct usb_driver btusb_driver; 54static struct usb_driver btusb_driver;
54 55
55#define BTUSB_IGNORE 0x01 56#define BTUSB_IGNORE 0x01
56#define BTUSB_RESET 0x02 57#define BTUSB_DIGIANSWER 0x02
57#define BTUSB_DIGIANSWER 0x04 58#define BTUSB_CSR 0x04
58#define BTUSB_CSR 0x08 59#define BTUSB_SNIFFER 0x08
59#define BTUSB_SNIFFER 0x10 60#define BTUSB_BCM92035 0x10
60#define BTUSB_BCM92035 0x20 61#define BTUSB_BROKEN_ISOC 0x20
61#define BTUSB_BROKEN_ISOC 0x40 62#define BTUSB_WRONG_SCO_MTU 0x40
62#define BTUSB_WRONG_SCO_MTU 0x80
63 63
64static struct usb_device_id btusb_table[] = { 64static struct usb_device_id btusb_table[] = {
65 /* Generic Bluetooth USB device */ 65 /* Generic Bluetooth USB device */
@@ -79,7 +79,7 @@ static struct usb_device_id btusb_table[] = {
79 { USB_DEVICE(0x0bdb, 0x1002) }, 79 { USB_DEVICE(0x0bdb, 0x1002) },
80 80
81 /* Canyon CN-BTU1 with HID interfaces */ 81 /* Canyon CN-BTU1 with HID interfaces */
82 { USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_RESET }, 82 { USB_DEVICE(0x0c10, 0x0000) },
83 83
84 { } /* Terminating entry */ 84 { } /* Terminating entry */
85}; 85};
@@ -94,52 +94,36 @@ static struct usb_device_id blacklist_table[] = {
94 { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, 94 { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE },
95 95
96 /* Broadcom BCM2035 */ 96 /* Broadcom BCM2035 */
97 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 97 { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU },
98 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 98 { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU },
99 { USB_DEVICE(0x0a5c, 0x2009), .driver_info = BTUSB_BCM92035 },
99 100
100 /* Broadcom BCM2045 */ 101 /* Broadcom BCM2045 */
101 { USB_DEVICE(0x0a5c, 0x2039), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 102 { USB_DEVICE(0x0a5c, 0x2039), .driver_info = BTUSB_WRONG_SCO_MTU },
102 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 103 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_WRONG_SCO_MTU },
103
104 /* Broadcom BCM2046 */
105 { USB_DEVICE(0x0a5c, 0x2146), .driver_info = BTUSB_RESET },
106 { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET },
107
108 /* Apple MacBook Pro with Broadcom chip */
109 { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET },
110 104
111 /* IBM/Lenovo ThinkPad with Broadcom chip */ 105 /* IBM/Lenovo ThinkPad with Broadcom chip */
112 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 106 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_WRONG_SCO_MTU },
113 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 107 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_WRONG_SCO_MTU },
114
115 /* Targus ACB10US */
116 { USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET },
117 { USB_DEVICE(0x0a5c, 0x2154), .driver_info = BTUSB_RESET },
118
119 /* ANYCOM Bluetooth USB-200 and USB-250 */
120 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET },
121 108
122 /* HP laptop with Broadcom chip */ 109 /* HP laptop with Broadcom chip */
123 { USB_DEVICE(0x03f0, 0x171d), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 110 { USB_DEVICE(0x03f0, 0x171d), .driver_info = BTUSB_WRONG_SCO_MTU },
124 111
125 /* Dell laptop with Broadcom chip */ 112 /* Dell laptop with Broadcom chip */
126 { USB_DEVICE(0x413c, 0x8126), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 113 { USB_DEVICE(0x413c, 0x8126), .driver_info = BTUSB_WRONG_SCO_MTU },
127 114
128 /* Dell Wireless 370 */ 115 /* Dell Wireless 370 */
129 { USB_DEVICE(0x413c, 0x8156), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 116 { USB_DEVICE(0x413c, 0x8156), .driver_info = BTUSB_WRONG_SCO_MTU },
130 117
131 /* Dell Wireless 410 */ 118 /* Dell Wireless 410 */
132 { USB_DEVICE(0x413c, 0x8152), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 119 { USB_DEVICE(0x413c, 0x8152), .driver_info = BTUSB_WRONG_SCO_MTU },
133
134 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
135 { USB_DEVICE(0x045e, 0x009c), .driver_info = BTUSB_RESET },
136 120
137 /* Kensington Bluetooth USB adapter */ 121 /* Kensington Bluetooth USB adapter */
138 { USB_DEVICE(0x047d, 0x105d), .driver_info = BTUSB_RESET }, 122 { USB_DEVICE(0x047d, 0x105e), .driver_info = BTUSB_WRONG_SCO_MTU },
139 { USB_DEVICE(0x047d, 0x105e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
140 123
141 /* ISSC Bluetooth Adapter v3.1 */ 124 /* Belkin F8T012 and F8T013 devices */
142 { USB_DEVICE(0x1131, 0x1001), .driver_info = BTUSB_RESET }, 125 { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_WRONG_SCO_MTU },
126 { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_WRONG_SCO_MTU },
143 127
144 /* RTX Telecom based adapters with buggy SCO support */ 128 /* RTX Telecom based adapters with buggy SCO support */
145 { USB_DEVICE(0x0400, 0x0807), .driver_info = BTUSB_BROKEN_ISOC }, 129 { USB_DEVICE(0x0400, 0x0807), .driver_info = BTUSB_BROKEN_ISOC },
@@ -148,13 +132,6 @@ static struct usb_device_id blacklist_table[] = {
148 /* CONWISE Technology based adapters with buggy SCO support */ 132 /* CONWISE Technology based adapters with buggy SCO support */
149 { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC }, 133 { USB_DEVICE(0x0e5e, 0x6622), .driver_info = BTUSB_BROKEN_ISOC },
150 134
151 /* Belkin F8T012 and F8T013 devices */
152 { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
153 { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
154
155 /* Belkin F8T016 device */
156 { USB_DEVICE(0x050d, 0x016a), .driver_info = BTUSB_RESET },
157
158 /* Digianswer devices */ 135 /* Digianswer devices */
159 { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, 136 { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
160 { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE }, 137 { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
@@ -197,6 +174,8 @@ struct btusb_data {
197 struct usb_endpoint_descriptor *isoc_tx_ep; 174 struct usb_endpoint_descriptor *isoc_tx_ep;
198 struct usb_endpoint_descriptor *isoc_rx_ep; 175 struct usb_endpoint_descriptor *isoc_rx_ep;
199 176
177 __u8 cmdreq_type;
178
200 int isoc_altsetting; 179 int isoc_altsetting;
201 int suspend_count; 180 int suspend_count;
202}; 181};
@@ -590,7 +569,7 @@ static int btusb_send_frame(struct sk_buff *skb)
590 return -ENOMEM; 569 return -ENOMEM;
591 } 570 }
592 571
593 dr->bRequestType = USB_TYPE_CLASS; 572 dr->bRequestType = data->cmdreq_type;
594 dr->bRequest = 0; 573 dr->bRequest = 0;
595 dr->wIndex = 0; 574 dr->wIndex = 0;
596 dr->wValue = 0; 575 dr->wValue = 0;
@@ -828,6 +807,8 @@ static int btusb_probe(struct usb_interface *intf,
828 return -ENODEV; 807 return -ENODEV;
829 } 808 }
830 809
810 data->cmdreq_type = USB_TYPE_CLASS;
811
831 data->udev = interface_to_usbdev(intf); 812 data->udev = interface_to_usbdev(intf);
832 data->intf = intf; 813 data->intf = intf;
833 814
@@ -862,11 +843,11 @@ static int btusb_probe(struct usb_interface *intf,
862 843
863 hdev->owner = THIS_MODULE; 844 hdev->owner = THIS_MODULE;
864 845
865 /* interface numbers are hardcoded in the spec */ 846 /* Interface numbers are hardcoded in the specification */
866 data->isoc = usb_ifnum_to_if(data->udev, 1); 847 data->isoc = usb_ifnum_to_if(data->udev, 1);
867 848
868 if (reset || id->driver_info & BTUSB_RESET) 849 if (!reset)
869 set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); 850 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
870 851
871 if (force_scofix || id->driver_info & BTUSB_WRONG_SCO_MTU) { 852 if (force_scofix || id->driver_info & BTUSB_WRONG_SCO_MTU) {
872 if (!disable_scofix) 853 if (!disable_scofix)
@@ -876,9 +857,23 @@ static int btusb_probe(struct usb_interface *intf,
876 if (id->driver_info & BTUSB_BROKEN_ISOC) 857 if (id->driver_info & BTUSB_BROKEN_ISOC)
877 data->isoc = NULL; 858 data->isoc = NULL;
878 859
860 if (id->driver_info & BTUSB_DIGIANSWER) {
861 data->cmdreq_type = USB_TYPE_VENDOR;
862 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
863 }
864
865 if (id->driver_info & BTUSB_CSR) {
866 struct usb_device *udev = data->udev;
867
868 /* Old firmware would otherwise execute USB reset */
869 if (le16_to_cpu(udev->descriptor.bcdDevice) < 0x117)
870 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
871 }
872
879 if (id->driver_info & BTUSB_SNIFFER) { 873 if (id->driver_info & BTUSB_SNIFFER) {
880 struct usb_device *udev = data->udev; 874 struct usb_device *udev = data->udev;
881 875
876 /* New sniffer firmware has crippled HCI interface */
882 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997) 877 if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997)
883 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); 878 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
884 879
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 4426bb552bd9..cb46bf52a19a 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -399,8 +399,8 @@ static int hci_uart_register_dev(struct hci_uart *hu)
399 399
400 hdev->owner = THIS_MODULE; 400 hdev->owner = THIS_MODULE;
401 401
402 if (reset) 402 if (!reset)
403 set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks); 403 set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
404 404
405 if (hci_register_dev(hdev) < 0) { 405 if (hci_register_dev(hdev) < 0) {
406 BT_ERR("Can't register HCI device"); 406 BT_ERR("Can't register HCI device");
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3cc294919312..3645139e68c7 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -54,7 +54,7 @@
54 54
55/* HCI device quirks */ 55/* HCI device quirks */
56enum { 56enum {
57 HCI_QUIRK_RESET_ON_INIT, 57 HCI_QUIRK_NO_RESET,
58 HCI_QUIRK_RAW_DEVICE, 58 HCI_QUIRK_RAW_DEVICE,
59 HCI_QUIRK_FIXUP_BUFFER_SIZE 59 HCI_QUIRK_FIXUP_BUFFER_SIZE
60}; 60};
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 41f07f549ba7..f6f216e57aa3 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -46,7 +46,7 @@
46#define BT_DBG(D...) 46#define BT_DBG(D...)
47#endif 47#endif
48 48
49#define VERSION "2.13" 49#define VERSION "2.14"
50 50
51/* Bluetooth sockets */ 51/* Bluetooth sockets */
52#define BT_MAX_PROTO 8 52#define BT_MAX_PROTO 8
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 7bb0f1cb7f26..fa7c5370b556 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -205,7 +205,7 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
205 /* Mandatory initialization */ 205 /* Mandatory initialization */
206 206
207 /* Reset */ 207 /* Reset */
208 if (test_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks)) 208 if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
209 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); 209 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
210 210
211 /* Read Local Supported Features */ 211 /* Read Local Supported Features */