Skip to contentSkip to conversation

Error: sdptool browse --> Connection reset by peer

Bluez-devel JP Freeley 4 participants 19 messages Jul 19, 2006 – Aug 2, 2006

Subsystems (2)
lore
Share & tools
lore

JP Freeley

author
#0 lore raw

I am getting an error ("Connection reset by peer") when I run an "sdptool browse" and it discovers my Sprint Pocket PC handset.

I'm sure this is probably a common situation. I have attached my "hcidump -V -R". Any help in deciphering this problem would be great. My goal is to send a .vcf file to the device.

Could this device be looking at my "device class" and refusing the connection?

Of course, I'd be happy to provide any other info as necessary to assit.

TIA,

jpf

*** HCICONFIG ***

% hciconfig -a

hci0: Type: USB

        BD Address: 00:03:C9:87:37:13 ACL MTU: 1017:8 SCO MTU: 64:0

        UP RUNNING PSCAN ISCAN 

        RX bytes:18007 acl:307 sco:0 events:523 errors:0

        TX bytes:90101 acl:325 sco:0 commands:129 errors:0

        Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80

        Packet type: DM1 DH1 HV1 

        Link policy: RSWITCH HOLD SNIFF PARK 

        Link mode: SLAVE ACCEPT 

        Name: 'bbm-0'

        Class: 0x100100

        Service Classes: 

        Device Class: Computer, Uncategorized

        HCI Ver: 2.0 (0x3) HCI Rev: 0x2000 LMP Ver: 2.0 (0x3) LMP Subver: 0x4127

        Manufacturer: Broadcom Corporation (15)

*** HCIDUMP ***

% hcidump -V -R

HCI sniffer - Bluetooth packet analyzer ver 1.30

device: hci0 snap_len: 1028 filter: 0xffffffff

< 01 01 04 05 33 8B 9E 0A 14

< HCI Command: Inquiry (0x01|0x0001) plen 5

    lap 0x9e8b33 len 10 num 20
Quoted 3 lines

04 0F 04 00 01 01 04

HCI Event: Command Status (0x0f) plen 4

    Inquiry (0x01|0x0001) status 0x00 ncmd 1
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CA 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1eca class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CA 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1eca class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CB 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1ecb class 0x100114
Quoted 3 lines

04 02 0F 01 99 CD B9 37 12 00 01 00 00 14 01 10 CA 1E

HCI Event: Inquiry Result (0x02) plen 15

    bdaddr 00:12:37:B9:CD:99 mode 1 clkoffset 0x1eca class 0x100114
Quoted 3 lines

04 01 01 00

HCI Event: Inquiry Complete (0x01) plen 1

    status 0x00

< 01 05 04 0D 99 CD B9 37 12 00 18 00 01 00 CA 9E 01

< HCI Command: Create Connection (0x01|0x0005) plen 13

bdaddr 00:12:37:B9:CD:99 ptype 0x0018 rswitch 0x01 clkoffset 0x1eca (valid)

Packet type: DM1 DH1

Quoted 3 lines

04 0F 04 00 01 05 04

HCI Event: Command Status (0x0f) plen 4

    Create Connection (0x01|0x0005) status 0x00 ncmd 1
Quoted 3 lines

04 03 0B 00 0C 00 99 CD B9 37 12 00 01 00

HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 12 bdaddr 00:12:37:B9:CD:99 type ACL encrypt 0x00

< 02 0C 20 0C 00 08 00 01 00 02 01 04 00 01 00 40 00

< 01 0D 08 04 0C 00 0F 00

< ACL data: handle 12 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 1 scid 0x0040

< HCI Command: Write Link Policy Settings (0x02|0x000d) plen 4

handle 12 policy 0x0f

Link policy: RSWITCH HOLD SNIFF PARK

Quoted 3 lines

04 0E 06 01 0D 08 00 0C 00

HCI Event: Command Complete (0x0e) plen 6

    Write Link Policy Settings (0x02|0x000d) ncmd 1

    status 0x00 handle 12
Quoted 3 lines

04 05 04 00 0C 00 13

HCI Event: Disconn Complete (0x05) plen 4

status 0x00 handle 12 reason 0x13

Reason: Remote User Terminated Connection

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi,

Quoted 6 lines

I am getting an error ("Connection reset by peer") when I run an "sdptool browse" and it discovers my Sprint Pocket PC handset.

I'm sure this is probably a common situation. I have attached my "hcidump -V -R". Any help in deciphering this problem would be great. My goal is to send a .vcf file to the device.

