2012-11-20 16:15:51

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH BlueZ 2/2 v1] l2test: Add support to test auto select PSM

This patch enable us to test the auto select PSM for server by passing
PSM value as 0.

Ex: l2test -d -P 0
l2test[2585]: Waiting for connection on psm 4097 ...
---
v1-> Corrected the misplaced code

test/l2test.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/test/l2test.c b/test/l2test.c
index 7645681..485887f 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -87,7 +87,7 @@ static long buffer_size = 2048;

/* Default addr and psm and cid */
static bdaddr_t bdaddr;
-static unsigned short psm = 0x1011;
+static unsigned short psm = 0;
static unsigned short cid = 0;

/* Default number of frames to send (-1 = infinite) */
@@ -458,8 +458,6 @@ static void do_listen(void (*handler)(int sk))
addr.l2_cid = htobs(cid);
else if (psm)
addr.l2_psm = htobs(psm);
- else
- goto error;

if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
syslog(LOG_ERR, "Can't bind socket: %s (%d)",
--
1.7.4.1



2012-11-20 17:52:13

by Gustavo Padovan

[permalink] [raw]
Subject: Re: [PATCH BlueZ 2/2 v1] l2test: Add support to test auto select PSM

Hi Syam,

* Syam Sidhardhan <[email protected]> [2012-11-20 21:45:51 +0530]:

> This patch enable us to test the auto select PSM for server by passing
> PSM value as 0.
>
> Ex: l2test -d -P 0
> l2test[2585]: Waiting for connection on psm 4097 ...
> ---
> v1-> Corrected the misplaced code
>
> test/l2test.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/test/l2test.c b/test/l2test.c
> index 7645681..485887f 100644
> --- a/test/l2test.c
> +++ b/test/l2test.c
> @@ -87,7 +87,7 @@ static long buffer_size = 2048;
>
> /* Default addr and psm and cid */
> static bdaddr_t bdaddr;
> -static unsigned short psm = 0x1011;
> +static unsigned short psm = 0;

Your patch makes the client side to always pass the psm option and I don't
think this is a good approach. I think we need something smarter here to not
break things.

Gustavo

2012-12-04 14:36:26

by Syam Sidhardhan

[permalink] [raw]
Subject: Re: [PATCH BlueZ 2/2 v1] l2test: Add support to test auto select PSM

Hi Gustavo,

On Tue, Nov 20, 2012 at 11:22 PM, Gustavo Padovan <[email protected]> wrote:
> Hi Syam,
>
> * Syam Sidhardhan <[email protected]> [2012-11-20 21:45:51 +0530]:
>
>> This patch enable us to test the auto select PSM for server by passing
>> PSM value as 0.
>>
>> Ex: l2test -d -P 0
>> l2test[2585]: Waiting for connection on psm 4097 ...
>> ---
>> v1-> Corrected the misplaced code
>>
>> test/l2test.c | 4 +---
>> 1 files changed, 1 insertions(+), 3 deletions(-)
>>
>> diff --git a/test/l2test.c b/test/l2test.c
>> index 7645681..485887f 100644
>> --- a/test/l2test.c
>> +++ b/test/l2test.c
>> @@ -87,7 +87,7 @@ static long buffer_size = 2048;
>>
>> /* Default addr and psm and cid */
>> static bdaddr_t bdaddr;
>> -static unsigned short psm = 0x1011;
>> +static unsigned short psm = 0;
>
> Your patch makes the client side to always pass the psm option and I don't
> think this is a good approach. I think we need something smarter here to not
> break things.

True, I assumed that for initiating or listening a connection, the PSM
or CID is mandatory.
I think, we should not change the psm initialization
"static unsigned short psm = 0x1011;" in the previous patch.
If the user want to test the auto select psm, then he should
explicitly pass the "-P 0" option in the argument.

I'll send an updated version.

Regards,
Syam.