[PATCH] Reinstitute usb_detach_kernel_driver_np, but in the proper place.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
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@xxxxxxxx
From 3e40fbd035b35613c8d1ad3f0aa11a639f487600 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <Mario_Limonciello@xxxxxxxx>
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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux