[Bluetooth] Correct SCO buffer size on request
Marcel Holtmann [Mon, 3 Jul 2006 08:02:29 +0000 (10:02 +0200)]
This patch introduces a quirk that allows the drivers to tell the host
to correct the SCO buffer size values.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

drivers/bluetooth/hci_usb.c
drivers/bluetooth/hci_usb.h
include/net/bluetooth/hci.h
net/bluetooth/hci_event.c

index 987a3df..6a0c223 100644 (file)
@@ -122,6 +122,9 @@ static struct usb_device_id blacklist_ids[] = {
        /* RTX Telecom based adapter with buggy SCO support */
        { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC },
 
+       /* Belkin F8T012 */
+       { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_WRONG_SCO_MTU },
+
        /* Digianswer devices */
        { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
        { USB_DEVICE(0x08fd, 0x0002), .driver_info = HCI_IGNORE },
@@ -987,6 +990,9 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id
        if (reset || id->driver_info & HCI_RESET)
                set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks);
 
+       if (id->driver_info & HCI_WRONG_SCO_MTU)
+               set_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks);
+
        if (id->driver_info & HCI_SNIFFER) {
                if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x997)
                        set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
index 37100a6..963fc55 100644 (file)
@@ -35,6 +35,7 @@
 #define HCI_SNIFFER            0x10
 #define HCI_BCM92035           0x20
 #define HCI_BROKEN_ISOC                0x40
+#define HCI_WRONG_SCO_MTU      0x80
 
 #define HCI_MAX_IFACE_NUM      3
 
index b06a2d2..99c53f6 100644 (file)
@@ -54,7 +54,8 @@
 /* HCI device quirks */
 enum {
        HCI_QUIRK_RESET_ON_INIT,
-       HCI_QUIRK_RAW_DEVICE
+       HCI_QUIRK_RAW_DEVICE,
+       HCI_QUIRK_FIXUP_BUFFER_SIZE
 };
 
 /* HCI device flags */
index 618bace..f41cf1a 100644 (file)
@@ -319,9 +319,17 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
                }
 
                hdev->acl_mtu  = __le16_to_cpu(bs->acl_mtu);
-               hdev->sco_mtu  = bs->sco_mtu ? bs->sco_mtu : 64;
-               hdev->acl_pkts = hdev->acl_cnt = __le16_to_cpu(bs->acl_max_pkt);
-               hdev->sco_pkts = hdev->sco_cnt = __le16_to_cpu(bs->sco_max_pkt);
+               hdev->sco_mtu  = bs->sco_mtu;
+               hdev->acl_pkts = __le16_to_cpu(bs->acl_max_pkt);
+               hdev->sco_pkts = __le16_to_cpu(bs->sco_max_pkt);
+
+               if (test_bit(HCI_QUIRK_FIXUP_BUFFER_SIZE, &hdev->quirks)) {
+                       hdev->sco_mtu  = 64;
+                       hdev->sco_pkts = 8;
+               }
+
+               hdev->acl_cnt = hdev->acl_pkts;
+               hdev->sco_cnt = hdev->sco_pkts;
 
                BT_DBG("%s mtu: acl %d, sco %d max_pkt: acl %d, sco %d", hdev->name,
                        hdev->acl_mtu, hdev->sco_mtu, hdev->acl_pkts, hdev->sco_pkts);