public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Reinstitute usb_detach_kernel_driver_np, but in the proper place.
@ 2009-05-18 18:12 Mario Limonciello
  2009-05-18 18:20 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2009-05-18 18:12 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org; +Cc: Marcel Holtmann


[-- Attachment #1.1: Type: text/plain, Size: 1071 bytes --]

Testing a little more, I found that on fresh boots the latest bluez.git
doesn't always work to switch dell BT adapters to HCI mode depending on
the state of the killswitch on boot.  Whenever running hid2hci, the
kernel driver should attempt to be released.  As long as this is done
before trying to claim, each of the scenarios is successful.  The
previous dmesg errors were coming up because the order of the
usb_claim_interface and usb_detach_kernel_driver_np were reversed.

The commit message should be shortened this time too, sorry about that
before.

---
From 3e40fbd035b35613c8d1ad3f0aa11a639f487600 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <Mario_Limonciello@Dell.com>
Date: Mon, 18 May 2009 13:07:40 -0500
Subject: [PATCH] Reinstitute usb_detach_kernel_driver_np, but in the
proper place.
 The kernel might still be grab the usb device, so release it before claim.

---
 tools/hid2hci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

-- 
Mario Limonciello
*Dell | Linux Engineering*
mario_limonciello@dell.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Reinstitute-usb_detach_kernel_driver_np-but-in-the.patch --]
[-- Type: text/x-patch; name="0001-Reinstitute-usb_detach_kernel_driver_np-but-in-the.patch", Size: 944 bytes --]

From 3e40fbd035b35613c8d1ad3f0aa11a639f487600 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <Mario_Limonciello@Dell.com>
Date: Mon, 18 May 2009 13:07:40 -0500
Subject: [PATCH] Reinstitute usb_detach_kernel_driver_np, but in the proper place.
 The kernel might still be grab the usb device, so release it before claim.

---
 tools/hid2hci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index d5c8d32..c5b6558 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -223,6 +223,10 @@ static int switch_dell(struct device_info *devinfo)
 
 	handle = usb_open(devinfo->dev);
 
+	/* Don't need to check return, as might not be in use */
+	if (handle)
+		usb_detach_kernel_driver_np(handle, 0);
+
 	if (handle && usb_claim_interface(handle,0) == 0)
 		err = usb_control_msg(handle,
 			USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-- 
1.6.0.4


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Reinstitute usb_detach_kernel_driver_np, but in the proper place.
  2009-05-18 18:12 [PATCH] Reinstitute usb_detach_kernel_driver_np, but in the proper place Mario Limonciello
@ 2009-05-18 18:20 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2009-05-18 18:20 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: linux-bluetooth@vger.kernel.org

Hi Mario,

> Testing a little more, I found that on fresh boots the latest bluez.git
> doesn't always work to switch dell BT adapters to HCI mode depending on
> the state of the killswitch on boot.  Whenever running hid2hci, the
> kernel driver should attempt to be released.  As long as this is done
> before trying to claim, each of the scenarios is successful.  The
> previous dmesg errors were coming up because the order of the
> usb_claim_interface and usb_detach_kernel_driver_np were reversed.

the patch has been applied. However I prefer if you stop making the code
so complex that my brain hurts. I changed that now. It should really
just to "if error then bail out of the function".

Regards

Marcel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-18 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-18 18:12 [PATCH] Reinstitute usb_detach_kernel_driver_np, but in the proper place Mario Limonciello
2009-05-18 18:20 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox