All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabrizio Guglielmino <guglielmino@infitsrl.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] It's rfcomm connect problem [ERRATA]
Date: Thu, 27 Jul 2006 11:25:19 +0200	[thread overview]
Message-ID: <44C8867F.5050504@infitsrl.com> (raw)
In-Reply-To: <44C881B5.7060809@infitsrl.com>

Kernel is 2.6.12 non .10 ...sorry...

Fabrizio Guglielmino ha scritto:
> I Marcel,
> I'm trying to use the patch to handle multiple l2cap connection, I'm =

> not a kernel/modules expert developer so
> I need a little help.
> Firts I'm trying to understand what the patch do and I think it's =

> clear (is used a linked list to handle multiple connection).
>
> My problems are with kernel programming enviromnment:
>
> 1) I'm using kernel-2.6.10 I have to update to a more recent version?
>
> 2) Is there some documentation about bluez kernel modules? I need to =

> understand how modules works to make try to make the patch.
>
> Many thanks
> Fabrizio
>
>
> Marcel Holtmann ha scritto:
>> Hi Fabrizio,
>>
>>  =

>>> Last solutions it's to see at l2cap layer and try to understand ho =

>>> wo  write the patch, if
>>> I will succeed to find  the past Marcel's thread about it I'll try =

>>> to  write this patch.
>>>     =

>>
>> it must look something like the attached one. However that one might
>> crash your machine.
>>
>> Regards
>>
>> Marcel
>>
>>   =

>> ------------------------------------------------------------------------
>>
>> diff --git a/include/net/bluetooth/l2cap.h =

>> b/include/net/bluetooth/l2cap.h
>> index 8242a0e..cb19e66 100644
>> --- a/include/net/bluetooth/l2cap.h
>> +++ b/include/net/bluetooth/l2cap.h
>> @@ -183,6 +183,8 @@ struct l2cap_chan_list {
>>  };
>>  =

>>  struct l2cap_conn {
>> +    struct list_head list;
>> +
>>      struct hci_conn    *hcon;
>>  =

>>      bdaddr_t    *dst;
>> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
>> index eaaad65..1d1c423 100644
>> --- a/net/bluetooth/l2cap.c
>> +++ b/net/bluetooth/l2cap.c
>> @@ -63,6 +63,9 @@ static struct bt_sock_list l2cap_sk_list
>>      .lock =3D RW_LOCK_UNLOCKED
>>  };
>>  =

>> +static LIST_HEAD(l2cap_conn_list);
>> +static DEFINE_SPINLOCK(l2cap_conn_lock);
>> +
>>  static void __l2cap_sock_close(struct sock *sk, int reason);
>>  static void l2cap_sock_close(struct sock *sk);
>>  static void l2cap_sock_kill(struct sock *sk);
>> @@ -295,6 +298,10 @@ static void l2cap_conn_del(struct hci_co
>>  =

>>      BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);
>>  =

>> +    spin_lock_bh(&l2cap_conn_lock);
>> +    list_del(&conn->list);
>> +    spin_unlock_bh(&l2cap_conn_lock);
>> +
>>      if (conn->rx_skb)
>>          kfree_skb(conn->rx_skb);
>>  =

>> @@ -642,18 +649,23 @@ static int l2cap_do_connect(struct sock      =

>> sk->sk_state =3D BT_CONNECT;
>>      l2cap_sock_set_timer(sk, sk->sk_sndtimeo);
>>  =

>> -    if (hcon->state =3D=3D BT_CONNECTED) {
>> -        if (sk->sk_type =3D=3D SOCK_SEQPACKET) {
>> -            struct l2cap_conn_req req;
>> -            l2cap_pi(sk)->ident =3D l2cap_get_ident(conn);
>> -            req.scid =3D __cpu_to_le16(l2cap_pi(sk)->scid);
>> -            req.psm  =3D l2cap_pi(sk)->psm;
>> -            l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
>> -                    L2CAP_CONN_REQ, sizeof(req), &req);
>> -        } else {
>> -            l2cap_sock_clear_timer(sk);
>> -            sk->sk_state =3D BT_CONNECTED;
>> -        }
>> +    if (hcon->state !=3D BT_CONNECTED) {
>> +        spin_lock_bh(&l2cap_conn_lock);
>> +        list_add_tail(&conn->list, &l2cap_conn_list);
>> +        spin_unlock_bh(&l2cap_conn_lock);
>> +        goto done;
>> +    }
>> +
>> +    if (sk->sk_type =3D=3D SOCK_SEQPACKET) {
>> +        struct l2cap_conn_req req;
>> +        l2cap_pi(sk)->ident =3D l2cap_get_ident(conn);
>> +        req.scid =3D __cpu_to_le16(l2cap_pi(sk)->scid);
>> +        req.psm  =3D l2cap_pi(sk)->psm;
>> +        l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
>> +                L2CAP_CONN_REQ, sizeof(req), &req);
>> +    } else {
>> +        l2cap_sock_clear_timer(sk);
>> +        sk->sk_state =3D BT_CONNECTED;
>>      }
>>  =

>>  done:
>> @@ -1926,12 +1938,35 @@ static int l2cap_connect_cfm(struct hci_
>>      if (hcon->type !=3D ACL_LINK)
>>          return 0;
>>  =

>> -    if (!status) {
>> +    switch (status) {
>> +    case 0x00:
>>          conn =3D l2cap_conn_add(hcon, status);
>> -        if (conn)
>> -            l2cap_conn_ready(conn);
>> -    } else
>> +        if (!conn)
>> +            break;
>> +
>> +        spin_lock_bh(&l2cap_conn_lock);
>> +        list_del(&conn->list);
>> +        spin_unlock_bh(&l2cap_conn_lock);
>> +
>> +        l2cap_conn_ready(conn);
>> +
>> +        spin_lock_bh(&l2cap_conn_lock);
>> +        if (!list_empty(&l2cap_conn_list)) {
>> +            conn =3D list_entry(l2cap_conn_list.next, struct =

>> l2cap_conn, list);
>> +            list_move_tail(&conn->list, &l2cap_conn_list);
>> +            hci_conn_put(conn->hcon);
>> +            hci_connect(conn->hcon->hdev, ACL_LINK, conn->dst);
>> +        }
>> +        spin_unlock_bh(&l2cap_conn_lock);
>> +        break;
>> +
>> +    case 0x0c:
>> +        break;
>> +
>> +    default:
>>          l2cap_conn_del(hcon, bt_err(status));
>> +        break;
>> +    }
>>  =

>>      return 0;
>>  }
>>   =

>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------=
- =

>>
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to =

>> share your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=
=3DDEVDEV =

>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Bluez-devel mailing list
>> Bluez-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>>   =

>
>


-- =

______________________________
Fabrizio Guglielmino =

Infit Srl
Software Engineering
Tel. +39 11 7410915
Fax. +39 11 7410915
www.infitsrl.com
C.so Svizzera, 79/8 - Torino
______________________________

Il presente messaggio ed ogni eventuale allegato hanno natura
confidenziale e sono riservati ai destinatari indicati. La diffusione a
terzi e qualsiasi altro uso non autorizzato sono proibiti. I messaggi ed
i relativi allegati possono essere soggetti ad alterazioni. Il mittente
declina ogni responsabilit=E0 per le eventuali alterazioni, modificazioni
o falsificazioni.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2006-07-27  9:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-19 16:28 [Bluez-devel] Error: sdptool browse --> Connection reset by peer JP Freeley
2006-07-20  0:48 ` Marcel Holtmann
2006-07-20 21:27   ` JP Freeley
2006-07-25  4:26     ` JP Freeley
2006-07-22 14:08   ` [Bluez-devel] It's rfcomm connect problem Fabrizio Guglielmino
2006-07-24  8:38     ` Andreas Gaufer
2006-07-24 13:33       ` Fabrizio Guglielmino
2006-07-24 13:56         ` Andreas Gaufer
2006-07-24 16:35           ` Marcel Holtmann
2006-07-24 18:34             ` Andreas Gaufer
2006-07-24 20:30               ` Fabrizio Guglielmino
2006-07-24 21:12                 ` Marcel Holtmann
2006-07-27  9:04                   ` Fabrizio Guglielmino
2006-07-27  9:25                     ` Fabrizio Guglielmino [this message]
2006-07-28 11:14                     ` Marcel Holtmann
2006-07-31 10:02                       ` [Bluez-devel] About l2cap patch to handle multiple connections Fabrizio Guglielmino
2006-07-31 14:14                         ` Marcel Holtmann
2006-08-02 11:24                           ` Fabrizio Guglielmino
2006-08-02 13:43                             ` Marcel Holtmann

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=44C8867F.5050504@infitsrl.com \
    --to=guglielmino@infitsrl.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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.