Skip to contentSkip to conversation

resending patch to retry reset in case it failed

PATCH Oliver Neukum 3 participants 7 messages Aug 12, 2010 – Aug 17, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Marcel,

may I ask what happened to this patch?
Do you take it, want modifications or reject it?

Regards
Oliver

=46rom af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001 =46rom: Oliver Neukum <[email protected]>
Date: Tue, 6 Jul 2010 08:08:42 +0200
Subject: [PATCH] bluetooth: retry reset for devices that fail

Some devices fail to reset properly at the first attempt to reset them under unknown circumstances. Failures can be identified by an invalid btaddr. Retry in those cases.

=2D--
net/bluetooth/hci_core.c | 48 ++++++++++++++++++++++++++----------------=
=2D--

 1 files changed, 28 insertions(+), 20 deletions(-)
net/bluetooth/hci_core.c +0 -0
index 2f768de..c47f73d 100644

=2D-- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -180,11 +180,17 @@ static void hci_reset_req(struct hci_dev *hdev, unsig= ned long opt)
hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
}
=20
+static int verify_valid_bdaddr(struct hci_dev *hdev)
+{
+ return !bacmp(&hdev->bdaddr, BDADDR_ANY);
+}
+
static void hci_init_req(struct hci_dev *hdev, unsigned long opt) {
struct sk_buff *skb;
__le16 param;
__u8 flt_type;
+ int retries =3D 4;
=20
BT_DBG("%s %ld", hdev->name, opt);
=20
@@ -202,33 +208,35 @@ static void hci_init_req(struct hci_dev *hdev, unsign= ed long opt)
=20
/* Mandatory initialization */
=20
=2D /* Reset */
=2D if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
=2D hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
+ do {
+ /* Reset */
+ if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
+ hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
=20
=2D /* Read Local Supported Features */
=2D hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
+ /* Read Local Supported Features */
+ hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
=20
=2D /* Read Local Version */
=2D hci_send_cmd(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
+ /* Read Local Version */
+ hci_send_cmd(hdev, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
=20
=2D /* Read Buffer Size (ACL mtu, max pkt, etc.) */
=2D hci_send_cmd(hdev, HCI_OP_READ_BUFFER_SIZE, 0, NULL);
+ /* Read Buffer Size (ACL mtu, max pkt, etc.) */
+ hci_send_cmd(hdev, HCI_OP_READ_BUFFER_SIZE, 0, NULL);
=20
#if 0
=2D /* Host buffer size */
=2D {
=2D struct hci_cp_host_buffer_size cp;
=2D cp.acl_mtu =3D cpu_to_le16(HCI_MAX_ACL_SIZE);
=2D cp.sco_mtu =3D HCI_MAX_SCO_SIZE;
=2D cp.acl_max_pkt =3D cpu_to_le16(0xffff);
=2D cp.sco_max_pkt =3D cpu_to_le16(0xffff);
=2D hci_send_cmd(hdev, HCI_OP_HOST_BUFFER_SIZE, sizeof(cp), &cp);
=2D }
+ /* Host buffer size */
+ {
+ struct hci_cp_host_buffer_size cp;
+ cp.acl_mtu =3D cpu_to_le16(HCI_MAX_ACL_SIZE);
+ cp.sco_mtu =3D HCI_MAX_SCO_SIZE;
+ cp.acl_max_pkt =3D cpu_to_le16(0xffff);
+ cp.sco_max_pkt =3D cpu_to_le16(0xffff);
+ hci_send_cmd(hdev, HCI_OP_HOST_BUFFER_SIZE, sizeof(cp), &cp);
+ }
#endif
=20
=2D /* Read BD Address */
=2D hci_send_cmd(hdev, HCI_OP_READ_BD_ADDR, 0, NULL);
+ /* Read BD Address */
+ hci_send_cmd(hdev, HCI_OP_READ_BD_ADDR, 0, NULL);
+ } while(!verify_valid_bdaddr(hdev) && retries--);
=20
/* Read Class of Device */
hci_send_cmd(hdev, HCI_OP_READ_CLASS_OF_DEV, 0, NULL);
=2D-=20
1.7.1

maintainer
#1 lore raw

Hi Oliver,

Quoted 6 lines

may I ask what happened to this patch?
Do you take it, want modifications or reject it?

Regards
Oliver

Quoted 8 lines

From af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 6 Jul 2010 08:08:42 +0200
Subject: [PATCH] bluetooth: retry reset for devices that fail

Some devices fail to reset properly at the first attempt to reset them under unknown circumstances. Failures can be identified by an invalid btaddr. Retry in those cases.

I was pondering about it and haven't really made up my mind with this stuff. To be honest, I don't like the patch a little bit. I can see your point why you want it, but the patch is a bit too ugly for my taste.

Tell me which device is causing this and I might be able to reproduce this and find small less ugly fix. Also keep in mind that the init routine needs changing to accommodate AMP and LE devices. So we have to be really careful here.

Regards

Marcel

#2 lore raw

Am Donnerstag, 12. August 2010, 13:25:23 schrieb Marcel Holtmann:

Quoted 13 lines

Hi Oliver,

Quoted 11 lines

may I ask what happened to this patch?
Do you take it, want modifications or reject it?

Regards
Oliver

From af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 6 Jul 2010 08:08:42 +0200
Subject: [PATCH] bluetooth: retry reset for devices that fail

Quoted 7 lines
Quoted 3 lines

Some devices fail to reset properly at the first attempt to reset them under unknown circumstances. Failures can be identified by an invalid btaddr. Retry in those cases.

I was pondering about it and haven't really made up my mind with this stuff. To be honest, I don't like the patch a little bit. I can see your point why you want it, but the patch is a bit too ugly for my taste.

I am very open to alternatives. But without that it is needed to make the hardware work.

Quoted 2 lines

Tell me which device is causing this and I might be able to reproduce this and find small less ugly fix.

I happens with this hardware from Broadcom. There may be others I don't know about. It is an internal dongle. I don't know whether it can be found in external hardware.

Regards
Oliver

Bus 002 Device 002: ID 0a5c:21b4 Broadcom Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x0a5c Broadcom Corp.
idProduct 0x21b4
bcdDevice 4.81

  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 216
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 254 Application Specific Interface
bInterfaceSubClass 1 Device Firmware Update
bInterfaceProtocol 1
iInterface 0
** UNRECOGNIZED: 07 21 07 88 13 40 00

#3 lore raw
Quoted 25 lines · Oliver Neukum

Am Donnerstag, 12. August 2010, 13:25:23 schrieb Marcel Holtmann:

Quoted 13 lines

Hi Oliver,

Quoted 11 lines

may I ask what happened to this patch?
Do you take it, want modifications or reject it?

=A0 =A0 Regards
=A0 =A0 =A0 =A0 =A0 =A0 Oliver

From af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 6 Jul 2010 08:08:42 +0200
Subject: [PATCH] bluetooth: retry reset for devices that fail

Quoted 7 lines
Quoted 3 lines

Some devices fail to reset properly at the first attempt to reset them under unknown circumstances. Failures can be identified by an invalid btaddr. Retry in those cases.

I was pondering about it and haven't really made up my mind with this stuff. To be honest, I don't like the patch a little bit. I can see your point why you want it, but the patch is a bit too ugly for my taste.

I am very open to alternatives. But without that it is needed to make the hardware work.

Quoted 6 lines
Quoted 2 lines

Tell me which device is causing this and I might be able to reproduce this and find small less ugly fix.

I happens with this hardware from Broadcom. There may be others I don't know about. It is an internal dongle. I don't know whether it can be foun=

d in

Quoted 2 lines

external hardware.

Could you share also "hciconfig hci0 revision" and "hciconfig hci0 version" info. And laptop model you have the chip build in.

--=20
Ville

#4 lore raw

Am Freitag, 13. August 2010, 15:20:08 schrieb Ville Tervo:

Quoted 30 lines · Oliver Neukum
Quoted 29 lines

Am Donnerstag, 12. August 2010, 13:25:23 schrieb Marcel Holtmann:

Quoted 13 lines

Hi Oliver,

Quoted 11 lines

may I ask what happened to this patch?
Do you take it, want modifications or reject it?

Regards
Oliver

From af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 6 Jul 2010 08:08:42 +0200
Subject: [PATCH] bluetooth: retry reset for devices that fail

Quoted 7 lines
Quoted 3 lines

Some devices fail to reset properly at the first attempt to reset them under unknown circumstances. Failures can be identified by an invalid btaddr. Retry in those cases.

I was pondering about it and haven't really made up my mind with this stuff. To be honest, I don't like the patch a little bit. I can see your point why you want it, but the patch is a bit too ugly for my taste.

I am very open to alternatives. But without that it is needed to make the hardware work.

Quoted 2 lines

Tell me which device is causing this and I might be able to reproduce this and find small less ugly fix.

Quoted 7 lines
Quoted 4 lines

I happens with this hardware from Broadcom. There may be others I don't know about. It is an internal dongle. I don't know whether it can be found in external hardware.

Could you share also "hciconfig hci0 revision" and "hciconfig hci0 version" info. And laptop model you have the chip build in.

The device reported:

localhost:/tmp # hciconfig hci0 version
hci0: Type: USB

	BD Address: 00:27:13:98:49:7E ACL MTU: 1021:8 SCO MTU: 64:1
	HCI Ver: 3.0 (0x5) HCI Rev: 0x1e1 LMP Ver: 3.0 (0x5) LMP Subver: 0x4203
	Manufacturer: Broadcom Corporation (15)
localhost:/tmp # hciconfig hci0 revision
hci0:	Type: USB
	BD Address: 00:27:13:98:49:7E ACL MTU: 1021:8 SCO MTU: 64:1
	Firmware 225.66 / 3

The laptop is a prototype. All laptops it was installed in showed the same problem.

Regards
Oliver

#5 lore raw

Hi Oliver,

Quoted 9 lines · Oliver Neukum
Quoted 3 lines

Could you share also "hciconfig hci0 revision" and "hciconfig hci0 version" info. And laptop model you have the chip build in.

The device reported:

localhost:/tmp # hciconfig hci0 version
hci0: =A0 Type: USB
=A0 =A0 =A0 =A0BD Address: 00:27:13:98:49:7E ACL MTU: 1021:8 SCO MTU: 64:=

1

Quoted 1 line

=A0 =A0 =A0 =A0HCI Ver: 3.0 (0x5) HCI Rev: 0x1e1 LMP Ver: 3.0 (0x5) LMP S=

ubver: 0x4203

Quoted 4 lines

=A0 =A0 =A0 =A0Manufacturer: Broadcom Corporation (15) localhost:/tmp # hciconfig hci0 revision
hci0: =A0 Type: USB
=A0 =A0 =A0 =A0BD Address: 00:27:13:98:49:7E ACL MTU: 1021:8 SCO MTU: 64:=

1

Quoted 3 lines

=A0 =A0 =A0 =A0Firmware 225.66 / 3

The laptop is a prototype. All laptops it was installed in showed the sam=

e

Quoted 1 line

problem.

Thanks. I don't have access to that hardware and cannot do much without.

hcidump from chip initialization might reveal something. Could you send the dump also?

--=20
Ville

#6 lore raw
In reply to Marcel Holtmann

Am Donnerstag, 12. August 2010, 13:25:23 schrieb Marcel Holtmann:

Quoted 13 lines

Hi Oliver,

Quoted 11 lines

may I ask what happened to this patch?
Do you take it, want modifications or reject it?

Regards
Oliver

From af61f0663f095599003290b13ad6fadee1d4fb25 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 6 Jul 2010 08:08:42 +0200
Subject: [PATCH] bluetooth: retry reset for devices that fail

Quoted 7 lines
Quoted 3 lines

Some devices fail to reset properly at the first attempt to reset them under unknown circumstances. Failures can be identified by an invalid btaddr. Retry in those cases.

I was pondering about it and haven't really made up my mind with this stuff. To be honest, I don't like the patch a little bit. I can see your point why you want it, but the patch is a bit too ugly for my taste.

Do you have any suggestion how to beautify it? To me the patch shows the quality of simplicity at least.

Quoted 4 lines

Tell me which device is causing this and I might be able to reproduce this and find small less ugly fix. Also keep in mind that the init routine needs changing to accommodate AMP and LE devices. So we have to be really careful here.

In the non-error case the patch changes nothing.

Regards
Oliver