please include "hcidump -X -V".

Regards

Marcel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

author
#2 lore raw

Mr. Holtmann--

Thanks for the reply, but I'm having trouble replicating the situation. I'm having trouble in general I think. My bluetooth setup seems quite finicky and unstable. There are so many factors which affect this, it's hard to point the finger at any single point of failure. (Could be handheld devices, could be Linux, could be bluez, could be BT Dongle, could be kernel, etc.)

I can send you any notes on my configuration that may lend clues, just tell me where to start. I just ran an "apt-get upgrade" last night and haven't had much time to see if it helped at all yet.

Thanks,

jpf

Quoted 16 lines · Marcel Holtmann

Hi,

Quoted 4 lines

I am getting an error ("Connection reset by peer") when I run an "sdptool browse" and it discovers my Sprint Pocket PC handset.

I'm sure this is probably a common situation. I have attached my "hcidump -V -R". Any help in deciphering this problem would be great. My goal is to send a .vcf file to the device.

please include "hcidump -X -V".

Regards

Marcel

Quoted 11 lines

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw

[Bluez-devel] It's rfcomm connect problem

In reply to Marcel Holtmann

Hi all,
I made some investigation about the BtOBEX_TransportConnect signaled to the list and Marcel some days before.
Openobex isn't involved in the problem, in my try I've writed from scatch a simple obex push client (not using openobex but only socket).
In my test I found this : if there are two thread (also two process) making something like

  ...
  ret = connect(fd, (struct sockaddr *)dst, sizeof(struct sockaddr_rd));
  ...

in simultaneous way the second always fail (return -1). I've also tryed to "protect" the connect using a mutex and all works but (naturally) second connection result conditioned to the frist (syncronous so thread it is not useful).

I think there is some solution to this but I don't know if it's using some ioctl on socket (nonbloking?) or some hci command to adapter. Please can some one give me some hint?

I'm looking at kernel source related to rfcomm (/usr/src/ linux-2.6.116/net/bluetooth/rfcomm/*.c) but I'm not sure the problem reside here...

thanks, bye
Fabrizio

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#5 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Hi Fabrizio,

i'm working on a possibly related problem. Could you check the hcidump of your situation and look out for apparently unmotivated hci_reset commands sent to your device?

Greetings & TIA

Andy

Quoted 30 lines · On Sat, 22 Jul 2006 16:08:08 +0200 Fabrizio Guglielmino…

Hi all,
I made some investigation about the BtOBEX_TransportConnect signaled to the list and Marcel some days before.
Openobex isn't involved in the problem, in my try I've writed from scatch a simple obex push client (not using openobex but only socket).
In my test I found this : if there are two thread (also two process) making something like

  ...
  ret = connect(fd, (struct sockaddr *)dst, sizeof(struct sockaddr_rd));
  ...

in simultaneous way the second always fail (return -1). I've also tryed to "protect" the connect using a mutex and all works but (naturally) second connection result conditioned to the frist (syncronous so thread it is not useful).

I think there is some solution to this but I don't know if it's using some ioctl on socket (nonbloking?) or some hci command to adapter. Please can some one give me some hint?

I'm looking at kernel source related to rfcomm (/usr/src/ linux-2.6.116/net/bluetooth/rfcomm/*.c) but I'm not sure the problem reside here...

thanks, bye
Fabrizio

Quoted 9 lines

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Hi Andy,
I Andy the problem I have is described in following hcidump:

< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:09:2D:2A:68:20 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000 Packet type: DM1 DM3 DM5 DH1 DH3 DH5

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Create Connection (0x01|0x0005) status 0x00 ncmd 1

< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:01:E3:25:53:44 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000 Packet type: DM1 DM3 DM5 DH1 DH3 DH5

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

Create Connection (0x01|0x0005) status 0x0c ncmd 1
Error: Command Disallowed

Quoted 1 line

HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 42 bdaddr 00:09:2D:2A:68:20 type ACL encrypt 0x00
< ACL data: handle 42 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 3 scid 0x0040
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 42 slots 5

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 16

    L2CAP(s): Connect rsp: dcid 0x0044 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 42 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0044 flags 0x00 clen 4
      MTU 1024
Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 16

    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 1691
< ACL data: handle 42 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0044 flags 0x00 result 0 clen 0
      Success
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 14

    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 42 flags 0x02 dlen 8
    L2CAP(d): cid 0x0044 len 4 [psm 3]
      RFCOMM(s): SABM: cr 1 dlci 0 pf 1 ilen 0 fcs 0x1c
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 8

    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): UA: cr 1 dlci 0 pf 1 ilen 0 fcs 0xd7

< ACL data: handle 42 flags 0x02 dlen 18
L2CAP(d): cid 0x0044 len 14 [psm 3]
RFCOMM(s): PN CMD: cr 1 dlci 0 pf 0 ilen 10 fcs 0x70 mcc_len 8 dlci 4 frame_type 0 credit_flow 15 pri 7 ack_timer 0 frame_size 1019 max_retrans 0 credits 7

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 18

L2CAP(d): cid 0x0040 len 14 [psm 3]
RFCOMM(s): PN RSP: cr 0 dlci 0 pf 0 ilen 10 fcs 0xaa mcc_len 8 dlci 4 frame_type 0 credit_flow 14 pri 0 ack_timer 0 frame_size 1019 max_retrans 0 credits 7
< ACL data: handle 42 flags 0x02 dlen 8

    L2CAP(d): cid 0x0044 len 4 [psm 3]
      RFCOMM(s): SABM: cr 1 dlci 4 pf 1 ilen 0 fcs 0x96
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 8

    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): UA: cr 1 dlci 4 pf 1 ilen 0 fcs 0x5d
< ACL data: handle 42 flags 0x02 dlen 12
    L2CAP(d): cid 0x0044 len 8 [psm 3]
      RFCOMM(s): MSC CMD: cr 1 dlci 0 pf 0 ilen 4 fcs 0x70 mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 12

    L2CAP(d): cid 0x0040 len 8 [psm 3]
      RFCOMM(s): MSC RSP: cr 0 dlci 0 pf 0 ilen 4 fcs 0xaa mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 12

    L2CAP(d): cid 0x0040 len 8 [psm 3]
      RFCOMM(s): MSC CMD: cr 0 dlci 0 pf 0 ilen 4 fcs 0xaa mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
< ACL data: handle 42 flags 0x02 dlen 12
    L2CAP(d): cid 0x0044 len 8 [psm 3]
      RFCOMM(s): MSC RSP: cr 1 dlci 0 pf 0 ilen 4 fcs 0x70 mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
< ACL data: handle 42 flags 0x02 dlen 9
    L2CAP(d): cid 0x0044 len 5 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 4 pf 1 ilen 0 fcs 0x79 credits 33
< ACL data: handle 42 flags 0x02 dlen 25
    L2CAP(d): cid 0x0044 len 21 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 4 pf 0 ilen 17 fcs 0x65
      0000: 80 00 11 10 00 08 00 00  00 00 00 00 00 00 00 00  =

................
0010: 00 .

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 9

    L2CAP(d): cid 0x0040 len 5 [psm 3]
      RFCOMM(d): UIH: cr 0 dlci 4 pf 1 ilen 0 fcs 0xa3 credits 23

As You can see the second Create Connection fails with a Command =

disallowed.....
In my case I've no see any hci_reset.....

Hi
Fabrizio

Andreas Gaufer ha scritto:

Quoted 7 lines

Hi Fabrizio,

i'm working on a possibly related problem. Could you check the hcidump of your situation and look out for apparently unmotivated hci_reset commands sent to your device? =

Quoted 23 lines

Greetings & TIA

Andy

On Sat, 22 Jul 2006 16:08:08 +0200
Fabrizio Guglielmino <[email protected]> wrote:

=

Quoted 14 lines

Hi all,
I made some investigation about the BtOBEX_TransportConnect signaled =

to the list and Marcel some days before.
Openobex isn't involved in the problem, in my try I've writed from =

scatch a simple obex push client (not using openobex but only socket).
In my test I found this : if there are two thread (also two process) =

making something like

...
ret =3D connect(fd, (struct sockaddr *)dst, sizeof(struct sockaddr_rd)=

);

Quoted 21 lines
Quoted 21 lines

...

in simultaneous way the second always fail (return -1). I've also =

tryed to "protect" the connect using a mutex and all works but (naturally) second connection result conditioned to the frist =

(syncronous so thread it is not useful).

I think there is some solution to this but I don't know if it's using =

some ioctl on socket (nonbloking?) or some hci command to adapter. Please can some one give me some hint?

I'm looking at kernel source related to rfcomm (/usr/src/ =

linux-2.6.116/net/bluetooth/rfcomm/*.c) but I'm not sure the problem =

reside here...

Quoted 7 lines
Quoted 7 lines

thanks, bye
Fabrizio =

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

your

Quoted 2 lines
Quoted 2 lines

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

=3DDEVDEV

Quoted 10 lines
Quoted 5 lines

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

    =

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

our

Quoted 2 lines

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

DEVDEV

Quoted 7 lines

_______________________________________________
Bluez-devel mailing list
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Hi Fabrizio,

thank your for that information. I guess your problem is just the same you had with sdp some while ago. A single BT Device can not *start* connecting to two different remote devices at the same time.

To solve this you have to find a way to:

1. Create Connection to device A
2. Wait until Connect Complete for A's bdaddr happens (no matter if failed or succ.)
3. Then continue with other Create Connection Commands

Greetings

Andy

Quoted 8 lines · On Mon, 24 Jul 2006 15:33:43 +0200 Fabrizio Guglielmino…

Hi Andy,
I Andy the problem I have is described in following hcidump:

< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:09:2D:2A:68:20 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000 Packet type: DM1 DM3 DM5 DH1 DH3 DH5

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Create Connection (0x01|0x0005) status 0x00 ncmd 1

-- this is too soon to connect to 00:01:E3:25:53:44....

Quoted 8 lines

< HCI Command: Create Connection (0x01|0x0005) plen 13
bdaddr 00:01:E3:25:53:44 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000 Packet type: DM1 DM3 DM5 DH1 DH3 DH5

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

Create Connection (0x01|0x0005) status 0x0c ncmd 1
Error: Command Disallowed

Quoted 1 line

HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 42 bdaddr 00:09:2D:2A:68:20 type ACL encrypt 0x00

-- after this changes are much better....

Quoted 85 lines

< ACL data: handle 42 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 3 scid 0x0040
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Max Slots Change (0x1b) plen 3

handle 42 slots 5

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 16

    L2CAP(s): Connect rsp: dcid 0x0044 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 42 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0044 flags 0x00 clen 4
      MTU 1024
Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 16

    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 4
      MTU 1691
< ACL data: handle 42 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0044 flags 0x00 result 0 clen 0
      Success
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 14

    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 42 flags 0x02 dlen 8
    L2CAP(d): cid 0x0044 len 4 [psm 3]
      RFCOMM(s): SABM: cr 1 dlci 0 pf 1 ilen 0 fcs 0x1c
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 8

    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): UA: cr 1 dlci 0 pf 1 ilen 0 fcs 0xd7

< ACL data: handle 42 flags 0x02 dlen 18
L2CAP(d): cid 0x0044 len 14 [psm 3]
RFCOMM(s): PN CMD: cr 1 dlci 0 pf 0 ilen 10 fcs 0x70 mcc_len 8 dlci 4 frame_type 0 credit_flow 15 pri 7 ack_timer 0 frame_size 1019 max_retrans 0 credits 7

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 18

L2CAP(d): cid 0x0040 len 14 [psm 3]
RFCOMM(s): PN RSP: cr 0 dlci 0 pf 0 ilen 10 fcs 0xaa mcc_len 8 dlci 4 frame_type 0 credit_flow 14 pri 0 ack_timer 0 frame_size 1019 max_retrans 0 credits 7
< ACL data: handle 42 flags 0x02 dlen 8

    L2CAP(d): cid 0x0044 len 4 [psm 3]
      RFCOMM(s): SABM: cr 1 dlci 4 pf 1 ilen 0 fcs 0x96
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 8

    L2CAP(d): cid 0x0040 len 4 [psm 3]
      RFCOMM(s): UA: cr 1 dlci 4 pf 1 ilen 0 fcs 0x5d
< ACL data: handle 42 flags 0x02 dlen 12
    L2CAP(d): cid 0x0044 len 8 [psm 3]
      RFCOMM(s): MSC CMD: cr 1 dlci 0 pf 0 ilen 4 fcs 0x70 mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 12

    L2CAP(d): cid 0x0040 len 8 [psm 3]
      RFCOMM(s): MSC RSP: cr 0 dlci 0 pf 0 ilen 4 fcs 0xaa mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 12

    L2CAP(d): cid 0x0040 len 8 [psm 3]
      RFCOMM(s): MSC CMD: cr 0 dlci 0 pf 0 ilen 4 fcs 0xaa mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
< ACL data: handle 42 flags 0x02 dlen 12
    L2CAP(d): cid 0x0044 len 8 [psm 3]
      RFCOMM(s): MSC RSP: cr 1 dlci 0 pf 0 ilen 4 fcs 0x70 mcc_len 2
      dlci 4 fc 0 rtc 1 rtr 1 ic 0 dv 1 b1 1 b2 1 b3 0 len 0
< ACL data: handle 42 flags 0x02 dlen 9
    L2CAP(d): cid 0x0044 len 5 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 4 pf 1 ilen 0 fcs 0x79 credits 33
< ACL data: handle 42 flags 0x02 dlen 25
    L2CAP(d): cid 0x0044 len 21 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 4 pf 0 ilen 17 fcs 0x65
      0000: 80 00 11 10 00 08 00 00  00 00 00 00 00 00 00 00  

................
0010: 00 .

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 42 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

Quoted 9 lines

handle 42 packets 1

Quoted 1 line

ACL data: handle 42 flags 0x02 dlen 9

    L2CAP(d): cid 0x0040 len 5 [psm 3]
      RFCOMM(d): UIH: cr 0 dlci 4 pf 1 ilen 0 fcs 0xa3 credits 23

As You can see the second Create Connection fails with a Command disallowed.....
In my case I've no see any hci_reset.....

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#8 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Hi Andreas,

Quoted 9 lines

thank your for that information. I guess your problem is just the same you had with sdp some while ago. A single BT Device can not *start* connecting to two different remote devices at the same time.

To solve this you have to find a way to:

1. Create Connection to device A
2. Wait until Connect Complete for A's bdaddr happens (no matter if failed or succ.)
3. Then continue with other Create Connection Commands

we have a plan to make the L2CAP layer handle multiple ACL connects and try again if one attempt fails. However the last patch I wrote for it got lost somehow and it was broken anyway. The mailing list should contain a thread where I proposed how this must be handled. I don't have time to look at it at the moment. So if anybody wants to work on it, please do so and send in a patch.

Regards

Marcel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#9 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Hi Marcel,

i see the problem here and studied the mails about that. We workaround it by retrying socket a couple of times which works OK even if it wont scale too good up to the theoretical maximum of connections.

In the moment I'm debugging some phenomena that sends hci_reset to hci devices that run more than one connection while pumping on maximum negotiated MTU (Obex Layer). I don't know where its coming from yet, I'll keep you updated on my findings. =

I would be happy joining the work on the L2CAP later.

Greetings

Andy

Quoted 15 lines · On Mon, 24 Jul 2006 18:35:12 +0200 Marcel Holtmann <[email protected]> wrote:

Hi Andreas,
=

Quoted 12 lines

thank your for that information. I guess your problem is just the same you had with sdp some while ago. A single BT Device can not *start* connecting to two different remote devices at the same time. =

=

To solve this you have to find a way to:
=

1. Create Connection to device A =

2. Wait until Connect Complete for A's bdaddr happens (no matter if fai=

led or succ.)

Quoted 17 lines
Quoted 1 line

3. Then continue with other Create Connection Commands

=

we have a plan to make the L2CAP layer handle multiple ACL connects and try again if one attempt fails. However the last patch I wrote for it got lost somehow and it was broken anyway. The mailing list should contain a thread where I proposed how this must be handled. I don't have time to look at it at the moment. So if anybody wants to work on it, please do so and send in a patch.
=

Regards
=

Marcel
=

Quoted 7 lines

=

=

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

our

Quoted 2 lines

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

DEVDEV

Quoted 4 lines

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-- =

-- =

mit freundlichen Gr=FC=DFen / best regards,

Andreas Gaufer

Office: +49 951-700428-91
Fax: +49 951-700428-87
Mail: [email protected]

I fully agree with RFC 1855

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#10 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Ok many thanks to all..

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.

Any suggestion will be appreciated ....

Bye
Fabrizio

Il giorno 24/lug/06, alle ore 20:34, Andreas Gaufer ha scritto:

Quoted 98 lines

Hi Marcel,

i see the problem here and studied the mails about that. We workaround it by retrying socket a couple of times which works OK even if it wont scale too good up to the theoretical maximum of connections.

In the moment I'm debugging some phenomena that sends hci_reset to hci devices that run more than one connection while pumping on maximum negotiated MTU (Obex Layer). I don't know where its coming from =

yet, I'll
keep you updated on my findings.

I would be happy joining the work on the L2CAP later.

Greetings

Andy

Quoted 42 lines · On Mon, 24 Jul 2006 18:35:12 +0200 Marcel Holtmann <[email protected]> wrote:

Hi Andreas,

Quoted 6 lines

thank your for that information. I guess your problem is just the =

same
you had with sdp some while ago. A single BT Device can not *start* connecting to two different remote devices at the same time.

Quoted 7 lines

To solve this you have to find a way to:

1. Create Connection to device A
2. Wait until Connect Complete for A's bdaddr happens (no matter =

if failed or succ.)
3. Then continue with other Create Connection Commands

we have a plan to make the L2CAP layer handle multiple ACL =

connects and
try again if one attempt fails. However the last patch I wrote for it got lost somehow and it was broken anyway. The mailing list should contain a thread where I proposed how this must be handled. I =

don't have
time to look at it at the moment. So if anybody wants to work on it, please do so and send in a patch.

Regards

Marcel

--------------------------------------------------------------------- =

----
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 =

Quoted 8 lines

cash
http://www.techsay.com/default.php? =

page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-- =

-- =

mit freundlichen Gr=FC=DFen / best regards,

Andreas Gaufer

Office: +49 951-700428-91
Fax: +49 951-700428-87
Mail: [email protected]

I fully agree with RFC 1855

---------------------------------------------------------------------- =

---
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 =

Quoted 9 lines

cash
http://www.techsay.com/default.php? =

page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#11 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

Hi Fabrizio,

Quoted 4 lines

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

include/net/bluetooth/l2cap.h +2 -0
index 8242a0e..cb19e66 100644
@@ -183,6 +183,8 @@ struct l2cap_chan_list {
 };
 
 struct l2cap_conn {
+	struct list_head list;
+
 	struct hci_conn	*hcon;
 
 	bdaddr_t	*dst;
net/bluetooth/l2cap.c +51 -16

93 lines not on this page · raw message

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

author
#3 lore raw
In reply to JP Freeley

Just FYI ....
It seems as though most of my woes are over.
As it turns out, I was running the debian-etch version of bluez ..
which seems to be a bit stale, and still buggy.

I recompiled based on the 3.1.tar.gz packages from
bluez.sourceforge.net and everything seems working much better.

My problem right now is that the /etc/init.d/bluetooth script doesn't work. I went through and fixed paths to /usr/local/sbin (from simply /usr/sbin) .. It produces no log output and doesn't start any daemons, just a quiet exit. Any thoughts would be appreciated. When I run the most important commands by hand, they work fine (so it must be failing before trying to execute these commands):
start-stop-daemon --start --exec /usr/local/sbin/hcid
start-stop-daemon --start --exec /usr/local/sbin/sdpd
(I think I have kernel rfcomm [krfcommd])

Thanks

jpf

Quoted 47 lines · JP Freeley

Mr. Holtmann--

Thanks for the reply, but I'm having trouble replicating the situation. I'm having trouble in general I think. My bluetooth setup seems quite finicky and unstable. There are so many factors which affect this, it's hard to point the finger at any single point of failure. (Could be handheld devices, could be Linux, could be bluez, could be BT Dongle, could be kernel, etc.)

I can send you any notes on my configuration that may lend clues, just tell me where to start. I just ran an "apt-get upgrade" last night and haven't had much time to see if it helped at all yet.

Thanks,

jpf

Quoted 16 lines · Marcel Holtmann

Hi,

Quoted 4 lines

I am getting an error ("Connection reset by peer") when I run an "sdptool browse" and it discovers my Sprint Pocket PC handset.

I'm sure this is probably a common situation. I have attached my "hcidump -V -R". Any help in deciphering this problem would be great. My goal is to send a .vcf file to the device.

please include "hcidump -X -V".

Regards

Marcel

Quoted 11 lines

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

------------------------------------------------------------------------

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
------------------------------------------------------------------------

Quoted 5 lines

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#12 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

In reply to Marcel Holtmann

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:

Quoted 151 lines

Hi Fabrizio,

=

Quoted 7 lines

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

=

------------------------------------------------------------------------

include/net/bluetooth/l2cap.h +2 -0
index 8242a0e..cb19e66 100644
@@ -183,6 +183,8 @@ struct l2cap_chan_list {
 };
 =
 
 struct l2cap_conn {
+	struct list_head list;
+
 	struct hci_conn	*hcon;
 =
include/net/bluetooth/l2cap.h +0 -0
 	bdaddr_t	*dst;
net/bluetooth/l2cap.c +3 -0
index eaaad65..1d1c423 100644
@@ -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);

net/bluetooth/l2cap.c +4 -0
@@ -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)
net/bluetooth/l2cap.c +17 -12
 		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:

net/bluetooth/l2cap.c +27 -4
@@ -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;
}
=

Quoted 5 lines

------------------------------------------------------------------------

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

our

Quoted 2 lines

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

DEVDEV

Quoted 7 lines

------------------------------------------------------------------------

_______________________________________________
Bluez-devel mailing list
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#13 lore raw

Re: [Bluez-devel] It's rfcomm connect problem [ERRATA]

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

Fabrizio Guglielmino ha scritto:

Quoted 15 lines

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 =

Quoted 165 lines

understand how modules works to make try to make the patch.

Many thanks
Fabrizio

Marcel Holtmann ha scritto:

Quoted 158 lines

Hi Fabrizio,

=

Quoted 7 lines

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

=

------------------------------------------------------------------------

= renamed from include/net/bluetooth/l2cap.h +0 -0

b/include/net/bluetooth/l2cap.h
index 8242a0e..cb19e66 100644

include/net/bluetooth/l2cap.h +2 -0
@@ -183,6 +183,8 @@ struct l2cap_chan_list {
 };
 =
 
 struct l2cap_conn {
+    struct list_head list;
+
     struct hci_conn    *hcon;
 =
     bdaddr_t    *dst;
net/bluetooth/l2cap.c +3 -0
index eaaad65..1d1c423 100644
@@ -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);

net/bluetooth/l2cap.c +4 -0
@@ -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);

=

net/bluetooth/l2cap.c +17 -12
@@ -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:

net/bluetooth/l2cap.c +27 -4
@@ -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;

}
=

------------------------------------------------------------------------

------------------------------------------------------------------------=

- =

Quoted 7 lines
Quoted 7 lines

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 =

Quoted 11 lines
Quoted 8 lines

------------------------------------------------------------------------

_______________________________________________
Bluez-devel mailing list
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#14 lore raw

Re: [Bluez-devel] It's rfcomm connect problem

In reply to Fabrizio Guglielmino

Hi Fabrizio,

Quoted 5 lines

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).

one warning up-front. I never actually ran this patch on any machine. It is only compile tested. So it might crash your system.

Quoted 3 lines

My problems are with kernel programming enviromnment:

1) I'm using kernel-2.6.10 I have to update to a more recent version?

It might work, but I advise you to develop against 2.6.18-rc2 or even the Git repository from Linus.

Quoted 2 lines

2) Is there some documentation about bluez kernel modules? I need to understand how modules works to make try to make the patch.

Check out the kernel documentation itself. There exists no specific BlueZ documentation for kernel programming.

Regards

Marcel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#15 lore raw

[Bluez-devel] About l2cap patch to handle multiple connections....

Hi I'm trying to play with the patch to make it work (as Marcel said it =

hangs my machine).

First I'm trying a simple debug by printing to find where it hangs...

There is a first question about this: various BT_DBG statements that =

print bluetooth address
in string format (using batostr) print them in reverse =

order(00:01:02.... is printed 02:01:00).
My test machine is a powerpc based mac, I've used in user-space the =

ba2str without problems in same architecture
so I'm confused about this.

An other dubt is about following log :

Jul 31 10:36:39 localhost kernel: [  596.604617] Bluetooth: =

00:00:00:00:00:00 -> 44:53:25:E3:01:00 psm 0x300

Jul 31 10:36:39 localhost kernel: [  596.606752] Bluetooth: =

00:00:00:00:00:00 -> 20:68:2A:2D:09:00 psm 0x300
(address are in reverse order as I said above)

Why psm is 0x300? May be also the psm in reverse order and really it's =

0x003 (RFCOMM) as I would have expected ?

Many thanks
Fabrizio

Marcel Holtmann ha scritto:

Quoted 41 lines

Hi Fabrizio,

=

Quoted 8 lines

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).

    =

one warning up-front. I never actually ran this patch on any machine. It is only compile tested. So it might crash your system.

=

Quoted 4 lines

My problems are with kernel programming enviromnment:

1) I'm using kernel-2.6.10 I have to update to a more recent version?

    =

It might work, but I advise you to develop against 2.6.18-rc2 or even the Git repository from Linus.

=

Quoted 4 lines

2) Is there some documentation about bluez kernel modules? I need to =

understand how modules works to make try to make the patch.

    =

Check out the kernel documentation itself. There exists no specific BlueZ documentation for kernel programming.

Regards

Quoted 7 lines

Marcel

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

our

Quoted 2 lines

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

DEVDEV

Quoted 7 lines

_______________________________________________
Bluez-devel mailing list
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#16 lore raw

Re: [Bluez-devel] About l2cap patch to handle multiple connections....

Hi Fabrizio,

Quoted 5 lines

Hi I'm trying to play with the patch to make it work (as Marcel said it hangs my machine).

First I'm trying a simple debug by printing to find where it hangs...

Quoted 7 lines

There is a first question about this: various BT_DBG statements that print bluetooth address
in string format (using batostr) print them in reverse order(00:01:02.... is printed 02:01:00).
My test machine is a powerpc based mac, I've used in user-space the ba2str without problems in same architecture
so I'm confused about this.

this is normal. We don't bother to swap the address for the debug messages. In Bluetooth the address is always used in the reversed order, but for the human eyes it is swapped.

Quoted 10 lines

An other dubt is about following log :

Jul 31 10:36:39 localhost kernel: [  596.604617] Bluetooth: 
00:00:00:00:00:00 -> 44:53:25:E3:01:00 psm 0x300
Jul 31 10:36:39 localhost kernel: [  596.606752] Bluetooth: 

00:00:00:00:00:00 -> 20:68:2A:2D:09:00 psm 0x300
(address are in reverse order as I said above)

Why psm is 0x300? May be also the psm in reverse order and really it's 0x003 (RFCOMM) as I would have expected ?

This looks like a big endian bug. The PSM value is in little endian order.

Regards

Marcel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#17 lore raw

Re: [Bluez-devel] About l2cap patch to handle multiple connections....

I have not made great progresses but I try to explain them looking some one can help me.
System hangs after l2cap_connect_cfm function, this is called for every device to which I try to connect to (in my case only 2).

In non-patched version of l2cap_connect_cfm there was a call to l2cap_conn_ready if status was 0x00 on a valid conn.
In patched version l2cap_conn_ready is no more called. l2cap_conn_ready it seems to execute the l2cap connection request so is
this a forgetfulness? I've try to insert the call but without success (system hangs again) so if the response to previous question is true this is not the only problem.

I hope someone (more expert of me on this layer) can help to make me to work this patch.

thanks
Fabrizio

Marcel Holtmann ha scritto:

Quoted 43 lines

Hi Fabrizio,

Quoted 5 lines

Hi I'm trying to play with the patch to make it work (as Marcel said it hangs my machine).

First I'm trying a simple debug by printing to find where it hangs...

Quoted 8 lines

There is a first question about this: various BT_DBG statements that print bluetooth address
in string format (using batostr) print them in reverse order(00:01:02.... is printed 02:01:00).
My test machine is a powerpc based mac, I've used in user-space the ba2str without problems in same architecture
so I'm confused about this.

this is normal. We don't bother to swap the address for the debug messages. In Bluetooth the address is always used in the reversed order, but for the human eyes it is swapped.

Quoted 11 lines

An other dubt is about following log :

Jul 31 10:36:39 localhost kernel: [  596.604617] Bluetooth: 
00:00:00:00:00:00 -> 44:53:25:E3:01:00 psm 0x300
Jul 31 10:36:39 localhost kernel: [  596.606752] Bluetooth: 

00:00:00:00:00:00 -> 20:68:2A:2D:09:00 psm 0x300
(address are in reverse order as I said above)

Why psm is 0x300? May be also the psm in reverse order and really it's 0x003 (RFCOMM) as I would have expected ?

This looks like a big endian bug. The PSM value is in little endian order.

Regards

Marcel

Quoted 12 lines

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#18 lore raw

Re: [Bluez-devel] About l2cap patch to handle multiple connections....

Hi Fabrizio,

Quoted 5 lines

I have not made great progresses but I try to explain them looking some one can help me.
System hangs after l2cap_connect_cfm function, this is called for every device to which I try to connect to (in my case only 2).

Quoted 7 lines

In non-patched version of l2cap_connect_cfm there was a call to l2cap_conn_ready if status was 0x00 on a valid conn.
In patched version l2cap_conn_ready is no more called. l2cap_conn_ready it seems to execute the l2cap connection request so is
this a forgetfulness? I've try to insert the call but without success (system hangs again) so if the response to previous question is true this is not the only problem.

the call to l2cap_conn_ready() is still there. Check the code in more detail.

Actually the code after l2cap_conn_read() to find the next pending ACL connection might be the problem.

Regards

Marcel

-------------------------------------------------------------------------
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=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel