[PATCH] Add HID->HCI switching support for newer Dell BT cards

<[email protected]>
Newsgroups gmane.linux.bluez.devel
Message-ID <1207335282.19116.5.camel@mlimonciello>
Hello,

As I've recently discovered, the more recent (Dell Wireless 370+) BT
adapters with the latest firmware don't come up in Bluetooth Radio mode.
They come up in a HID/UHE dongle like mode before the OS loads and
expect the OS to transition the device to HCI mode.  Unfortunately, the
transition to HCI mode isn't done in the same fashion as the existing
switch_hidproxy function available in hid2hci.  I'm attaching a patch to
hid2hci that adds a function for the expected behavior on these newer
adapters. 

The device that needs to have the report sent to it is claimed by usbhid
at OS load time, so there are some calls in there to release it from
usbhid.

I tested this against a Dell 370 BT adapter.  This should be the same
for the newer adapters (after the 370), but I haven't verified them yet,
so there may be an additional patch needed for it.

Thanks,
 
---
Mario Limonciello
Dell | Linux Engineering
[email protected]

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
007_dell_bluetooth.patch (text/x-patch, 1.4 KB)
diff -Nur -x '*.orig' -x '*~' bluez-utils-3.26/tools/hid2hci.c bluez-utils-3.26.new/tools/hid2hci.c
--- bluez-utils-3.26/tools/hid2hci.c	2008-02-01 17:16:34.000000000 -0600
+++ bluez-utils-3.26.new/tools/hid2hci.c	2008-04-04 13:34:13.000000000 -0500
@@ -211,6 +211,42 @@
 	return err;
 }
 
+static int switch_dell(struct device_info *devinfo)
+{
+	char report[] = { 0x7F, 0x13, 0x00, 0x00};
+
+	struct usb_dev_handle *handle;
+	int err;
+
+	//release any locks that the kernel may have on this device
+	handle = usb_open(devinfo->dev);
+	if (handle)
+	{
+		usb_claim_interface(handle, 0);
+		usb_detach_kernel_driver_np(handle,0);
+	}
+
+	//switch device modes
+	err = usb_control_msg(handle,
+		USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE,
+		0x09,
+		0x7f + (0x03 << 8),
+		0,
+		(char*)report, 4, 10000);
+
+	if (err == 0) {
+		err = -1;
+		errno = EALREADY;
+	} else {
+		if (errno == ETIMEDOUT)
+			err = 0;
+	}
+
+	usb_close(handle);
+
+	return err;
+}
+
 static struct device_id device_list[] = {
 	{ HCI, 0x0a12, 0x1000, switch_hidproxy },
 	{ HID, 0x0a12, 0x0001, switch_hidproxy },
@@ -229,6 +265,7 @@
 	{ HCI, 0x046d, 0xc70e, switch_logitech },	/* Logitech diNovo keyboard */
 	{ HCI, 0x046d, 0xc713, switch_logitech },	/* Logitech diNovo Edge */
 	{ HCI, 0x046d, 0xc714, switch_logitech },	/* Logitech diNovo Edge */
+	{ HCI, 0x413c, 0x8158, switch_dell },		/* Dell Wireless 370 */
 	{ -1 }
 };
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBH9nly2CrZjkA73YsRAo0nAJ9atS7yXv0s4LahBP1LohMPYKjjLgCgmIbt
tpb/CdPz/c362Dj2dM2cUz0=
=deVU
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.