2004-12-01 09:48:34

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

you posted your request to both mailing lists. Don't do any cross
posting.

> Here is code fragment. I use usual fork practise to run these two
> func do_connect and do_listen. I hard code the bluetooth device to be
> connected just because code is under testing.
> And these two func are using different channel, it can be connected
> when do_connect retry more than 3 times.
> So i do not why it can not be connected when it is trying to connect
> another device.

I don't get your point. Make it clear who is connecting to whom.

And if you don't set your socket to non-blocking the use of select makes
no sense. Show us the full code.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2004-12-07 09:10:28

by Sebastian Roth

[permalink] [raw]
Subject: [Bluez-devel] Re: About rfcomm socket

Hi Mike!

> After i make install bluez-lib-2.12 , i found that there is no sdp
> lib. Does it combine to bluetooth lib? or i need to enable it in
> configuration.

# ls bluez-libs-2.12/src
bluetooth.c hci.c Makefile.am Makefile.in sdp.c

So I guess libbluetooth contains sdp.

Best regards,
Sebastian



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-07 09:18:29

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

HI Mike,

> After i make install bluez-lib-2.12 , i found that there is no sdp
> lib. Does it combine to bluetooth lib? or i need to enable it in
> configuration.

the SDP library is part of the Bluetooth library now. I did this change
some time ago. May you should start reading the changelogs.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-07 09:13:58

by mike lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
After i make install bluez-lib-2.12 , i found that there is no sdp
lib. Does it combine to bluetooth lib? or i need to enable it in
configuration.

Best Regard
Mike,Lee

Marcel Holtmann wrote:

>Hi Mike,
>
>
>
>> You mean that i can patch the 2.4 to 2.6? from kernel.org?
>>
>>
>
>no. You already use the newest Bluetooth subsystem available for 2.4 and
>if you wanna use the Bluetooth subsystem of 2.6, you have to backport
>over 30 patches. It is a doable job, but not an easy one.
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>
>




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 15:41:14

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> I have one question about rfcomm, Is there any setting like MTU in TCP?

no, because RFCOMM is a stream. All MTU stuff is hidden inside the
implementation.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 14:47:16

by Mike Lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
I have one question about rfcomm, Is there any setting like MTU in TCP?


best regard
Mike,Lee


On Mon, 06 Dec 2004 15:20:12 +0100, Marcel Holtmann <[email protected]> wrote:
> Hi Mike,
>
> > You mean that i can patch the 2.4 to 2.6? from kernel.org?
>
> no. You already use the newest Bluetooth subsystem available for 2.4 and
> if you wanna use the Bluetooth subsystem of 2.6, you have to backport
> over 30 patches. It is a doable job, but not an easy one.
>
>
>
> Regards
>
> Marcel
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


--
-------------------------------------------------------
Mike Lee


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 14:20:12

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> You mean that i can patch the 2.4 to 2.6? from kernel.org?

no. You already use the newest Bluetooth subsystem available for 2.4 and
if you wanna use the Bluetooth subsystem of 2.6, you have to backport
over 30 patches. It is a doable job, but not an easy one.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 14:04:40

by Mike Lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
You mean that i can patch the 2.4 to 2.6? from kernel.org?



On Mon, 06 Dec 2004 14:27:16 +0100, Marcel Holtmann <[email protected]> wrote:
> Hi Mike,
>
> > I am using a development board on 2.4.18, all my work and board
> > oriented driver is basic on kernel 2.4.18. I will beyond the deadine
> > if upgrading kernel .
>
> fine with me, but I think the 2.4 kernel misses at least 30 patches that
> are merged with the 2.6 series.
>
>
>
> Regards
>
> Marcel
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


--
-------------------------------------------------------
Mike Lee


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 13:27:16

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> I am using a development board on 2.4.18, all my work and board
> oriented driver is basic on kernel 2.4.18. I will beyond the deadine
> if upgrading kernel .

fine with me, but I think the 2.4 kernel misses at least 30 patches that
are merged with the 2.6 series.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 13:17:51

by Mike Lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel

I am using a development board on 2.4.18, all my work and board
oriented driver is basic on kernel 2.4.18. I will beyond the deadine
if upgrading kernel .




On Mon, 06 Dec 2004 12:27:41 +0100, Marcel Holtmann <[email protected]> wrote:
> Hi Mike,
>
> > When i want to upgrade the bluez, do i need to upgrade the kernel at
> > the same time? i am using kernel.2.4.18 patched with mh15.
>
> the 2.4.18-mh15 contains the newest Bluetooth subsystem you will get for
> a 2.4 kernel. Why don't you use a 2.6 kernel?
>
>
>
> Regards
>
> Marcel
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


--
-------------------------------------------------------
Mike Lee


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 11:27:41

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> When i want to upgrade the bluez, do i need to upgrade the kernel at
> the same time? i am using kernel.2.4.18 patched with mh15.

the 2.4.18-mh15 contains the newest Bluetooth subsystem you will get for
a 2.4 kernel. Why don't you use a 2.6 kernel?

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 11:29:26

by mike lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
When i want to upgrade the bluez, do i need to upgrade the kernel at
the same time? i am using kernel.2.4.18 patched with mh15.

best regard
Mike,Lee

Marcel Holtmann wrote:

>Hi Mike,
>
>
>
>> That is old version of bluez version, is it the problem ? Anyway, i
>>upgrade that first.
>>
>>
>
>using the latest version is always a good idea, but however the old CSR
>firmware before HCI 16.4 can also cause the problems.
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 07:38:18

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> That is old version of bluez version, is it the problem ? Anyway, i
> upgrade that first.

using the latest version is always a good idea, but however the old CSR
firmware before HCI 16.4 can also cause the problems.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-06 07:37:47

by mike lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
That is old version of bluez version, is it the problem ? Anyway, i
upgrade that first.

Thanks
best regard
Mike,Lee

Marcel Holtmann wrote:

>Hi Mike,
>
>
>
>>hci0: Type: UART
>> BD Address: 00:08:E0:01:49:6A ACL MTU: 192:8 SCO MTU: 64:8
>> UP RUNNING PSCAN ISCAN
>> RX bytes:231 acl:0 sco:0 events:27 errors:0
>> TX bytes:630 acl:0 sco:0 commands:27 errors:0
>> Features: 0xff 0xff 0x8b 0x78 0x18 0x18 0x00 0x80
>> Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
>> Link policy: RSWITCH HOLD SNIFF PARK
>> Link mode: SLAVE ACCEPT
>> Name: 'test'
>> Class: 0x000100
>> Service Classes: Unspecified
>> Device Class: Computer, Uncategorized
>> HCI Ver: 1.2 (0x2) HCI Rev: 0x490 LMP Ver: 1.2 (0x2) LMP Subver:
>>0x490
>> Manufacturer: Cambridge Silicon Radio (10)
>>
>>
>
>this one is fine, because it is a HCI 18.x firmware.
>
>
>
>>hci0: Type: USB
>> BD Address: 00:08:E0:00:00:04 ACL MTU: 192:8 SCO MTU: 64:8
>> UP RUNNING PSCAN ISCAN
>> RX bytes:4031 acl:64 sco:0 events:143 errors:0
>> TX bytes:2429 acl:66 sco:0 commands:31 errors:0
>> Features: 0xff 0xff 0x0b 0x00 0x00 0x00 0x00 0x00
>> Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
>> Link policy:
>> Link mode: SLAVE ACCEPT
>> Name: 'mike'
>> Class: 0x000000
>> Service Classes: Unspecified
>> Device Class: Miscellaneous,
>> HCI Ver: 1.1 (0x1) HCI Rev: 0x175 LMP Ver: 1.1 (0x1) LMP Subver:
>>0x175
>> Manufacturer: Cambridge Silicon Radio (10)
>>
>>
>
>This one is HCI 14.7 and previous HCI 16.x which is not good.
>
>
>
>>Actually, the 3rd device is a bluetooth-embedded phone, i can not get
>>the configuration out. SLAVE is accept for my target device, is it what
>>you want to see?
>>
>>
>
>You can, use "hcitool info ..." as root.
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-03 03:15:49

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> hci0: Type: UART
> BD Address: 00:08:E0:01:49:6A ACL MTU: 192:8 SCO MTU: 64:8
> UP RUNNING PSCAN ISCAN
> RX bytes:231 acl:0 sco:0 events:27 errors:0
> TX bytes:630 acl:0 sco:0 commands:27 errors:0
> Features: 0xff 0xff 0x8b 0x78 0x18 0x18 0x00 0x80
> Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
> Link policy: RSWITCH HOLD SNIFF PARK
> Link mode: SLAVE ACCEPT
> Name: 'test'
> Class: 0x000100
> Service Classes: Unspecified
> Device Class: Computer, Uncategorized
> HCI Ver: 1.2 (0x2) HCI Rev: 0x490 LMP Ver: 1.2 (0x2) LMP Subver:
> 0x490
> Manufacturer: Cambridge Silicon Radio (10)

