Skip to contentSkip to conversation

ath3k: add warning when switch pid is not working

PATCH In review Luiz Carlos Ramos 2 participants 3 messages Sep 7, 2018 – Sep 27, 2018 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath3k: add warning when switch pid is not working

This patch adds a warning message in the ath3k driver when ath3k_switch_pid() returns error.

This event happens in a specific laptop, with an adapter which identifies itself as 0cf3:0036. Surprisingly, the adapter works even after this event - hence a warning is chosen instead of an error.

The current version of ath3k doesn't check the return value of ath3k_switch_pid() and so this event may remain undetected in the original version.

---
 drivers/bluetooth/ath3k.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/ath3k.c +4 -1
index 3d7a5c149af3..3a8c47efea55 100644
@@ -546,7 +546,10 @@ static int ath3k_probe(struct usb_interface *intf,
 			BT_ERR("Set normal mode failed");
 			return ret;
 		}
-		ath3k_switch_pid(udev);
+		ret = ath3k_switch_pid(udev);
+		if (ret < 0)
+			BT_WARN("Warning: switch pid failed (ret=%d)", ret);
+
 		return 0;
 	}
 
Signature · 1 line
2.14.4
maintainer
#1 lore raw

Hi Luiz,

Quoted 10 lines

This patch adds a warning message in the ath3k driver when ath3k_switch_pid() returns error.

This event happens in a specific laptop, with an adapter which identifies itself as 0cf3:0036. Surprisingly, the adapter works even after this event - hence a warning is chosen instead of an error.

The current version of ath3k doesn't check the return value of ath3k_switch_pid() and so this event may remain undetected in the original version.

if works anyway, why bother with a warning? I have no idea what benefit this has.

Regards

Marcel

#2 lore raw

Hi, Marcel,

Quoted 9 lines · Marcel Holtmann

Hi Luiz,

Quoted 7 lines

This patch adds a warning message in the ath3k driver when ath3k_switch_pid() returns error.

This event happens in a specific laptop, with an adapter which identifies itself as 0cf3:0036. Surprisingly, the adapter works even after this event - hence a warning is chosen instead of an error.

Quoted 6 lines
Quoted 3 lines

The current version of ath3k doesn't check the return value of ath3k_switch_pid() and so this event may remain undetected in the original version.

if works anyway, why bother with a warning? I have no idea what benefit this has.

I analyze this issue as having three possible cases:

(1) the function works, and so, no problems, no warnings;

(2) (my case) the function fails but the system works as it should do; in this case I would agree with you, but

(3) the function fails and this affects the whole system (let's say, the VID:PID doesn't change as intended); in this case there's a problem and the admin should be in a better position if one can be watched by this warning.

Based on the code, there's no way to diferentiate (2) and (3), so IMHO a warning would be justified.

Best regards,

Luiz