RE: [Bluez-users] Problems connecting to multiple rfcomm sockets

Steve Drew
2004-10-27T16:32:37Z

[-- Attachment #1: Type: text/plain, Size: 3526 bytes --]

Hi Marcel,

-----Original Message-----
From: Marcel Holtmann [mailto:marcel@holtmann.org]
Sent: 27 October 2004 16:49
To: Steve Drew
Cc: BlueZ Mailing List
Subject: Re: [Bluez-users] Problems connecting to multiple rfcomm
sockets

Hi Steve,

> I've been experiencing some problems when trying to open multiple
rfcomm
> ports, with pppd using the rfcomm ports.
>
> I have three bluetooth serial ports setup in rfcomm.conf, but it
appears
> that I can open connections to two of them at once.
>
> While the first two serial ports are connected, and the third is
trying
> to connect, running rfcomm gives;
>
> rfcomm0: 00:0E:6D:1A:9A:3F channel 1 connected [tty-attached]
> rfcomm1: 00:02:EE:82:D9:29 channel 2 connected [tty-attached]
> rfcomm2: 00:60:57:70:CD:E1 channel 3 config [tty-attached]
>
> Then the terminal with the third connection reports;
>
> "Failed to open /dev/rfcomm2: Host is down"
>
> At which point running #rfcomm gives;
>
> rfcomm0: 00:0E:6D:1A:9A:3F channel 1 connected [tty-attached]
> rfcomm1: 00:02:EE:82:D9:29 channel 2 connected [tty-attached]
> rfcomm2: 00:60:57:70:CD:E1 channel 3 closed.

what does "hcitool con" tell you at this point? Run "hcidump -x" and see
with what error code the third connection fails.

FromSteve-->
At This point running hcitool con shows the following connections

Connections:
< ACL 00:02:EE:82:D9:29 handle 44 state 1 lm MASTER ENCRYPT
< ACL 00:0E:6D:1A:9A:3F handle 41 state 1 lm MASTER ENCRYPT

Running hcidump -x gives the output attached in hcidump.txt (hcidump is
running from just before the 3rd connection is called, and until after
the error (Host is down) is reported).

---->FromSteve

> If I now close the connection to rfcomm1 or rfcomm0, I can connect to
> rfcomm2 (so I can always have a max of 2 active connections).
>
> However, If before I start the pppd connections to the serial ports, I
> start 3 copies of l2ping (one to each of the MAC addresses listed
> above), and keep these running, I can establish pppd connections on
> rfcomm0+1+2 at the same time.
>
> With this scenario, if one of the pppd sessions terminates, the l2ping
> to the corresponding rfcomm device's MAC will stop giving:
> "Send failed: Connection reset by peer", and once again I can only
use
> two of the rfcomm ports.
>
> Using bluez-utils-2.10-2 and bluez-libs-2.10-2 under a 2.4.22-1 kernel
>
> Any idea/subjections/requests for more information greatly
appreciated!

What devices did you use (hciconfig -a) and to what devices are you
connecting?

Regards

Marcel

<---FromSteve

The adapter is a USB Dlink DBT-120, and running hciconfig -a gives;

hci0: Type: USB
BD Address: 00:0F:3D:5F:1F:C1 ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:25060 acl:524 sco:0 events:591 errors:0
TX bytes:20405 acl:518 sco:0 commands:38 errors:0
Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'slb2-0'
Class: 0x120104
Service Classes: Networking, Object Transfer
Device Class: Computer, Desktop workstation
HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver:
0x20d
Manufacturer: Cambridge Silicon Radio (10)

The three devices I am connecting to are Nokia6310's.

Thanks

steve

[-- Attachment #2: hcidump0.txt --]
[-- Type: text/plain, Size: 2167 bytes --]

< HCI Command: Create Connection (0x01|0x0005) plen 13
E1 CD 70 57 60 00 18 CC 01 00 00 00 01
> HCI Event: Command Status (0x0f) plen 4
00 01 05 04
> ACL data: handle 0x002c flags 0x02 dlen 38
L2CAP(d): cid 0x0040 len 34 [psm 0]
09 FF 3B 01 7E FF 7D 23 C0 21 7D 29 4A 7D 20 7D 2C 7D 20 7D
20 7D 20 7D 20 FF 7D 21 33 4A F3 43 7E 5C
< ACL data: handle 0x002c flags 0x02 dlen 38
L2CAP(d): cid 0x0040 len 34 [psm 0]
0B EF 3D 7E FF 7D 23 C0 21 7D 2A 4A 7D 20 7D 2C 7D 20 7D 20
7D 20 7D 20 FF 7D 21 33 4A 7D 3D C4 7E 9A
> HCI Event: Number of Completed Packets (0x13) plen 5
01 2C 00 01 00
> ACL data: handle 0x0029 flags 0x02 dlen 40
L2CAP(d): cid 0x0040 len 36 [psm 0]
09 FF 3F 01 7E FF 7D 23 C0 21 7D 29 51 7D 20 7D 2C 7D 20 7D
20 7D 20 7D 20 7D 20 61 7D 20 7D 20 A4 C1 7E 5C
< ACL data: handle 0x0029 flags 0x02 dlen 39
L2CAP(d): cid 0x0040 len 35 [psm 0]
0B EF 3F 7E FF 7D 23 C0 21 7D 2A 51 7D 20 7D 2C 7D 20 7D 20
7D 20 7D 20 7D 20 61 7D 20 7D 20 4A 46 7E 9A
> HCI Event: Number of Completed Packets (0x13) plen 5
01 29 00 01 00
> ACL data: handle 0x002c flags 0x02 dlen 39
L2CAP(d): cid 0x0040 len 35 [psm 0]
09 FF 3D 01 7E FF 7D 23 C0 21 7D 29 4B 7D 20 7D 2C 7D 20 7D
20 7D 20 7D 20 7D 21 59 30 D8 D9 7D 37 7E 5C
< ACL data: handle 0x002c flags 0x02 dlen 37
L2CAP(d): cid 0x0040 len 33 [psm 0]
0B EF 3B 7E FF 7D 23 C0 21 7D 2A 4B 7D 20 7D 2C 7D 20 7D 20
7D 20 7D 20 7D 21 59 30 D8 37 90 7E 9A
> HCI Event: Number of Completed Packets (0x13) plen 5
01 2C 00 01 00
> ACL data: handle 0x0029 flags 0x02 dlen 39
L2CAP(d): cid 0x0040 len 35 [psm 0]
09 FF 3D 01 7E FF 7D 23 C0 21 7D 29 52 7D 20 7D 2C 7D 20 7D
20 7D 20 7D 20 FF 7D 23 C0 21 7D 31 B0 7E 5C
< ACL data: handle 0x0029 flags 0x02 dlen 37
L2CAP(d): cid 0x0040 len 33 [psm 0]
0B EF 3B 7E FF 7D 23 C0 21 7D 2A 52 7D 20 7D 2C 7D 20 7D 20
7D 20 7D 20 FF 7D 23 C0 21 FF 37 7E 9A
> HCI Event: Number of Completed Packets (0x13) plen 5
01 29 00 01 00
> HCI Event: Connect Complete (0x03) plen 11
04 00 00 E1 CD 70 57 60 00 01 00