Skip to contentSkip to conversation

Esco implementation patch

Bluez-devel Sumeet VERMA 6 participants 24 messages Apr 25, 2007 – May 4, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Marcel
I have done an implementation of esco in bluez kernel. I have hardcoded the settings of eSCO connection at the moment (packet type EV3). Please review it and feel free to make modifications. This is working fine on my side. I changed the 2.6.20 kernel code.

Thanks and Regards,
Sumeet

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

maintainer
#1 lore raw

Hi Sumeet,

Quoted 2 lines

I have done an implementation of esco in bluez kernel. I have hardcoded the settings of eSCO connection at the moment (packet type EV3). Please review it and feel free to make modifications. This is working fine on my side. I changed the 2.6.20 kernel code.

your patch is reverse and please don't send separate patches for each file. Create a big diff that includes all changes.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Hi Marcel
Sorry for the mistake. Please find a single diff attached.

Regards,
Sumeet
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcel Holtmann
Sent: Wednesday, April 25, 2007 1:14 PM
To: BlueZ development
Subject: Re: [Bluez-devel] Esco implementation patch

Hi Sumeet,

Quoted 1 line

I have done an implementation of esco in bluez kernel. I have hardcoded

the settings of eSCO connection at the moment (packet type EV3).

Quoted 1 line

Please review it and feel free to make modifications. This is working fine

on my side. I changed the 2.6.20 kernel code.

your patch is reverse and please don't send separate patches for each file. Create a big diff that includes all changes.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

escopatch/include/hci_core.h renamed from orig/include/hci_core.h +1 -0
diff -ur ../orig/include/hci_core.h ../escopatch/include/hci_core.h
@@ -308,6 +308,7 @@
 void hci_acl_connect(struct hci_conn *conn);
 void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
 void hci_add_sco(struct hci_conn *conn, __u16 handle);
+void hci_add_esco(struct hci_conn *conn, __u16 handle);
 
 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
 int    hci_conn_del(struct hci_conn *conn);
escopatch/include/hci.h renamed from orig/include/hci.h +36 -0
diff -ur ../orig/include/hci.h ../escopatch/include/hci.h
@@ -138,6 +138,7 @@
 /* Baseband links */
 #define SCO_LINK	0x00
 #define ACL_LINK	0x01
+#define ESCO_LINK	0x02
 
 /* LMP features */
 #define LMP_3SLOT	0x01
@@ -337,6 +338,28 @@
 	__le16   pkt_type;
 } __attribute__ ((packed));
 
+#define OCF_SETUP_SYNC_CONN	0x0028
+struct hci_cp_setup_sync_conn {
+	__le16	handle;
+	__u32	tx_bw;
+	__u32	rx_bw;
+	__le16	max_latency;
+	__le16	voice_setting;
+	__u8 	retx_effort;
+	__le16	pkt_type;	
+} __attribute__ ((packed));
+
+#define OCF_ACCEPT_SYNC_CONN	0x0029
+struct hci_cp_accept_sync_conn {
+	bdaddr_t bdaddr;
+	__u32	tx_bw;
+	__u32	rx_bw;
+	__le16	max_latency;
+	__le16	content_format;
+	__u8	retx_effort;
+	__le16	pkt_type;	
+} __attribute__ ((packed));
+
 #define OCF_INQUIRY		0x0001
 struct hci_cp_inquiry {
 	__u8     lap[3];
@@ -662,6 +685,19 @@
 	__le16   max_local_timeout;
 } __attribute__ ((packed));
 