this one is fine, because it is a HCI 18.x firmware.

> hci0: Type: USB
> BD Address: 00:08:E0:00:00:04 ACL MTU: 192:8 SCO MTU: 64:8
> UP RUNNING PSCAN ISCAN
> RX bytes:4031 acl:64 sco:0 events:143 errors:0
> TX bytes:2429 acl:66 sco:0 commands:31 errors:0
> Features: 0xff 0xff 0x0b 0x00 0x00 0x00 0x00 0x00
> Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
> Link policy:
> Link mode: SLAVE ACCEPT
> Name: 'mike'
> Class: 0x000000
> Service Classes: Unspecified
> Device Class: Miscellaneous,
> HCI Ver: 1.1 (0x1) HCI Rev: 0x175 LMP Ver: 1.1 (0x1) LMP Subver:
> 0x175
> Manufacturer: Cambridge Silicon Radio (10)

This one is HCI 14.7 and previous HCI 16.x which is not good.

> Actually, the 3rd device is a bluetooth-embedded phone, i can not get
> the configuration out. SLAVE is accept for my target device, is it what
> you want to see?

You can, use "hcitool info ..." as root.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-03 03:16:59

by mike lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
Target device:
hci0: Type: UART
BD Address: 00:08:E0:01:49:6A ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:231 acl:0 sco:0 events:27 errors:0
TX bytes:630 acl:0 sco:0 commands:27 errors:0
Features: 0xff 0xff 0x8b 0x78 0x18 0x18 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'test'
Class: 0x000100
Service Classes: Unspecified
Device Class: Computer, Uncategorized
HCI Ver: 1.2 (0x2) HCI Rev: 0x490 LMP Ver: 1.2 (0x2) LMP Subver:
0x490
Manufacturer: Cambridge Silicon Radio (10)

Computer A:
hci0: Type: USB
BD Address: 00:08:E0:00:00:04 ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:4031 acl:64 sco:0 events:143 errors:0
TX bytes:2429 acl:66 sco:0 commands:31 errors:0
Features: 0xff 0xff 0x0b 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy:
Link mode: SLAVE ACCEPT
Name: 'mike'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Ver: 1.1 (0x1) HCI Rev: 0x175 LMP Ver: 1.1 (0x1) LMP Subver:
0x175
Manufacturer: Cambridge Silicon Radio (10)

Actually, the 3rd device is a bluetooth-embedded phone, i can not get
the configuration out. SLAVE is accept for my target device, is it what
you want to see?

thanks for helping

best regard
Mike,Lee

Marcel Holtmann wrote:

>Hi Mike,
>
>
>
>>There are 3 device, Target device, computer A, computer B. Target device
>>is running the code below i.e. connect to computer A through channel 3
>>and listen at channel 2. It supposed that computer B can connect to
>>target device when target device is connecting others, but it fails. And
>>when target stop connecting computer A, computer B can then connect to
>>target with channel 2!
>>
>>
>
>what are the outputs of "hciconfig -a" for these three devices?
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-02 07:44:31

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Hi Mike,

> There are 3 device, Target device, computer A, computer B. Target device
> is running the code below i.e. connect to computer A through channel 3
> and listen at channel 2. It supposed that computer B can connect to
> target device when target device is connecting others, but it fails. And
> when target stop connecting computer A, computer B can then connect to
> target with channel 2!

what are the outputs of "hciconfig -a" for these three devices?

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2004-12-02 04:26:07

by mike lee

[permalink] [raw]
Subject: Re: [Bluez-devel] About rfcomm socket

Dear Marcel
Thanks for helping. and sorry for disturbing two mailing list.
Here are the codes generate problems.(i omitted some codes because
of the size)

My english is no good, I try to make it clear.
There are 3 device, Target device, computer A, computer B. Target device
is running the code below i.e. connect to computer A through channel 3
and listen at channel 2. It supposed that computer B can connect to
target device when target device is connecting others, but it fails. And
when target stop connecting computer A, computer B can then connect to
target with channel 2!



int main(void)
{
if ((connect_pid=fork())==0)
{
DEBPRINT("Connect process %d\n",getpid());
printf("Start connecting...\n");
do_connect(&stateData);
return 0;
}
else
{
DEBPRINT("RTSP listen process %d\n",getpid());
// waiting phone to connect
printf("Start listening...\n");
do_listen(&stateData);
}
}
int do_connect(TPVSerial_State_t *stateData)
{
struct sockaddr_rc sa;
int sk,retry;


// Create RFCOMM socket
sk = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
if(sk < 0)
{
syslog(LOG_ERR, "Cannot create RFCOMM socket. %s(%d)",
strerror(errno), errno);
return -1;
}

sa.rc_family = AF_BLUETOOTH;
sa.rc_channel = 3;
str2ba("00:e0:07:cb:15:68",&sa.rc_bdaddr);

retry = 3;
while(retry--)
{
int ret, alen = sizeof(sa);
DEBPRINT("Conecting...\n");
ret = connect(sk, (struct sockaddr *) &sa, alen);
if(ret<0)
{
syslog(LOG_ERR, "Connect failed. %s(%d)", strerror(errno),
errno);
continue;
}
DEBPRINT("Connected\n");

ba2str(&sa.rc_bdaddr, ba);

syslog(LOG_INFO, "New connection from %s", ba);
// to handle the SPP connection
sp_open_connection(sk, stateData);
close(sk);
}

return 0;
}


int do_listen(TPVSerial_State_t *stateData)
{
struct sockaddr_rc sa;
int sk;
fd_set netfd;

/* setup RFCOMM channel */
if (!channel)
channel = SP_DEFAULT_CHANNEL;

/* add SPP to local SDP server */
if (use_sdp)
sp_sdp_register(channel);

// Create RFCOMM socket
sk = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);

if(sk < 0)
{
syslog(LOG_ERR, "Cannot create RFCOMM socket. %s(%d)",
strerror(errno), errno);
return -1;
}
//NONBLOCK socket
flags = fcntl(sk,F_GETFL,0);
fcntl(sk,F_SETFL,O_NONBLOCK|flags);

sa.rc_family = AF_BLUETOOTH;
sa.rc_channel = channel;
sa.rc_bdaddr = src_addr;

if (bind(sk, (struct sockaddr *) &sa, sizeof(sa)))
{
syslog(LOG_ERR, "Bind failed. %s(%d)", strerror(errno), errno);
return -1;
}


listen(sk, 10);
FD_ZERO(&netfd);

terminate = 0;
while(!terminate)
{
int alen = sizeof(sa), nsk;


FD_SET(sk,&netfd);
syslog(LOG_INFO, "Waiting for connection...");
DEBPRINT("wait Accept\n");
select(sk+1,&netfd,NULL,NULL,NULL)

if(FD_ISSET(sk,&netfd)){
nsk = accept(sk, (struct sockaddr *) &sa, &alen);
if(nsk<0)
{
syslog(LOG_ERR, "Accept failed. %s(%d)",
strerror(errno), errno);
continue;
}
DEBPRINT("Accepted\n");

ba2str(&sa.rc_bdaddr, ba);

syslog(LOG_INFO, "New connection from %s", ba);

// to handle the SPP connection
sp_open_connection(nsk, stateData);
close(nsk);
}
}

if(use_sdp)
sp_sdp_unregister();
return 0;
}

Best regard
Mike,Lee

Marcel Holtmann wrote:

>Hi Mike,
>
>you posted your request to both mailing lists. Don't do any cross
>posting.
>
>
>
>> Here is code fragment. I use usual fork practise to run these two
>>func do_connect and do_listen. I hard code the bluetooth device to be
>>connected just because code is under testing.
>> And these two func are using different channel, it can be connected
>>when do_connect retry more than 3 times.
>> So i do not why it can not be connected when it is trying to connect
>>another device.
>>
>>
>
>I don't get your point. Make it clear who is connecting to whom.
>
>And if you don't set your socket to non-blocking the use of select makes
>no sense. Show us the full code.
>
>Regards
>
>Marcel
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Bluez-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel