Subject: Re: [Bluez-devel] forcing SCO connection patch

From: Louis JANG <louis-6CAt/[email-masked]>
Date: Wed, 27 Feb 2008 10:58:44 +0900

Marcel Holtmann 쓴 글:
> Hi Loius,
>
>>>> --- 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;
>>>> + }
>>>
>>> NAK. There is no need to check for ACL_LINK. The sync_complete will
>>> only be called for SCO or eSCO connections.
>> I see. I removed this check line in the patch.
>>
>> Thanks.
>> Louis JANG
>> Signed-off-by: Louis JANG <louis-6CAt/[email-masked]>
>> --- linux-2.6.23/net/bluetooth/hci_event.c.orig 2008-02-26
>> 12:46:36.000000000 +0900
>> +++ linux-2.6.23/net/bluetooth/hci_event.c 2008-02-26
>> 12:47:23.000000000 +0900
>> @@ -1313,8 +1313,15 @@
>> hci_dev_lock(hdev);
>>
>> conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
>> - if (!conn)
>> - goto unlock;
>> + if (!conn) {
>> + __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;
>> + else
>> + goto unlock;
>> + }
>>
>> if (!ev->status) {
>> conn->handle = __le16_to_cpu(ev->handle);
>
> do something like this:
>
> if (!conn) {
> ....
>
> conn = ....
> if (!conn)
> goto unlock;
>
> conn->type = ev->link_type;
> }
>
> And include a description when submitting a patch.
>
> Regards
>
> Marcel
I changed code with this style and included patch description.
Thanks

Louis JANG
This patch is to handle different type of synchronous link is 
estabilished with its request.

Signed-off-by: Louis JANG <[email-masked]>
--- linux-2.6.23/net/bluetooth/hci_event.c.orig	2008-02-26 12:46:36.000000000 +0900
+++ linux-2.6.23/net/bluetooth/hci_event.c	2008-02-27 10:48:29.000000000 +0900
@@ -1313,8 +1313,15 @@
 	hci_dev_lock(hdev);
 
 	conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
-	if (!conn)
-		goto unlock;
+	if (!conn) {
+		__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)
+			goto unlock;
+
+		conn->type = ev->link_type;
+	}
 
 	if (!ev->status) {
 		conn->handle = __le16_to_cpu(ev->handle);