+#define HCI_EV_SYNC_CONN_COMPLETE  0x2C
+struct hci_ev_sync_conn_complete {
+	__u8	status;
+	__le16	handle;
+	bdaddr_t bdaddr;
+	__u8	link_type;
+	__u8	tx_interval;
+	__u8	retx_window;
+	__le16	rx_pkt_len;
+	__le16	tx_pkt_len;
+	__u8	air_mode;
+} __attribute__ ((packed));
+
 /* Internal events generated by Bluetooth stack */
 #define HCI_EV_STACK_INTERNAL	0xFD
 struct hci_ev_stack_internal {
escopatch/src/bluetooth.mod.c renamed from orig/src/bluetooth.mod.c +1 -1
diff -ur ../orig/src/bluetooth.mod.c ../escopatch/src/bluetooth.mod.c
@@ -125,4 +125,4 @@
 "depends=";
 
 
-MODULE_INFO(srcversion, "0DEF4A4EF3FAE1E27E3D437");
+MODULE_INFO(srcversion, "72AB206AE1E9B57B1430323");
escopatch/src/hci_conn.c renamed from orig/src/hci_conn.c +42 -8

76 lines not on this page · raw message

escopatch/src/hci_event.c renamed from orig/src/hci_event.c +126 -1

158 lines not on this page · raw message

escopatch/src/l2cap.mod.c renamed from orig/src/l2cap.mod.c +1 -1
diff -ur ../orig/src/l2cap.mod.c ../escopatch/src/l2cap.mod.c
@@ -101,4 +101,4 @@
 "depends=bluetooth";
 
 
-MODULE_INFO(srcversion, "75EF27EE0CCFFB206FCB9E2");
+MODULE_INFO(srcversion, "E07DDD764CA7D15B51CEB74");
escopatch/src/sco.c renamed from orig/src/sco.c +6 -3
diff -ur ../orig/src/sco.c ../escopatch/src/sco.c
@@ -200,7 +200,8 @@
 
 	err = -ENOMEM;
 
-	hcon = hci_connect(hdev, SCO_LINK, dst);
+	//hcon = hci_connect(hdev, SCO_LINK, dst);
+	hcon = hci_connect(hdev, ESCO_LINK, dst); 
 	if (!hcon)
 		goto done;
 
@@ -846,8 +847,9 @@
 {
 	BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
 
-	if (hcon->type != SCO_LINK)
+	if ((hcon->type != SCO_LINK) && (hcon->type != ESCO_LINK)) { 
 		return 0;
+	}
 
 	if (!status) {
 		struct sco_conn *conn;
@@ -865,8 +867,9 @@
 {
 	BT_DBG("hcon %p reason %d", hcon, reason);
 
-	if (hcon->type != SCO_LINK)
+	if ((hcon->type != SCO_LINK) && (hcon->type != ESCO_LINK)) { 
 		return 0;
+	}
 
 	sco_conn_del(hcon, bt_err(reason));
 	return 0;
escopatch/src/sco.mod.c renamed from orig/src/sco.mod.c +1 -1
diff -ur ../orig/src/sco.mod.c ../escopatch/src/sco.mod.c
@@ -92,4 +92,4 @@
 "depends=bluetooth";
 
 
-MODULE_INFO(srcversion, "792016A3CBF462DCE34EE81");
+MODULE_INFO(srcversion, "6E48E206EFFDE97AC6DEF28");

Only in ../escopatch/src: state

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

#3 lore raw

I'm concerned about the ADD_SCO addition to the hci_cc_link_ctl function. The Version 2.0 + EDR page 617 specifies that:

"no Command Complete event will be sent by the Controller to indicate that this command has been completed...."

To me that means that Add Sco should never trigger the hci_cc_link_ctl function?

-Denis

Quoted 33 lines · Sumeet VERMA

Hi Marcel
Sorry for the mistake. Please find a single diff attached.

Regards,
Sumeet
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcel Holtmann
Sent: Wednesday, April 25, 2007 1:14 PM
To: BlueZ development
Subject: Re: [Bluez-devel] Esco implementation patch

Hi Sumeet,

Quoted 1 line

I have done an implementation of esco in bluez kernel. I have hardcoded

the settings of eSCO connection at the moment (packet type EV3).

Quoted 2 lines

Please review it and feel free to make modifications. This is working fine

on my side. I changed the 2.6.20 kernel code.

your patch is reverse and please don't send separate patches for each file. Create a big diff that includes all changes.

Regards

Marcel

Quoted 9 lines

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Denis,

Quoted 11 lines

I'm concerned about the ADD_SCO addition to the
hci_cc_link_ctl function. The
Version 2.0 + EDR page 617 specifies that:

"no Command Complete event will be sent by the Controller to indicate that
this command has been completed...."

To me that means that Add Sco should never trigger the hci_cc_link_ctl
function?

Yes, but please also read page 611 which states "They may be implemented by a controller to allow for backwards compatibility
with a host utilizing a prior version of the specification. A host should not use these commands."

This means that a BT 2.0 controller is not expected to implement the deprecated commands.

In this case the device treats the ADD_SCO command as an unknown HCI command and thus generates a command complete event.
The point that you mentioned would be applicable if the device processes the ADD_SCO command normally.

Having said this, I agree that a problem is bound to arise when the host is BT 1.1 and it has no idea about the BT 2.0 specifications.

Best Regards,

Mayank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iQEVAwUBRjBFkPlzfQCQpKQiAQJmXggAtllspT24CRt62TK6RL810xjq/DCXxKbk Nn9JSCph2ev+jHdyvdBIWgfUAw0HEWZDJn82/9il4t3+AjiL6eCvCtYcxBAbvHXa GGOzDknA2B133dRmJsR0bwHhO2e8fSLMYyiTMV2OINF52UHlHZKtqfy2oOGhGc2F LqO0KxRFZ8Gt4LqoakWW7wyM1n22ny62QzBsP01hE/zTrMInMFSCNv+M6MgqQCW4 EUW5JWKQe72g3FMTS+NBAWhED3v69ckDWBLlHlFIS2OSARbh19bNC2O+f1BF9oZU 3riR6GDlnW2mvB6O002ImlABp2ZlYD2g4fofPgFGHBaNNp6gjG5SSQ== =kZ/x
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#5 lore raw
In reply to Denis KENZIOR

Denis
Actually when the ADD_SCO_CONNECTION is not supported a command complete is generated with the status 0x01 (Unknown HCI Command). The controller doesn't know about this command at all. If the controller had known about this command then it will generate a command status with suitable status code.

Regards,
Sumeet
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Denis KENZIOR
Sent: Thursday, April 26, 2007 10:49 AM
To: [email protected]
Subject: Re: [Bluez-devel] Esco implementation patch

I'm concerned about the ADD_SCO addition to the hci_cc_link_ctl function. The Version 2.0 + EDR page 617 specifies that:

"no Command Complete event will be sent by the Controller to indicate that this command has been completed...."

To me that means that Add Sco should never trigger the hci_cc_link_ctl function?

-Denis

Quoted 18 lines · Sumeet VERMA

Hi Marcel
Sorry for the mistake. Please find a single diff attached.

Regards,
Sumeet
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcel Holtmann
Sent: Wednesday, April 25, 2007 1:14 PM
To: BlueZ development
Subject: Re: [Bluez-devel] Esco implementation patch

Hi Sumeet,

Quoted 2 lines

I have done an implementation of esco in bluez kernel. I have hardcoded

Quoted 8 lines

the settings of eSCO connection at the moment (packet type EV3).

Quoted 2 lines

Please review it and feel free to make modifications. This is working fine

on my side. I changed the 2.6.20 kernel code.

your patch is reverse and please don't send separate patches for each

file.

Quoted 8 lines

Create a big diff that includes all changes.

Regards

Marcel

Quoted 9 lines

----------------------------------------------------------------------
--- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

Sumeet,

Yep you are correct. However what I'm trying to say is that if the adapter is Bluetooth 1.2+ compatible and implements Add Sco Connection for backward compatibility, then the faster eSCO alternative will never be used. Most of the Bluetooth 1.2+ USB adapters I've had experience with, do implement the Add Sco command for backward compatibility.

Shouldn't we try to query the Adapter version first and then use the commands which are appropriate?

-Denis

Quoted 10 lines

Denis
Actually when the ADD_SCO_CONNECTION is not supported a command complete is
generated with the status 0x01 (Unknown HCI Command). The controller doesn't
know about this command at all. If the controller had known about this command then it will generate a command status with suitable status code.

Regards,
Sumeet

-----------------------------------------
Trolltech ASA, Sandakerveien 116, PO Box 4332, Nydalen NO-0402 Oslo, Norway

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw

Denis
Yes I think that's a good idea. I think the change required is very minimal. In sco.c whether I create a SCO or ESCO link depends on the version which is readily available in hci_dev structure. Its just a matter of adding a conditional statement (if else). Maybe I can also to check the feature bit mask. I will try this.

Regards,
Sumeet
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Thursday, April 26, 2007 3:49 PM
To: BlueZ development
Subject: Re: [Bluez-devel] Esco implementation patch

Sumeet,

Yep you are correct. However what I'm trying to say is that if the adapter is Bluetooth 1.2+ compatible and implements Add Sco Connection for backward compatibility, then the faster eSCO alternative will never be used. Most of the Bluetooth 1.2+ USB adapters I've had experience with, do implement the Add Sco command for backward compatibility.

Shouldn't we try to query the Adapter version first and then use the commands which are appropriate?

-Denis

Quoted 9 lines

Denis
Actually when the ADD_SCO_CONNECTION is not supported a command complete is generated with the status 0x01 (Unknown HCI Command). The controller doesn't know about this command at all. If the controller had known about this command then it will generate a command status with suitable status code.

Regards,
Sumeet

-----------------------------------------
Trolltech ASA, Sandakerveien 116, PO Box 4332, Nydalen NO-0402 Oslo, Norway

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#8 lore raw

Hi Sumeet,

Quoted 5 lines

Yes I think that's a good idea. I think the change required is very minimal. In sco.c whether I create a SCO or ESCO link depends on the version which is readily available in hci_dev structure. Its just a matter of adding a conditional statement (if else). Maybe I can also to check the feature bit mask. I will try this.

don't use the version information. Use the features bits and check for the LMP_ESCO bit.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#9 lore raw
In reply to Sumeet VERMA

Hi Sumeet,

Quoted 4 lines

Actually when the ADD_SCO_CONNECTION is not supported a command complete is generated with the status 0x01 (Unknown HCI Command). The controller doesn't know about this command at all. If the controller had known about this command then it will generate a command status with suitable status code.

I reviewed that patch and the current attempt to support eSCO is wrong and eSCO shouldn't be an alternate if SCO fails. In case the LMP_ESCO features bit is set, then we should always use the new eSCO commands to setup the audio link. Only in case of Bluetooth 1.1 adapters and earlier we fall back to the old SCO setup. My understanding is that the new eSCO setup routine of Bluetooth 1.2 chips or later can handle the remote Bluetooth 1.1 devices without problems.

Please also use le32 for 32-bit size variables in HCI commands and events. Don't diff *.mod.c files. These are auto-generated.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#10 lore raw

Marcel
I have corrected the mistakes. Please review the attached patch and let me know if this is fine.

Regards,
Sumeet
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcel Holtmann
Sent: Friday, April 27, 2007 1:11 AM
To: BlueZ development
Subject: Re: [Bluez-devel] Esco implementation patch

Hi Sumeet,

Quoted 4 lines

Actually when the ADD_SCO_CONNECTION is not supported a command complete is generated with the status 0x01 (Unknown HCI Command). The controller doesn't know about this command at all. If the controller had known about this command then it will generate a command status with

suitable status code.

I reviewed that patch and the current attempt to support eSCO is wrong and eSCO shouldn't be an alternate if SCO fails. In case the LMP_ESCO features bit is set, then we should always use the new eSCO commands to setup the audio link. Only in case of Bluetooth 1.1 adapters and earlier we fall back to the old SCO setup. My understanding is that the new eSCO setup routine of Bluetooth 1.2 chips or later can handle the remote Bluetooth 1.1 devices without problems.

Please also use le32 for 32-bit size variables in HCI commands and events. Don't diff *.mod.c files. These are auto-generated.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

escopatch/include/hci_core.h renamed from orig/include/hci_core.h +1 -0
diff -ru ../orig/include/hci_core.h ../escopatch/include/hci_core.h
@@ -308,6 +308,7 @@
 void hci_acl_connect(struct hci_conn *conn);
 void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
 void hci_add_sco(struct hci_conn *conn, __u16 handle);
+void hci_add_esco(struct hci_conn *conn, __u16 handle);
 
 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
 int    hci_conn_del(struct hci_conn *conn);
escopatch/include/hci.h renamed from orig/include/hci.h +36 -0
diff -ru ../orig/include/hci.h ../escopatch/include/hci.h
@@ -138,6 +138,7 @@
 /* Baseband links */
 #define SCO_LINK	0x00
 #define ACL_LINK	0x01
+#define ESCO_LINK	0x02
 
 /* LMP features */
 #define LMP_3SLOT	0x01
@@ -337,6 +338,28 @@
 	__le16   pkt_type;
 } __attribute__ ((packed));
 
+#define OCF_SETUP_SYNC_CONN	0x0028
+struct hci_cp_setup_sync_conn {
+	__le16	handle;
+	__le32	tx_bw;
+	__le32	rx_bw;
+	__le16	max_latency;
+	__le16	voice_setting;
+	__u8 	retx_effort;
+	__le16	pkt_type;	
+} __attribute__ ((packed));
+
+#define OCF_ACCEPT_SYNC_CONN	0x0029
+struct hci_cp_accept_sync_conn {
+	bdaddr_t bdaddr;
+	__le32	tx_bw;
+	__le32	rx_bw;
+	__le16	max_latency;
+	__le16	content_format;
+	__u8	retx_effort;
+	__le16	pkt_type;	
+} __attribute__ ((packed));
+
 #define OCF_INQUIRY		0x0001
 struct hci_cp_inquiry {
 	__u8     lap[3];
@@ -662,6 +685,19 @@
 	__le16   max_local_timeout;
 } __attribute__ ((packed));
 
+#define HCI_EV_SYNC_CONN_COMPLETE  0x2C
+struct hci_ev_sync_conn_complete {
+	__u8	status;
+	__le16	handle;
+	bdaddr_t bdaddr;
+	__u8	link_type;
+	__u8	tx_interval;
+	__u8	retx_window;
+	__le16	rx_pkt_len;
+	__le16	tx_pkt_len;
+	__u8	air_mode;
+} __attribute__ ((packed));
+
 /* Internal events generated by Bluetooth stack */
 #define HCI_EV_STACK_INTERNAL	0xFD
 struct hci_ev_stack_internal {
escopatch/src/hci_conn.c renamed from orig/src/hci_conn.c +42 -8

76 lines not on this page · raw message

escopatch/src/hci_event.c renamed from orig/src/hci_event.c +96 -1

121 lines not on this page · raw message

escopatch/src/sco.c renamed from orig/src/sco.c +6 -3
diff -ru ../orig/src/sco.c ../escopatch/src/sco.c
@@ -200,7 +200,10 @@
 
 	err = -ENOMEM;
 
-	hcon = hci_connect(hdev, SCO_LINK, dst);
+	if(hdev->features[3] & 0x80) //LMP eSCO feature bit
+		hcon = hci_connect(hdev, ESCO_LINK, dst);
+	else 
+		hcon = hci_connect(hdev, SCO_LINK, dst); 
 	if (!hcon)
 		goto done;
 
@@ -846,7 +849,7 @@
 {
 	BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
 
-	if (hcon->type != SCO_LINK)
+	if ((hcon->type != SCO_LINK) && (hcon->type != ESCO_LINK)) 
 		return 0;
 
 	if (!status) {
@@ -865,7 +868,7 @@
 {
 	BT_DBG("hcon %p reason %d", hcon, reason);
 
-	if (hcon->type != SCO_LINK)
+	if ((hcon->type != SCO_LINK) && (hcon->type != ESCO_LINK)) 
 		return 0;
 
 	sco_conn_del(hcon, bt_err(reason));

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

maintainer
#11 lore raw

Hi Sumeet,

Quoted 2 lines

I have corrected the mistakes. Please review the attached patch and let me know if this is fine.

this patch is incomplete. It doesn't handle incoming eSCO connections and it can't handle SCO audio packets over HCI when a real eSCO connection has been established.

However it shows a more clean way to actually address eSCO support.

Regards

Marcel

include/net/bluetooth/hci.h +85 -20
index 93ce272..7a001e5 100644
@@ -114,7 +114,7 @@ enum {
 #define HCI_EVENT_PKT		0x04
 #define HCI_VENDOR_PKT		0xff
 
-/* HCI Packet types */
+/* HCI packet types */
 #define HCI_DM1		0x0008
 #define HCI_DM3		0x0400
 #define HCI_DM5		0x4000
@@ -129,6 +129,14 @@ enum {
 #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
 #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
 
+/* eSCO packet types */
+#define ESCO_HV1	0x0001
+#define ESCO_HV2	0x0002
+#define ESCO_HV3	0x0004
+#define ESCO_EV3	0x0008
+#define ESCO_EV4	0x0010
+#define ESCO_EV5	0x0020
+
 /* ACL flags */
 #define ACL_CONT		0x01
 #define ACL_START		0x02
@@ -138,6 +146,7 @@ enum {
 /* Baseband links */
 #define SCO_LINK	0x00
 #define ACL_LINK	0x01
+#define ESCO_LINK	0x02
 
 /* LMP features */
 #define LMP_3SLOT	0x01
@@ -162,6 +171,11 @@ enum {
 #define LMP_PSCHEME	0x02
 #define LMP_PCONTROL	0x04
 
+#define LMP_ESCO	0x80
+
+#define LMP_EV4		0x01
+#define LMP_EV5		0x02
+
 #define LMP_SNIFF_SUBR	0x02
 
 /* Connection modes */
@@ -296,7 +310,18 @@ struct hci_cp_host_buffer_size {
 } __attribute__ ((packed));
 
 /* Link Control */
-#define OGF_LINK_CTL	0x01 
+#define OGF_LINK_CTL	0x01
+
+#define OCF_INQUIRY		0x0001
+struct hci_cp_inquiry {
+	__u8     lap[3];
+	__u8     length;
+	__u8     num_rsp;
+} __attribute__ ((packed));
+
+#define OCF_INQUIRY_CANCEL	0x0002
+
+#define OCF_EXIT_PERIODIC_INQ	0x0004
 
 #define OCF_CREATE_CONN		0x0005
 struct hci_cp_create_conn {
@@ -319,35 +344,24 @@ struct hci_cp_accept_conn_req {
 	__u8     role;
 } __attribute__ ((packed));
 
-#define OCF_REJECT_CONN_REQ	0x000a
+#define OCF_REJECT_CONN_REQ	0x000A
 struct hci_cp_reject_conn_req {
 	bdaddr_t bdaddr;
 	__u8     reason;
 } __attribute__ ((packed));
 
-#define OCF_DISCONNECT	0x0006
+#define OCF_DISCONNECT		0x0006
 struct hci_cp_disconnect {
 	__le16   handle;
 	__u8     reason;
 } __attribute__ ((packed));
 
-#define OCF_ADD_SCO	0x0007
+#define OCF_ADD_SCO		0x0007
 struct hci_cp_add_sco {
 	__le16   handle;
 	__le16   pkt_type;
 } __attribute__ ((packed));
 
-#define OCF_INQUIRY		0x0001
-struct hci_cp_inquiry {
-	__u8     lap[3];
-	__u8     length;
-	__u8     num_rsp;
-} __attribute__ ((packed));
-
-#define OCF_INQUIRY_CANCEL	0x0002
-
-#define OCF_EXIT_PERIODIC_INQ	0x0004
-
 #define OCF_LINK_KEY_REPLY	0x000B
 struct hci_cp_link_key_reply {
 	bdaddr_t bdaddr;
@@ -398,13 +412,41 @@ struct hci_cp_read_remote_features {
 	__le16   handle;
 } __attribute__ ((packed));
 
-#define OCF_READ_REMOTE_VERSION 0x001D
+#define OCF_READ_REMOTE_VERSION	0x001D
 struct hci_cp_read_remote_version {
 	__le16   handle;
 } __attribute__ ((packed));
 
+#define OCF_SETUP_SYNC_CONN	0x0028
+struct hci_cp_setup_sync_conn {
+	__le16   handle;
+	__le32   tx_bandwidth;
+	__le32   rx_bandwidth;
+	__le16   max_latency;
+	__le16   voice_setting;
+	__u8     retrans_effort;
+	__le16   pkt_type;
+} __attribute__ ((packed));
+
+#define OCF_ACCEPT_SYNC_CONN_REQ 0x0029
+struct hci_cp_accept_sync_conn_req {
+	bdaddr_t bdaddr;
+	__le32   tx_bandwidth;
+	__le32   rx_bandwidth;
+	__le16   max_latency;
+	__le16   content_format;
+	__u8     retrans_effort;
+	__le16   pkt_type;
+} __attribute__ ((packed));
+
+#define OCF_REJECT_SYNC_CONN_REQ 0x002A
+struct hci_cp_reject_sync_conn_req {
+	bdaddr_t bdaddr;
+	__u8     reason;
+} __attribute__ ((packed));
+
 /* Link Policy */
-#define OGF_LINK_POLICY	0x02   
+#define OGF_LINK_POLICY	0x02
 
 #define OCF_SNIFF_MODE		0x0003
 struct hci_cp_sniff_mode {
@@ -516,7 +558,7 @@ struct extended_inquiry_info {
 	__u8     data[240];
 } __attribute__ ((packed));
 
-#define HCI_EV_CONN_COMPLETE 	0x03
+#define HCI_EV_CONN_COMPLETE	0x03
 struct hci_ev_conn_complete {
 	__u8     status;
 	__le16   handle;
@@ -572,7 +614,7 @@ struct hci_ev_qos_setup_complete {
 	struct   hci_qos qos;
 } __attribute__ ((packed));
 
-#define HCI_EV_CMD_COMPLETE 	0x0E
+#define HCI_EV_CMD_COMPLETE	0x0E
 struct hci_ev_cmd_complete {
 	__u8     ncmd;
 	__le16   opcode;
@@ -652,6 +694,29 @@ struct hci_ev_pscan_rep_mode {
 	__u8     pscan_rep_mode;
 } __attribute__ ((packed));
 
+#define HCI_EV_SYNC_CONN_COMPLETE	0x2C
+struct hci_ev_sync_conn_complete {
+	__u8     status;
+	__le16   handle;
+	bdaddr_t bdaddr;
+	__u8     link_type;
+	__u8     tx_interval;
+	__u8     retrans_window;
+	__le16   rx_pkt_len;
+	__le16   tx_pkt_len;
+	__u8     air_mode;
+} __attribute__ ((packed));
+
+#define HCI_EV_SYNC_CONN_CHANGED	0x2D
+struct hci_ev_sync_conn_changed {
+	__u8     status;
+	__le16   handle;
+	__u8     tx_interval;
+	__u8     retrans_window;
+	__le16   rx_pkt_len;
+	__le16   tx_pkt_len;
+} __attribute__ ((packed));
+
 #define HCI_EV_SNIFF_SUBRATE	0x2E
 struct hci_ev_sniff_subrate {
 	__u8     status;
include/net/bluetooth/hci_core.h +3 -0
index c0fc396..6e71886 100644
@@ -78,6 +78,7 @@ struct hci_dev {
 	__u16		voice_setting;
 
 	__u16		pkt_type;
+	__u16		esco_type;
 	__u16		link_policy;
 	__u16		link_mode;
 
@@ -308,6 +309,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
 void hci_acl_connect(struct hci_conn *conn);
 void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
 void hci_add_sco(struct hci_conn *conn, __u16 handle);
+void hci_setup_sync(struct hci_conn *conn, __u16 handle);
 
 struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
 int    hci_conn_del(struct hci_conn *conn);
@@ -449,6 +451,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 #define lmp_encrypt_capable(dev)   ((dev)->features[0] & LMP_ENCRYPT)
 #define lmp_sniff_capable(dev)     ((dev)->features[0] & LMP_SNIFF)
 #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
+#define lmp_esco_capable(dev)      ((dev)->features[3] & LMP_ESCO)
 
 /* ----- HCI protocols ----- */
 struct hci_proto {
net/bluetooth/hci_conn.c +54 -26

129 lines not on this page · raw message

net/bluetooth/hci_core.c +1 -0
index aa4b56a..5d6cd1d 100644
@@ -851,6 +851,7 @@ int hci_register_dev(struct hci_dev *hdev)
 
 	hdev->flags = 0;
 	hdev->pkt_type  = (HCI_DM1 | HCI_DH1 | HCI_HV1);
+	hdev->esco_type = ESCO_HV1;
 	hdev->link_mode = (HCI_LM_ACCEPT);
 
 	hdev->idle_timeout = 0;
net/bluetooth/hci_event.c +117 -32

199 lines not on this page · raw message

net/bluetooth/sco.c +6 -4
index 3f5163e..2334294 100644
@@ -189,7 +189,7 @@ static int sco_connect(struct sock *sk)
 	struct sco_conn *conn;
 	struct hci_conn *hcon;
 	struct hci_dev  *hdev;
-	int err = 0;
+	int err, type;
 
 	BT_DBG("%s -> %s", batostr(src), batostr(dst));
 
@@ -200,7 +200,9 @@ static int sco_connect(struct sock *sk)
 
 	err = -ENOMEM;
 
-	hcon = hci_connect(hdev, SCO_LINK, dst);
+	type = lmp_esco_capable(hdev) ? ESCO_LINK : SCO_LINK;
+
+	hcon = hci_connect(hdev, type, dst);
 	if (!hcon)
 		goto done;
 
@@ -846,7 +848,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status)
 {
 	BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
 
-	if (hcon->type != SCO_LINK)
+	if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
 		return 0;
 
 	if (!status) {
@@ -865,7 +867,7 @@ static int sco_disconn_ind(struct hci_conn *hcon, __u8 reason)
 {
 	BT_DBG("hcon %p reason %d", hcon, reason);
 
-	if (hcon->type != SCO_LINK)
+	if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
 		return 0;
 
 	sco_conn_del(hcon, bt_err(reason));

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

#12 lore raw

Marcel,

Here's a modified patch that implements eSCO sockets, including incoming SCO connections. This was a merge of my previous work for the 2.4 series of kernels, so some variables might be named differently than in your patch.

I've tested it on several machines here, including eSco->eSco connection, eSco->sco connection for both incoming and outgoing scenarios, everything seems fine, however I'm sure more testing is required.

Quoted 3 lines

this patch is incomplete. It doesn't handle incoming eSCO connections and it can't handle SCO audio packets over HCI when a real eSCO connection has been established.

Why do you say this? What is required in order to get eSCO packets flowing?

-Denis

include/net/bluetooth/hci_core.h +2 -0
diff -r -p -U5 linux-2.6.20.7/include/net/bluetooth/hci_core.h linux-2.6.20.7-dkenzior/include/net/bluetooth/hci_core.h
@@ -76,10 +76,11 @@ struct hci_dev {
 	__u16		hci_rev;
 	__u16		manufacturer;
 	__u16		voice_setting;
 
 	__u16		pkt_type;
+	__u16		esco_pkt_type;
 	__u16		link_policy;
 	__u16		link_mode;
 
 	__u32		idle_timeout;
 	__u16		sniff_min_interval;
@@ -447,10 +448,11 @@ void hci_conn_del_sysfs(struct hci_conn 
 /* ----- LMP capabilities ----- */
 #define lmp_rswitch_capable(dev)   ((dev)->features[0] & LMP_RSWITCH)
 #define lmp_encrypt_capable(dev)   ((dev)->features[0] & LMP_ENCRYPT)
 #define lmp_sniff_capable(dev)     ((dev)->features[0] & LMP_SNIFF)
 #define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
+#define lmp_esco_capable(dev)      ((dev)->features[3] & LMP_ESCO)
 
 /* ----- HCI protocols ----- */
 struct hci_proto {
 	char 		*name;
 	unsigned int	id;
include/net/bluetooth/hci.h +70 -0

135 lines not on this page · raw message

net/bluetooth/hci_conn.c +46 -29

143 lines not on this page · raw message

net/bluetooth/hci_core.c +1 -0
diff -r -p -U5 linux-2.6.20.7/net/bluetooth/hci_core.c linux-2.6.20.7-dkenzior/net/bluetooth/hci_core.c
@@ -849,10 +849,11 @@ int hci_register_dev(struct hci_dev *hde
 	atomic_set(&hdev->refcnt, 1);
 	spin_lock_init(&hdev->lock);
 
 	hdev->flags = 0;
 	hdev->pkt_type  = (HCI_DM1 | HCI_DH1 | HCI_HV1);
+	hdev->esco_pkt_type = HCI_ESCO_HV1;
 	hdev->link_mode = (HCI_LM_ACCEPT);
 
 	hdev->idle_timeout = 0;
 	hdev->sniff_max_interval = 800;
 	hdev->sniff_min_interval = 80;
net/bluetooth/hci_event.c +175 -44

311 lines not on this page · raw message

net/bluetooth/sco.c +9 -4
diff -r -p -U5 linux-2.6.20.7/net/bluetooth/sco.c linux-2.6.20.7-dkenzior/net/bluetooth/sco.c
@@ -187,22 +187,24 @@ static int sco_connect(struct sock *sk)
 	bdaddr_t *src = &bt_sk(sk)->src;
 	bdaddr_t *dst = &bt_sk(sk)->dst;
 	struct sco_conn *conn;
 	struct hci_conn *hcon;
 	struct hci_dev  *hdev;
-	int err = 0;
+	int err, type;
 
 	BT_DBG("%s -> %s", batostr(src), batostr(dst));
 
 	if (!(hdev = hci_get_route(dst, src)))
 		return -EHOSTUNREACH;
 
 	hci_dev_lock_bh(hdev);
 
 	err = -ENOMEM;
 
-	hcon = hci_connect(hdev, SCO_LINK, dst);
+	type = lmp_esco_capable(hdev) ? ESCO_LINK : SCO_LINK;
+
+	hcon = hci_connect(hdev, type, dst);
 	if (!hcon)
 		goto done;
 
 	conn = sco_conn_add(hcon, 0);
 	if (!conn) {
@@ -836,19 +838,22 @@ done:
 /* ----- SCO interface with lower layer (HCI) ----- */
 static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
 {
 	BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr));
 
+	if (type != SCO_LINK && type != ESCO_LINK)
+		return 0;
+
 	/* Always accept connection */
 	return HCI_LM_ACCEPT;
 }
 
 static int sco_connect_cfm(struct hci_conn *hcon, __u8 status)
 {
 	BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status);
 
-	if (hcon->type != SCO_LINK)
+	if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
 		return 0;
 
 	if (!status) {
 		struct sco_conn *conn;
 
@@ -863,11 +868,11 @@ static int sco_connect_cfm(struct hci_co
 
 static int sco_disconn_ind(struct hci_conn *hcon, __u8 reason)
 {
 	BT_DBG("hcon %p reason %d", hcon, reason);
 
-	if (hcon->type != SCO_LINK)
+	if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK)
 		return 0;
 
 	sco_conn_del(hcon, bt_err(reason));
 	return 0;
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

#13 lore raw
Quoted 4 lines · Denis KENZIOR

Here's a modified patch that implements eSCO sockets, including incoming SCO connections. This was a merge of my previous work for the 2.4 series of kernels, so some variables might be named differently than in your patch.

How about the 2-EV* and 3-EV* packet types? The spec says that a 0 for these bits means they have been enabled. Shouldn't you also check for their support in the feature mask?

Quoted 4 lines

I've tested it on several machines here, including eSco->eSco connection, eSco->sco connection for both incoming and outgoing scenarios, everything seems fine, however I'm sure more testing is required.

How did you mangage to set up an eSCO since you are using only HV* packet types (ESCO_PTYPE_MASK)? Or is it because the 2-EV* and 3-EV* bits are "0" thus the controller thinks you want to enable those packet types?

Quoted 6 lines
Quoted 3 lines

this patch is incomplete. It doesn't handle incoming eSCO connections and it can't handle SCO audio packets over HCI when a real eSCO connection has been established.

Why do you say this? What is required in order to get eSCO packets flowing?

Regards,

Mayank

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#14 lore raw

Mayank,

Quoted 3 lines

How about the 2-EV* and 3-EV* packet types? The spec says that a 0 for these bits means they have been enabled. Shouldn't you also check for their support in the feature mask?

Good question. I'm not entirely sure of this, however I did not interpret the specification in this manner. All it says is that there is a specific feature mask to disable 2-EV and 3-EV packets. There is nothing to say whether or not they are explicitly enabled. Also the examples in the specification use the esco feature masks in the same manner as I do. So I would assume that if EV3 support is not enabled, then 2-EV3 and 3-EV3 packets will not be used by the controller as well. However, I could be wrong.

Quoted 9 lines
Quoted 5 lines

I've tested it on several machines here, including eSco->eSco connection, eSco->sco connection for both incoming and outgoing scenarios, everything seems fine, however I'm sure more testing is required.

How did you mangage to set up an eSCO since you are using only HV* packet types (ESCO_PTYPE_MASK)? Or is it because the 2-EV* and 3-EV* bits are "0" thus the controller thinks you want to enable those packet types?

Well, it comes down to what the controller labels as an eSCO connection. E.g. the link_type returned in the connection complete and sync connection complete events. Doing BlueZ<->BlueZ which both use the patch, I get link_type of eSCO. Doing BlueZ<->BlueZ with one end not using the patch, I get a link_type of SCO. Perhaps it is the particular hardware I'm using?

Setup is a STLC2500 serial device connected to a BT1.2 USB dongle on a non-patched kernel and a BT 2.0 USB dongle on a patched kernel.

Regards,
-Denis

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#15 lore raw

Hi Denis,

Quoted 11 lines
Quoted 3 lines

How about the 2-EV* and 3-EV* packet types? The spec says that a 0 for these bits means they have been enabled. Shouldn't you also check for their support in the feature mask?

Good question. I'm not entirely sure of this, however I did not interpret the specification in this manner. All it says is that there is a specific feature mask to disable 2-EV and 3-EV packets. There is nothing to say whether or not they are explicitly enabled. Also the examples in the specification use the esco feature masks in the same manner as I do. So I would assume that if EV3 support is not enabled, then 2-EV3 and 3-EV3 packets will not be used by the controller as well. However, I could be wrong.

don't worry about packet types. This is the link managers job. Enable as much packet types as possible.

Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

I've tested it on several machines here, including eSco->eSco connection, eSco->sco connection for both incoming and outgoing scenarios, everything seems fine, however I'm sure more testing is required.

How did you mangage to set up an eSCO since you are using only HV* packet types (ESCO_PTYPE_MASK)? Or is it because the 2-EV* and 3-EV* bits are "0" thus the controller thinks you want to enable those packet types?

Quoted 5 lines

Well, it comes down to what the controller labels as an eSCO connection. E.g. the link_type returned in the connection complete and sync connection complete events. Doing BlueZ<->BlueZ which both use the patch, I get link_type of eSCO. Doing BlueZ<->BlueZ with one end not using the patch, I get a link_type of SCO. Perhaps it is the particular hardware I'm using?

No. It is the difference between using Accept Connection Request or Accept Synchronous Connection Request. In the first case it has to fall back to SCO since it has no further information on how to negotiate an eSCO link.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#16 lore raw

Hi Marcel,

Quoted 13 lines · Marcel Holtmann
Quoted 4 lines
Quoted 3 lines

How about the 2-EV* and 3-EV* packet types? The spec says that a 0 for these bits means they have been enabled. Shouldn't you also check for their support in the feature mask?

Quoted 8 lines

Good question. I'm not entirely sure of this, however I did not interpret the specification in this manner. All it says is that there is a specific feature mask to disable 2-EV and 3-EV packets. There is nothing to say whether or not they are explicitly enabled. Also the examples in the specification use the esco feature masks in the same manner as I do. So I would assume that if EV3 support is not enabled, then 2-EV3 and 3-EV3 packets will not be used by the controller as well. However, I could be wrong.

Quoted 2 lines

don't worry about packet types. This is the link managers job. Enable as much packet types as possible.

But you'll fall into trouble if the local controller does not support the packet type that you've enabled.
In Denis' case it worked because the device supported the 2-EV* and 3-EV* packet types and he "accidentaly" enabled them.
Why not check their support in the feature mask as well?

Regards,

Mayank

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#18 lore raw
In reply to Marcel Holtmann

Marcel,

Quoted 2 lines

don't worry about packet types. This is the link managers job. Enable as much packet types as possible.

OK, that is what I thought as well.

Quoted 5 lines

No. It is the difference between using Accept Connection Request or Accept Synchronous Connection Request. In the first case it has to fall back to SCO since it has no further information on how to negotiate an eSCO link.

This is strange, because I would send an accept_sync_conn, get a sync_conn_complete_event and the link_type would be 0x0 (SCO) when connecting to an unpatched BlueZ box. Again, I imagine more testing is required.

Regards,

-Denis

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#20 lore raw
In reply to Denis KENZIOR

Hi Denis,

Quoted 3 lines

Here's a modified patch that implements eSCO sockets, including incoming SCO connections. This was a merge of my previous work for the 2.4 series of kernels, so some variables might be named differently than in your patch.

please make sure you use my naming of variables. Otherwise it is too much confusion. And please create a patch relative to this one so I can actually review it. And please keep hci_setup_sync(). Doing the separation this way it more logical than hacking up hci_add_sco(). The function that decides which command to use should be hci_connect().

Quoted 5 lines
Quoted 3 lines

this patch is incomplete. It doesn't handle incoming eSCO connections and it can't handle SCO audio packets over HCI when a real eSCO connection has been established.

Why do you say this? What is required in order to get eSCO packets flowing?

If you have type == ESCO_LINK then the kernel doesn't send these packets over the transport layer.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#19 lore raw
In reply to Denis KENZIOR

Hi Denis,

Quoted 8 lines
Quoted 4 lines

No. It is the difference between using Accept Connection Request or Accept Synchronous Connection Request. In the first case it has to fall back to SCO since it has no further information on how to negotiate an eSCO link.

This is strange, because I would send an accept_sync_conn, get a sync_conn_complete_event and the link_type would be 0x0 (SCO) when connecting to an unpatched BlueZ box. Again, I imagine more testing is required.

but the unpatched side replies with a Accept Connection Request and this can only lead to a SCO link since no additional parameters for the eSCO negotiation are available.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#17 lore raw
In reply to Mayank BATRA

Hi Mayank,

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 3 lines

How about the 2-EV* and 3-EV* packet types? The spec says that a 0 for these bits means they have been enabled. Shouldn't you also check for their support in the feature mask?

Good question. I'm not entirely sure of this, however I did not interpret the specification in this manner. All it says is that there is a specific feature mask to disable 2-EV and 3-EV packets. There is nothing to say whether or not they are explicitly enabled. Also the examples in the specification use the esco feature masks in the same manner as I do. So I would assume that if EV3 support is not enabled, then 2-EV3 and 3-EV3 packets will not be used by the controller as well. However, I could be wrong.

Quoted 8 lines
Quoted 2 lines

don't worry about packet types. This is the link managers job. Enable as much packet types as possible.

But you'll fall into trouble if the local controller does not support the packet type that you've enabled.
In Denis' case it worked because the device supported the 2-EV* and 3-EV* packet types and he "accidentaly" enabled them.
Why not check their support in the feature mask as well?

this is not needed. Unknown or reserved bits should be ignored. That is the job of the link manager. And btw. it works fine for ACL EDR packets. If you have a problem then the link manager firmware authors read the specification wrong.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#21 lore raw
In reply to Marcel Holtmann

Marcel,

Quoted 5 lines

please make sure you use my naming of variables. Otherwise it is too much confusion. And please create a patch relative to this one so I can actually review it. And please keep hci_setup_sync(). Doing the separation this way it more logical than hacking up hci_add_sco(). The function that decides which command to use should be hci_connect().

Attached is a patch against yours.

Can you point me in the right direction with regard to adding ESCO packets to be transported over HCI?

Also, I noticed that SCO connections are accepted regardless of whether a SCO socket is open or not. Is this intended?

-Denis

include/net/bluetooth/hci.h +5 -0
diff -p -U5 -r linux-2.6.21.1/include/net/bluetooth/hci.h linux-2.6.21.1-dkenzior/include/net/bluetooth/hci.h
@@ -135,10 +135,15 @@ enum {
 #define ESCO_HV3	0x0004
 #define ESCO_EV3	0x0008
 #define ESCO_EV4	0x0010
 #define ESCO_EV5	0x0020
 
+/* Some devices seem to have trouble establishing EV* packet connections */
+/* with other devices.  For this reason we mask out the eSCO packets */ 
+/* for now.  Might need to address this later */
+#define ESCO_PTYPE_MASK	(ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
+
 /* ACL flags */
 #define ACL_CONT		0x01
 #define ACL_START		0x02
 #define ACL_ACTIVE_BCAST	0x04
 #define ACL_PICO_BCAST		0x08
net/bluetooth/hci_conn.c +1 -1
diff -p -U5 -r linux-2.6.21.1/net/bluetooth/hci_conn.c linux-2.6.21.1-dkenzior/net/bluetooth/hci_conn.c
@@ -138,11 +138,11 @@ void hci_setup_sync(struct hci_conn *con
 
 	conn->state = BT_CONNECT;
 	conn->out = 1;
 
 	cp.handle   = cpu_to_le16(handle);
-	cp.pkt_type = cpu_to_le16(hdev->esco_type);
+	cp.pkt_type = cpu_to_le16(hdev->esco_type & ESCO_PTYPE_MASK);
 
 	cp.tx_bandwidth   = cpu_to_le32(0x00001f40);
 	cp.rx_bandwidth   = cpu_to_le32(0x00001f40);
 	cp.max_latency    = cpu_to_le16(0xffff);
 	cp.voice_setting  = cpu_to_le16(hdev->voice_setting);
net/bluetooth/hci_event.c +91 -43

189 lines not on this page · raw message

net/bluetooth/sco.c +3 -0
diff -p -U5 -r linux-2.6.21.1/net/bluetooth/sco.c linux-2.6.21.1-dkenzior/net/bluetooth/sco.c
@@ -838,10 +838,13 @@ done:
 /* ----- SCO interface with lower layer (HCI) ----- */
 static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
 {
 	BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr));
 
+	if (type != SCO_LINK && type != ESCO_LINK)
+		return 0;
+
 	/* Always accept connection */
 	return HCI_LM_ACCEPT;
 }
 
 static int sco_connect_cfm(struct hci_conn *hcon, __u8 status)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

#22 lore raw

[Bluez-devel] sdpd and multiple bluetooth devices

Hello,

I'm sorry I think this is a very simple question ...

I have 2 devices hci0 and hci1 and I'd like to manage services on both with sdptool.

Could you please tell me how I should configure /etc/rc.d/init.d/bluetooth
so I have 2 SDP databases, one for each device ? ... for now I just have "daemon sdpd" in this file

Then can I use sdptool -i hciN ... ?

Thanks a lot,
Oli

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#23 lore raw

Re: [Bluez-devel] sdpd and multiple bluetooth devices

Hi Olivier,

Quoted 11 lines

I'm sorry I think this is a very simple question ...

I have 2 devices hci0 and hci1 and I'd like to manage services on both with sdptool.

Could you please tell me how I should configure /etc/rc.d/init.d/bluetooth
so I have 2 SDP databases, one for each device ? ... for now I just have "daemon sdpd" in this file

Then can I use sdptool -i hciN ... ?

I think that sdptool doesn't handle the case of two different SDP databases. You have to use the Bluetooth library directly.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel