All of lore.kernel.org
 help / color / mirror / Atom feed
From: Louis JANG <louis@mizi.com>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: linux-bluetooth@vger.kernel.org,
	Marcel Holtmann <marcel@holtmann.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	bmidgley@gmail.com, David Miller <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: [Bluez-devel] forcing SCO connection patch
Date: Mon, 25 Feb 2008 20:35:22 +0900	[thread overview]
Message-ID: <47C2A7FA.2060902@mizi.com> (raw)
In-Reply-To: <a8e1da0802250155u1b7af481va203849f68d9106b@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

Dave Young 쓴 글:
> On Mon, Feb 25, 2008 at 5:28 PM, Louis JANG <louis@mizi.com> wrote:
>   
>>  > I ever asked marcel about the coding style. please see following thread:
>>  > http://lkml.org/lkml/2008/1/22/91
>>  >
>>  > I think the style problem marcel said is
>>  > 1. using kernel codeing style
>>  > 2. marcel's style
>>  > container_of or get_user_data calls at the top of the variable declaration
>>  > using the empty lines to seperate code blocks
>>  >
>>  > Please rework your patch and resend if you fixed them.
>>  >
>>  > BTW, please use the new bluetooth mailing list for kerne issue.
>>  > linux-bluetooth@vger.kernel.org
>>  >
>>  > (Thanks for andrew and davem)
>>  >
>>  > Regards
>>  > dave
>>  >
>>  > Regards
>>  > dave
>>  >
>>  >
>>
>>  Hi all,
>>
>>  I adjusted indentation of the patches
>>     
>
> Not enough.
>
> Please first read Documentation/CodingStyle, fix them, and
> then use scripts/checkpatch.pl to check your patch.
>   
I fixed all of errors except 80 characters warning.
Thanks

Louis JANG


[-- Attachment #2: patch_hci_event.c3 --]
[-- Type: text/plain, Size: 699 bytes --]

Signed-off-by: Louis JANG <louis@mizi.com>

--- linux-2.6.23/net/bluetooth/hci_event.c.orig	2008-02-25 17:17:11.000000000 +0900
+++ linux-2.6.23/net/bluetooth/hci_event.c	2008-02-25 17:30:23.000000000 +0900
@@ -1313,8 +1313,17 @@
 	hci_dev_lock(hdev);
 
 	conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
-	if (!conn)
-		goto unlock;
+	if (!conn) {
+		if (ev->link_type != ACL_LINK) {
+			__u8 link_type = (ev->link_type == ESCO_LINK) ? SCO_LINK : ESCO_LINK;
+
+			conn = hci_conn_hash_lookup_ba(hdev, link_type, &ev->bdaddr);
+			if (conn)
+				conn->type = ev->link_type;
+		}
+		if (!conn)
+			goto unlock;
+	}
 
 	if (!ev->status) {
 		conn->handle = __le16_to_cpu(ev->handle);

[-- Attachment #3: bluez-kernel-forcesco.patch3 --]
[-- Type: text/plain, Size: 2336 bytes --]

Signed-off-by: Louis JANG <louis@mizi.com>

diff -uNr linux-2.6.23/include/net/bluetooth-orig/sco.h linux-2.6.23/include/net/bluetooth/sco.h
--- linux-2.6.23/include/net/bluetooth-orig/sco.h	2007-10-10 05:31:38.000000000 +0900
+++ linux-2.6.23/include/net/bluetooth/sco.h	2008-02-25 18:04:20.000000000 +0900
@@ -51,6 +51,8 @@
 	__u8  dev_class[3];
 };
 
+#define SCO_FORCESCO	0x03
+
 /* ---- SCO connections ---- */
 struct sco_conn {
 	struct hci_conn	*hcon;
@@ -74,6 +76,7 @@
 	struct bt_sock	bt;
 	__u32		flags;
 	struct sco_conn	*conn;
+	unsigned int	force_sco :1;
 };
 
 #endif /* __SCO_H */
diff -uNr linux-2.6.23/net/bluetooth-orig/hci_conn.c linux-2.6.23/net/bluetooth/hci_conn.c
--- linux-2.6.23/net/bluetooth-orig/hci_conn.c	2008-02-25 17:58:27.000000000 +0900
+++ linux-2.6.23/net/bluetooth/hci_conn.c	2008-02-25 18:02:04.000000000 +0900
@@ -354,7 +354,7 @@
 
 	if (acl->state == BT_CONNECTED &&
 			(sco->state == BT_OPEN || sco->state == BT_CLOSED)) {
-		if (lmp_esco_capable(hdev))
+		if (type == ESCO_LINK)
 			hci_setup_sync(sco, acl->handle);
 		else
 			hci_add_sco(sco, acl->handle);
diff -uNr linux-2.6.23/net/bluetooth-orig/sco.c linux-2.6.23/net/bluetooth/sco.c
--- linux-2.6.23/net/bluetooth-orig/sco.c	2008-02-25 17:58:27.000000000 +0900
+++ linux-2.6.23/net/bluetooth/sco.c	2008-02-25 18:08:51.000000000 +0900
@@ -200,7 +200,10 @@
 
 	err = -ENOMEM;
 
-	type = lmp_esco_capable(hdev) ? ESCO_LINK : SCO_LINK;
+	if (sco_pi(sk)->force_sco)
+		type = SCO_LINK;
+	else
+		type = lmp_esco_capable(hdev) ? ESCO_LINK : SCO_LINK;
 
 	hcon = hci_connect(hdev, type, dst);
 	if (!hcon)
@@ -660,12 +663,21 @@
 {
 	struct sock *sk = sock->sk;
 	int err = 0;
+	int force_sco;
 
 	BT_DBG("sk %p", sk);
 
 	lock_sock(sk);
 
 	switch (optname) {
+	case SCO_FORCESCO:
+		if (copy_from_user(&force_sco, optval, sizeof(int))) {
+			err = -EFAULT;
+			break;
+		}
+		sco_pi(sk)->force_sco = (force_sco != 0);
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;
@@ -681,6 +693,7 @@
 	struct sco_options opts;
 	struct sco_conninfo cinfo;
 	int len, err = 0;
+	int force_sco;
 
 	BT_DBG("sk %p", sk);
 
@@ -721,6 +734,13 @@
 
 		break;
 
+	case SCO_FORCESCO:
+		force_sco = sco_pi(sock)->force_sco;
+		if (copy_to_user(optval, &force_sco, sizeof(int)))
+			err = -EFAULT;
+
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;

WARNING: multiple messages have this Message-ID (diff)
From: Louis JANG <louis-6CAt/Z4uMM0@public.gmane.org>
To: Dave Young <hidave.darkstar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>,
	Linux Kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	bmidgley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [Bluez-devel] forcing SCO connection patch
Date: Mon, 25 Feb 2008 20:35:22 +0900	[thread overview]
Message-ID: <47C2A7FA.2060902@mizi.com> (raw)
In-Reply-To: <a8e1da0802250155u1b7af481va203849f68d9106b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

Dave Young 쓴 글:
> On Mon, Feb 25, 2008 at 5:28 PM, Louis JANG <louis-6CAt/Z4uMM0@public.gmane.org> wrote:
>   
>>  > I ever asked marcel about the coding style. please see following thread:
>>  > http://lkml.org/lkml/2008/1/22/91
>>  >
>>  > I think the style problem marcel said is
>>  > 1. using kernel codeing style
>>  > 2. marcel's style
>>  > container_of or get_user_data calls at the top of the variable declaration
>>  > using the empty lines to seperate code blocks
>>  >
>>  > Please rework your patch and resend if you fixed them.
>>  >
>>  > BTW, please use the new bluetooth mailing list for kerne issue.
>>  > linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>  >
>>  > (Thanks for andrew and davem)
>>  >
>>  > Regards
>>  > dave
>>  >
>>  > Regards
>>  > dave
>>  >
>>  >
>>
>>  Hi all,
>>
>>  I adjusted indentation of the patches
>>     
>
> Not enough.
>
> Please first read Documentation/CodingStyle, fix them, and
> then use scripts/checkpatch.pl to check your patch.
>   
I fixed all of errors except 80 characters warning.
Thanks

Louis JANG


[-- Attachment #2: patch_hci_event.c3 --]
[-- Type: text/plain, Size: 699 bytes --]

Signed-off-by: Louis JANG <louis@mizi.com>

--- linux-2.6.23/net/bluetooth/hci_event.c.orig	2008-02-25 17:17:11.000000000 +0900
+++ linux-2.6.23/net/bluetooth/hci_event.c	2008-02-25 17:30:23.000000000 +0900
@@ -1313,8 +1313,17 @@
 	hci_dev_lock(hdev);
 
 	conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
-	if (!conn)
-		goto unlock;
+	if (!conn) {
+		if (ev->link_type != ACL_LINK) {
+			__u8 link_type = (ev->link_type == ESCO_LINK) ? SCO_LINK : ESCO_LINK;
+
+			conn = hci_conn_hash_lookup_ba(hdev, link_type, &ev->bdaddr);
+			if (conn)
+				conn->type = ev->link_type;
+		}
+		if (!conn)
+			goto unlock;
+	}
 
 	if (!ev->status) {
 		conn->handle = __le16_to_cpu(ev->handle);

[-- Attachment #3: bluez-kernel-forcesco.patch3 --]
[-- Type: text/plain, Size: 2336 bytes --]

Signed-off-by: Louis JANG <louis@mizi.com>

diff -uNr linux-2.6.23/include/net/bluetooth-orig/sco.h linux-2.6.23/include/net/bluetooth/sco.h
--- linux-2.6.23/include/net/bluetooth-orig/sco.h	2007-10-10 05:31:38.000000000 +0900
+++ linux-2.6.23/include/net/bluetooth/sco.h	2008-02-25 18:04:20.000000000 +0900
@@ -51,6 +51,8 @@
 	__u8  dev_class[3];
 };
 
+#define SCO_FORCESCO	0x03
+
 /* ---- SCO connections ---- */
 struct sco_conn {
 	struct hci_conn	*hcon;
@@ -74,6 +76,7 @@
 	struct bt_sock	bt;
 	__u32		flags;
 	struct sco_conn	*conn;
+	unsigned int	force_sco :1;
 };
 
 #endif /* __SCO_H */
diff -uNr linux-2.6.23/net/bluetooth-orig/hci_conn.c linux-2.6.23/net/bluetooth/hci_conn.c
--- linux-2.6.23/net/bluetooth-orig/hci_conn.c	2008-02-25 17:58:27.000000000 +0900
+++ linux-2.6.23/net/bluetooth/hci_conn.c	2008-02-25 18:02:04.000000000 +0900
@@ -354,7 +354,7 @@
 
 	if (acl->state == BT_CONNECTED &&
 			(sco->state == BT_OPEN || sco->state == BT_CLOSED)) {
-		if (lmp_esco_capable(hdev))
+		if (type == ESCO_LINK)
 			hci_setup_sync(sco, acl->handle);
 		else
 			hci_add_sco(sco, acl->handle);
diff -uNr linux-2.6.23/net/bluetooth-orig/sco.c linux-2.6.23/net/bluetooth/sco.c
--- linux-2.6.23/net/bluetooth-orig/sco.c	2008-02-25 17:58:27.000000000 +0900
+++ linux-2.6.23/net/bluetooth/sco.c	2008-02-25 18:08:51.000000000 +0900
@@ -200,7 +200,10 @@
 
 	err = -ENOMEM;
 
-	type = lmp_esco_capable(hdev) ? ESCO_LINK : SCO_LINK;
+	if (sco_pi(sk)->force_sco)
+		type = SCO_LINK;
+	else
+		type = lmp_esco_capable(hdev) ? ESCO_LINK : SCO_LINK;
 
 	hcon = hci_connect(hdev, type, dst);
 	if (!hcon)
@@ -660,12 +663,21 @@
 {
 	struct sock *sk = sock->sk;
 	int err = 0;
+	int force_sco;
 
 	BT_DBG("sk %p", sk);
 
 	lock_sock(sk);
 
 	switch (optname) {
+	case SCO_FORCESCO:
+		if (copy_from_user(&force_sco, optval, sizeof(int))) {
+			err = -EFAULT;
+			break;
+		}
+		sco_pi(sk)->force_sco = (force_sco != 0);
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;
@@ -681,6 +693,7 @@
 	struct sco_options opts;
 	struct sco_conninfo cinfo;
 	int len, err = 0;
+	int force_sco;
 
 	BT_DBG("sk %p", sk);
 
@@ -721,6 +734,13 @@
 
 		break;
 
+	case SCO_FORCESCO:
+		force_sco = sco_pi(sock)->force_sco;
+		if (copy_to_user(optval, &force_sco, sizeof(int)))
+			err = -EFAULT;
+
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;

  reply	other threads:[~2008-02-25 11:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-17 12:39 [Bluez-devel] forcing SCO connection patch Louis JANG
2008-02-25  6:43 ` Brad Midgley
2008-02-25  6:56   ` Brad Midgley
2008-02-26 19:19   ` Guillaume Bedot
2008-02-26 19:28     ` Marcel Holtmann
2008-02-26 21:05       ` Guillaume Bedot
2008-02-25  7:30 ` Dave Young
2008-02-25  7:34   ` Dave Young
2008-02-25  8:26     ` Dave Young
2008-02-25  8:26       ` Dave Young
2008-02-25  9:28   ` Louis JANG
2008-02-25  9:55     ` Dave Young
2008-02-25  9:55       ` Dave Young
2008-02-25 11:35       ` Louis JANG [this message]
2008-02-25 11:35         ` Louis JANG
2008-02-26  3:07         ` Marcel Holtmann
2008-02-26  3:07           ` Marcel Holtmann
2008-02-26  3:53           ` Louis JANG
2008-02-26 19:43             ` Marcel Holtmann
2008-02-26 19:43               ` Marcel Holtmann
2008-02-27  1:58               ` Louis JANG
2008-02-27  1:58                 ` Louis JANG
2008-02-27  9:57                 ` Marcel Holtmann
2008-02-27 12:21                   ` Louis JANG
2008-02-27 13:04                     ` Guillaume Bedot
2008-02-27 15:21                     ` Marcel Holtmann
2008-02-27 15:21                       ` Marcel Holtmann
2008-02-28  2:49                       ` Louis JANG
2008-02-28  2:49                         ` Louis JANG
2008-02-28 10:57                         ` Guillaume Bedot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C2A7FA.2060902@mizi.com \
    --to=louis@mizi.com \
    --cc=bmidgley@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.