Skip to contentSkip to conversation

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

PATCH In review [email protected] 3 participants 10 messages Apr 4, 2008 – May 10, 2008 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add HID->HCI switching support for newer Dell BT cards

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]

tools/hid2hci.c +37 -0
diff -Nur -x '*.orig' -x '*~' bluez-utils-3.26/tools/hid2hci.c bluez-utils-3.26.new/tools/hid2hci.c
@@ -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 }
 };
 

-------------------------------------------------------------------------
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

#1 lore raw

Hi,

As it turns out, this also works for the Dell 410 series cards. Attached is an updated patch to include them.

Regards,

Quoted 19 lines · Mario Limonciello

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.

Quoted 9 lines

Thanks,

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

---
Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

tools/hid2hci.c +38 -0
diff -Nur -x '*.orig' -x '*~' bluez-utils-3.26/tools/hid2hci.c bluez-utils-3.26.new/tools/hid2hci.c
@@ -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,8 @@
 	{ 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 */
+	{ HCI, 0x413c, 0x8154, switch_dell },		/* Dell Wireless 410 */
 	{ -1 }
 };
 

-------------------------------------------------------------------------
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

#2 lore raw
Quoted 4 lines · On Fri, 2008-04-04 at 15:46 -0500, [email protected] wrote:

Hi,

As it turns out, this also works for the Dell 410 series cards. Attached is an updated patch to include them.

Only problems I could see with the patch is the coding style (C++-style comments, braces on different lines for a condition, alignment of arguments to a function when on multiple lines).

The rest of the code looks fine to me.

Are those adapters usually shipped with keyboards and mice, so that they would need to stay in HID mode on startup?

If they do, do you have any code available that would make sure this keyboard and mouse are registered in BlueZ so they work "out of the box"?

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCI switching support fornewer Dell BT cards

Bastien,

I'll be glad to update the coding style to match the rest of the source. Please see the updated attachment. Both of these adapters are just bluetooth cards that ship on the laptop, not the dongles that come with a keyboard or mouse.

This is the way the cards function in Windows, and the way that they were intended to function. When paired with a HID keyboard and/or mouse, they have the ability to store that pairing in the firmware. That's why they have the two modes.

In reading your question, do you have a problem with a particular mouse &/or keyboard combo that the dongle isn't working 'out of the box'?

Regards,

Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

-----Original Message-----
From: [email protected] on behalf of Bastien Nocera
Sent: Fri 4/4/2008 6:17 PM
To: BlueZ development
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCI switching support fornewer Dell BT cards

Quoted 4 lines · On Fri, 2008-04-04 at 15:46 -0500, [email protected] wrote:

Hi,

As it turns out, this also works for the Dell 410 series cards. Attached is an updated patch to include them.

Only problems I could see with the patch is the coding style (C++-style comments, braces on different lines for a condition, alignment of arguments to a function when on multiple lines).

The rest of the code looks fine to me.

Are those adapters usually shipped with keyboards and mice, so that they would need to stay in HID mode on startup?

If they do, do you have any code available that would make sure this keyboard and mouse are registered in BlueZ so they work "out of the box"?

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCI switching support fornewer Dell BT cards

Quoted 11 lines · On Sat, 2008-04-05 at 10:58 -0500, [email protected] wrote:

Bastien,

I'll be glad to update the coding style to match the rest of the source. Please see the updated attachment. Both of these adapters are just bluetooth cards that ship on the laptop, not the dongles that come with a keyboard or mouse.

This is the way the cards function in Windows, and the way that they were intended to function. When paired with a HID keyboard and/or mouse, they have the ability to store that pairing in the firmware. That's why they have the two modes.

Right. Do you have any documentation on how to store that pairing information inside the adapter, or does it work out of the box in Linux already?

Quoted 3 lines

In reading your question, do you have a problem with a particular mouse &/or keyboard combo that the dongle isn't working 'out of the box'?

I've mainly got experience with Logitech dongles and Apple internal adapters that do the same, but we're lacking documentation to make those work properly.

Any documentation about the Dell kit would help.

Cheers

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#5 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCI switching supportfornewer Dell BT cards

Bastien,

I don't believe the BlueZ/hci_usb setup can currently store the pairing in the adapter, but I'll investigate this week. Currently the infrastructure should allow a pairing that was set in Windows to still live inside the adapter and transition to Linux per my understanding.

I'll see what documentation I can obtain from our Bluetooth Team that would be available for public release. No promises there though :)

Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

-----Original Message-----
From: Bastien Nocera [mailto:[email protected]]
Sent: Sun 4/6/2008 5:42 PM
To: BlueZ development
Cc: Limonciello, Mario
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCI switching supportfornewer Dell BT cards

Quoted 11 lines · On Sat, 2008-04-05 at 10:58 -0500, [email protected] wrote:

Bastien,

I'll be glad to update the coding style to match the rest of the source. Please see the updated attachment. Both of these adapters are just bluetooth cards that ship on the laptop, not the dongles that come with a keyboard or mouse.

This is the way the cards function in Windows, and the way that they were intended to function. When paired with a HID keyboard and/or mouse, they have the ability to store that pairing in the firmware. That's why they have the two modes.

Right. Do you have any documentation on how to store that pairing information inside the adapter, or does it work out of the box in Linux already?

Quoted 3 lines

In reading your question, do you have a problem with a particular mouse &/or keyboard combo that the dongle isn't working 'out of the box'?

I've mainly got experience with Logitech dongles and Apple internal adapters that do the same, but we're lacking documentation to make those work properly.

Any documentation about the Dell kit would help.

Cheers

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCI switchingsupportfornewer Dell BT cards

Bastien,

I spoke with some folks regarding documentation, and they are weighing their options on the best route to do development on these devices. (Releasing documentation, or doing patches themselves and submitting).

Speaking of which, has my patch been applied to the tree yet?

Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

-----Original Message-----
From: [email protected] on behalf of [email protected]
Sent: Sun 4/6/2008 7:58 PM
To: [email protected]; [email protected]
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCI switchingsupportfornewer Dell BT cards

Bastien,

I don't believe the BlueZ/hci_usb setup can currently store the pairing in the adapter, but I'll investigate this week. Currently the infrastructure should allow a pairing that was set in Windows to still live inside the adapter and transition to Linux per my understanding.

I'll see what documentation I can obtain from our Bluetooth Team that would be available for public release. No promises there though :)

Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

-----Original Message-----
From: Bastien Nocera [mailto:[email protected]]
Sent: Sun 4/6/2008 5:42 PM
To: BlueZ development
Cc: Limonciello, Mario
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCI switching supportfornewer Dell BT cards

Quoted 11 lines · On Sat, 2008-04-05 at 10:58 -0500, [email protected] wrote:

Bastien,

I'll be glad to update the coding style to match the rest of the source. Please see the updated attachment. Both of these adapters are just bluetooth cards that ship on the laptop, not the dongles that come with a keyboard or mouse.

This is the way the cards function in Windows, and the way that they were intended to function. When paired with a HID keyboard and/or mouse, they have the ability to store that pairing in the firmware. That's why they have the two modes.

Right. Do you have any documentation on how to store that pairing information inside the adapter, or does it work out of the box in Linux already?

Quoted 3 lines

In reading your question, do you have a problem with a particular mouse &/or keyboard combo that the dongle isn't working 'out of the box'?

I've mainly got experience with Logitech dongles and Apple internal adapters that do the same, but we're lacking documentation to make those work properly.

Any documentation about the Dell kit would help.

Cheers

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCIswitchingsupportfornewer Dell BT cards

Hi Guys,

I've seen at least one other patch that flew by added to CVS already. Are there any other objections that just haven't been vocalized regarding this patch?

Regards,

Mario Limonciello
Dell | Linux Engineering
[email protected]

-----Original Message-----
From: [email protected] on behalf of [email protected]
Sent: Sun 4/13/2008 11:34 AM
To: [email protected]; [email protected]; [email protected]
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCIswitchingsupportfornewer Dell BT cards

Bastien,

I spoke with some folks regarding documentation, and they are weighing their options on the best route to do development on these devices. (Releasing documentation, or doing patches themselves and submitting).

Speaking of which, has my patch been applied to the tree yet?

Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

-----Original Message-----
From: [email protected] on behalf of [email protected]
Sent: Sun 4/6/2008 7:58 PM
To: [email protected]; [email protected]
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCI switchingsupportfornewer Dell BT cards

Bastien,

I don't believe the BlueZ/hci_usb setup can currently store the pairing in the adapter, but I'll investigate this week. Currently the infrastructure should allow a pairing that was set in Windows to still live inside the adapter and transition to Linux per my understanding.

I'll see what documentation I can obtain from our Bluetooth Team that would be available for public release. No promises there though :)

Mario Limonciello
Dell | Linux Engineering
Desk : (512) 723-0582
[email protected]

-----Original Message-----
From: Bastien Nocera [mailto:[email protected]]
Sent: Sun 4/6/2008 5:42 PM
To: BlueZ development
Cc: Limonciello, Mario
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCI switching supportfornewer Dell BT cards

Quoted 11 lines · On Sat, 2008-04-05 at 10:58 -0500, [email protected] wrote:

Bastien,

I'll be glad to update the coding style to match the rest of the source. Please see the updated attachment. Both of these adapters are just bluetooth cards that ship on the laptop, not the dongles that come with a keyboard or mouse.

This is the way the cards function in Windows, and the way that they were intended to function. When paired with a HID keyboard and/or mouse, they have the ability to store that pairing in the firmware. That's why they have the two modes.

Right. Do you have any documentation on how to store that pairing information inside the adapter, or does it work out of the box in Linux already?

Quoted 3 lines

In reading your question, do you have a problem with a particular mouse &/or keyboard combo that the dongle isn't working 'out of the box'?

I've mainly got experience with Logitech dongles and Apple internal adapters that do the same, but we're lacking documentation to make those work properly.

Any documentation about the Dell kit would help.

Cheers

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#8 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCIswitchingsupportfornewer Dell BT cards

Hi Mario,

Quoted 1 line

I've seen at least one other patch that flew by added to CVS already. Are there any other objections that just haven't been vocalized regarding this patch?

that was me being lazy or too busy. Whatever you wanna call it. Patch has been committed to the CVS in a slight modified version.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#9 lore raw

Re: [Bluez-devel] [PATCH] Add HID->HCIswitchingsupportfornewer DellBT cards

Thanks Marcel.

Mario Limonciello
Dell | Linux Engineering
[email protected]

________________________________

From: [email protected] on behalf of Marcel Holtmann
Sent: Fri 5/9/2008 4:40 AM
To: BlueZ development
Cc: [email protected]
Subject: Re: [Bluez-devel] [PATCH] Add HID->HCIswitchingsupportfornewer DellBT cards

Hi Mario,

Quoted 1 line

I've seen at least one other patch that flew by added to CVS already. Are there any other objections that just haven't been vocalized regarding this patch?

that was me being lazy or too busy. Whatever you wanna call it. Patch has been committed to the CVS in a slight modified version.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel