Skip to contentSkip to conversation

l2cap connection id in user-space

DISCUSSION Pavan Savoy 3 participants 6 messages Apr 13, 2010 – Apr 14, 2010 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Is there a possibility as of now for me to extract the l2cap connection ID into my application ?

I require 2 sets of information about an L2CAP connection in my bluetooth application, I require the connection ID on connection to a remote headset/sink, and also the maximum packet size for that connection (which I think is the MTU, I can get via the getsockopt).

please respond.

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

#1 lore raw

Hi Pavan,

Quoted 1 line · Pavan Savoy

Is there a possibility as of now for me to extract the l2cap connection ID into my application ?

bluez-hcidump does that. Look to its source code to learn how.

Quoted 3 lines

I require 2 sets of information about an L2CAP connection in my bluetooth application, I require the connection ID on connection to a remote headset/sink, and also the maximum packet size for that connection (which I think is the MTU, I can get via the getsockopt).

Signature · 2 lines
Gustavo F. Padovan
http://padovan.org
#2 lore raw
Quoted 7 lines · Gustavo F. Padovan

From: Gustavo F. Padovan <[email protected]>
Subject: Re: l2cap connection id in user-space
To: "Pavan Savoy" <[email protected]>
Cc: [email protected], [email protected]
Date: Wednesday, 14 April, 2010, 2:49 AM
Hi Pavan,

Quoted 8 lines

* Pavan Savoy <[email protected]>
[2010-04-14 02:26:41 +0530]:

Quoted 1 line

Is there a possibility as of now for me to extract the

l2cap connection ID into my application ?

bluez-hcidump does that. Look to its source code to learn how.

Yeah, correct, it does.
However for that wouldn't I have to set filter for all ACL (or L2CAP) packets to even start receiving ACL (or L2CAP) packets ? strip off the l2cap_hdr and then get the channel ID from it.

I was more or less looking to add in 1 more getsockopt option to specifically request for the l2cap_hdr ? (like the imtu/omtu which happens currently). Wouldn't this be the right way ?

Quoted 12 lines
Quoted 2 lines

I require 2 sets of information about an L2CAP

connection in my bluetooth application, I require the connection ID on connection to a remote headset/sink, and also the maximum packet size for that connection (which I think is the MTU, I can get via the getsockopt).

Quoted 1 line
Signature · 2 lines
Gustavo F. Padovan
http://padovan.org

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

#3 lore raw

Hi Pavan,

Quoted 19 lines · Pavan Savoy
Quoted 7 lines · Gustavo F. Padovan

From: Gustavo F. Padovan <[email protected]>
Subject: Re: l2cap connection id in user-space
To: "Pavan Savoy" <[email protected]>
Cc: [email protected], [email protected]
Date: Wednesday, 14 April, 2010, 2:49 AM
Hi Pavan,

Quoted 8 lines

* Pavan Savoy <[email protected]>
[2010-04-14 02:26:41 +0530]:

Quoted 1 line

Is there a possibility as of now for me to extract the

l2cap connection ID into my application ?

bluez-hcidump does that. Look to its source code to learn how.

Quoted 6 lines

Yeah, correct, it does.
However for that wouldn't I have to set filter for all ACL (or L2CAP) packets to even start receiving ACL (or L2CAP) packets ? strip off the l2cap_hdr and then get the channel ID from it.

I was more or less looking to add in 1 more getsockopt option to specifically request for the l2cap_hdr ? (like the imtu/omtu which happens currently). Wouldn't this be the right way ?

No, we do not want such info on getsockopt. If you do that you'll have to mantain it by yourself, which is not a good idea. The cid is L2CAP specific, upper layers should not care about it.

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

I require 2 sets of information about an L2CAP

connection in my bluetooth application, I require the connection ID on connection to a remote headset/sink, and also the maximum packet size for that connection (which I think is the MTU, I can get via the getsockopt).

Quoted 1 line
Signature · 2 lines
Gustavo F. Padovan
http://padovan.org
maintainer
#4 lore raw
In reply to Pavan Savoy

Hi Pavan,

Quoted 3 lines

Is there a possibility as of now for me to extract the l2cap connection ID into my application ?

I require 2 sets of information about an L2CAP connection in my bluetooth application, I require the connection ID on connection to a remote headset/sink, and also the maximum packet size for that connection (which I think is the MTU, I can get via the getsockopt).

you need a recent kernel and then getsockname() and getpeername() will give you the SCID and DCID.

Regards

Marcel

#5 lore raw

Hi Pavan,

Quoted 8 lines · Marcel Holtmann

Hi Pavan,

Quoted 3 lines

Is there a possibility as of now for me to extract the l2cap connection ID into my application ?

I require 2 sets of information about an L2CAP connection in my bluetooth application, I require the connection ID on connection to a remote headset/sink, and also the maximum packet size for that connection (which I think is the MTU, I can get via the getsockopt).

you need a recent kernel and then getsockname() and getpeername() will give you the SCID and DCID.

Sorry for the wrong info, I didn't know about that calls inside L2CAP. ;)

Signature · 2 lines
Gustavo F. Padovan
http://padovan.org