Skip to contentSkip to conversation

rfcomm socket and rfcomm tty

Bluez-devel mike 2 participants 10 messages Dec 28, 2004 – Jan 5, 2005 Bluetooth drivers

lore
Share & tools
lore

mike

author
#0 lore raw

Dear all

I have little knowledge on tty structure, so i want to clarify
something is that, if i want to connect to a rfcomm enabled phone. Are there any difference when i sending raw data to the phone with tty rfcomm and socket rfcomm? I ask this question because i see that from bluez-util rfcomm source code, tty connection is built up from socket first and then set the tty attr. So if i do not need tty functions, only read/write from/to external device is needed, socket rfcomm will be more simple. Am i right?

If i make any thing wrong, please tell me.
Thanks

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

maintainer
#1 lore raw

Hi Mike,

Quoted 8 lines

I have little knowledge on tty structure, so i want to clarify
something is that, if i want to connect to a rfcomm enabled phone. Are there any difference when i sending raw data to the phone with tty rfcomm and socket rfcomm? I ask this question because i see that from bluez-util rfcomm source code, tty connection is built up from socket first and then set the tty attr. So if i do not need tty functions, only read/write from/to external device is needed, socket rfcomm will be more simple. Am i right?

this is right. The RFCOMM socket is the native interface and the TTY is only there for legacy reasons.

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

author
#2 lore raw

Dear Marcel
Thanks for your clarification.
Here come to a question , i am wrting a socket rfcomm program and
try to use it connect to a bluetooth rfcomm channel by bluez-util rfcomm listen from two different computer. My program gives out "Resource temporarily unavailable" after connect system call . Here is the hcidump from listening side, there is a pause from listening side when connect system call fail.

Quoted 1 line

HCI Event: Connect Request (0x04) plen 10

< HCI Command: Accept Connection Request (0x01|0x0009) plen 7

Quoted 2 lines

HCI Event: Command Status (0x0f) plen 4
HCI Event: Connect Complete (0x03) plen 11

< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4

Quoted 5 lines

HCI Event: Page Scan Repetition Mode Change (0x20) plen 7 HCI Event: Command Status (0x0f) plen 4
HCI Event: Connection Packet Type Changed (0x1d) plen 5 HCI Event: Max Slots Change (0x1b) plen 3
ACL data: handle 0x0028 flags 0x02 dlen 12

L2CAP(s): Connect req: psm 3 scid 0x0040
< ACL data: handle 0x0028 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0

Quoted 2 lines

HCI Event: Number of Completed Packets (0x13) plen 5 ACL data: handle 0x0028 flags 0x02 dlen 16

L2CAP(s): Config req: dcid 0x0040 flags 0x0000 clen 4 MTU 1024
< ACL data: handle 0x0028 flags 0x02 dlen 14
L2CAP(s): Config rsp: scid 0x0040 flags 0x0000 result 0 clen 0
< ACL data: handle 0x0028 flags 0x02 dlen 16
L2CAP(s): Config req: dcid 0x0040 flags 0x0000 clen 4 MTU 1024

Quoted 3 lines

HCI Event: Number of Completed Packets (0x13) plen 5 HCI Event: Number of Completed Packets (0x13) plen 5 ACL data: handle 0x0028 flags 0x02 dlen 14

L2CAP(s): Config rsp: scid 0x0040 flags 0x0000 result 0 clen 0

Quoted 1 line

ACL data: handle 0x0028 flags 0x02 dlen 8

L2CAP(d): cid 0x0040 len 4 [psm 3]

     RFCOMM(s): SABM: cr 1 dlci 0 pf 1 ilen 0 fcs 0x1c

------------------------------------------------------------------------------- Pause here

Quoted 1 line

ACL data: handle 0x0028 flags 0x02 dlen 8

L2CAP(d): cid 0x0040 len 4 [psm 3]

     RFCOMM(s): DISC: cr 1 dlci 6 pf 1 ilen 0 fcs 0x32
Quoted 1 line

ACL data: handle 0x0028 flags 0x02 dlen 12

L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 0x0028 flags 0x02 dlen 12
L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040

Quoted 2 lines

HCI Event: Number of Completed Packets (0x13) plen 5 HCI Event: Disconn Complete (0x05) plen 4

Thanks for helping
best regard
Mike,Lee

Quoted 19 lines · Marcel Holtmann

Hi Mike,

Quoted 4 lines

I have little knowledge on tty structure, so i want to clarify
something is that, if i want to connect to a rfcomm enabled phone. Are there any difference when i sending raw data to the phone with tty rfcomm and socket rfcomm? I ask this question because i see that from bluez-util rfcomm source code, tty connection is built up from socket first and then set the tty attr. So if i do not need tty functions, only read/write from/to external device is needed, socket rfcomm will be more simple. Am i right?

this is right. The RFCOMM socket is the native interface and the TTY is only there for legacy reasons.

Regards

Marcel

Quoted 11 lines

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

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#3 lore raw

Hi Mike,

Quoted 3 lines

Here come to a question , i am wrting a socket rfcomm program and
try to use it connect to a bluetooth rfcomm channel by bluez-util rfcomm listen from two different computer.

this makes no sense. Either you use rfcomm or you deal with the RFCOMM socket in your own program. Both things at the same time are not possible. Post more details about your program.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

author
#4 lore raw

Dear Marcel
Thanks for reply.

Is it mean that rfcomm socket can not connect to a rfcomm tty? If the answer is yes, Does it mean that all program base on bluez
should use rfcomm tty to connect to bluetooth Serial Port profile?

actually, i get mess up something on bluetooth. Please help

best regard
Mike,Lee

Quoted 20 lines · Marcel Holtmann

Hi Mike,

Quoted 4 lines

Here come to a question , i am wrting a socket rfcomm program and
try to use it connect to a bluetooth rfcomm channel by bluez-util rfcomm listen from two different computer.

this makes no sense. Either you use rfcomm or you deal with the RFCOMM socket in your own program. Both things at the same time are not possible. Post more details about your program.

Regards

Marcel

Quoted 11 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#5 lore raw

Hi Mike,

Quoted 3 lines

Is it mean that rfcomm socket can not connect to a rfcomm tty? If the answer is yes, Does it mean that all program base on bluez
should use rfcomm tty to connect to bluetooth Serial Port profile?

you can use RFCOMM socket or RFCOMM TTY to connect to the serial port profile. Nothing matters and actually you can convert a socket into a TTY if it is needed later. However if you don't need a TTY for legacy reasons then always use the RFCOMM socket, because this will be much cleaner and easier.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

author
#6 lore raw

Dear Marcel
Thanks for explain.

Actually, i have tried to connect to Window base computer and test
with hyperterminal . my program does success in connection and send out data. But when i try to connect to rfcomm listen in another computer, it comes out a oops. and then my usb dongle halt and need a OS reboot.
Do you have any idea on below oops? Thanks for helping

------------[ cut here ]------------
kernel BUG at include/linux/module.h:325!
invalid operand: 0000 [#1]
CPU:    0
EIP:    0060:[<129d25e1>]    Not tainted
EFLAGS: 00010246   (2.6.5-1.358)

EIP is at rfcomm_session_add+0x73/0x88 [rfcomm]
eax: 00000000 ebx: 0e63a984 ecx: 00000000 edx: 11ee5400
esi: 00000002 edi: 0e63a9b0 ebp: 0bda8080 esp: 0e283fa4
ds: 007b es: 007b ss: 0068
Process krfcommd (pid: 1835, threadinfo=0e283000 task=10ee39b0)

Stack: 128daba0 0bda8080 0a7e1800 0397c91c 129d3b29 029d91a8 129d84f0 00000000
      0e283000 00000000 0e283fde 00000000 129d3f49 00000000 00000000 
0000007b
      0000007b 129d3ef1 00000000 021041d9 00000000 00000000 00000000
Call Trace:
[<129d3b29>] rfcomm_worker+0x10b/0x3a6 [rfcomm]
[<129d3f49>] rfcomm_run+0x58/0x6b [rfcomm]
[<129d3ef1>] rfcomm_run+0x0/0x6b [rfcomm]
[<021041d9>] kernel_thread_helper+0x5/0xb

Code: 0f 0b 45 01 ff 5f 9d 12 ff 05 00 89 9d 12 89 d8 5b 5e 5f 5d

best regard
Mike,Lee

Quoted 23 lines · Marcel Holtmann

Hi Mike,

Quoted 5 lines

Is it mean that rfcomm socket can not connect to a rfcomm tty? If the answer is yes, Does it mean that all program base on bluez
should use rfcomm tty to connect to bluetooth Serial Port profile?

you can use RFCOMM socket or RFCOMM TTY to connect to the serial port profile. Nothing matters and actually you can convert a socket into a TTY if it is needed later. However if you don't need a TTY for legacy reasons then always use the RFCOMM socket, because this will be much cleaner and easier.

Regards

Marcel

Quoted 11 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#7 lore raw

Hi Mike,

Quoted 17 lines

Actually, i have tried to connect to Window base computer and test
with hyperterminal . my program does success in connection and send out data. But when i try to connect to rfcomm listen in another computer, it comes out a oops. and then my usb dongle halt and need a OS reboot.
Do you have any idea on below oops? Thanks for helping

------------[ cut here ]------------
kernel BUG at include/linux/module.h:325!
invalid operand: 0000 [#1]
CPU:    0
EIP:    0060:[<129d25e1>]    Not tainted
EFLAGS: 00010246   (2.6.5-1.358)

EIP is at rfcomm_session_add+0x73/0x88 [rfcomm]
eax: 00000000 ebx: 0e63a984 ecx: 00000000 edx: 11ee5400
esi: 00000002 edi: 0e63a9b0 ebp: 0bda8080 esp: 0e283fa4
ds: 007b es: 007b ss: 0068
Process krfcommd (pid: 1835, threadinfo=0e283000 task=10ee39b0)

Quoted 12 lines
Stack: 128daba0 0bda8080 0a7e1800 0397c91c 129d3b29 029d91a8 129d84f0 
00000000
       0e283000 00000000 0e283fde 00000000 129d3f49 00000000 00000000 
0000007b
       0000007b 129d3ef1 00000000 021041d9 00000000 00000000 00000000
Call Trace:
 [<129d3b29>] rfcomm_worker+0x10b/0x3a6 [rfcomm]
 [<129d3f49>] rfcomm_run+0x58/0x6b [rfcomm]
 [<129d3ef1>] rfcomm_run+0x0/0x6b [rfcomm]
 [<021041d9>] kernel_thread_helper+0x5/0xb
 
Code: 0f 0b 45 01 ff 5f 9d 12 ff 05 00 89 9d 12 89 d8 5b 5e 5f 5d

what kernel is this? Try the latest one.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

author
#8 lore raw

Dear Marcel
It is 2.6.5, which is default kernel of Fedora 2.
Does it the problem on kernel?Actually, i really no idea for that.

best regard
Mike,Lee

Quoted 42 lines · Marcel Holtmann

Hi Mike,

Quoted 15 lines

Actually, i have tried to connect to Window base computer and test
with hyperterminal . my program does success in connection and send out data. But when i try to connect to rfcomm listen in another computer, it comes out a oops. and then my usb dongle halt and need a OS reboot.
Do you have any idea on below oops? Thanks for helping

------------[ cut here ]------------
kernel BUG at include/linux/module.h:325!
invalid operand: 0000 [#1]
CPU:    0
EIP:    0060:[<129d25e1>]    Not tainted
EFLAGS: 00010246   (2.6.5-1.358)

EIP is at rfcomm_session_add+0x73/0x88 [rfcomm]
eax: 00000000 ebx: 0e63a984 ecx: 00000000 edx: 11ee5400
esi: 00000002 edi: 0e63a9b0 ebp: 0bda8080 esp: 0e283fa4
ds: 007b es: 007b ss: 0068
Process krfcommd (pid: 1835, threadinfo=0e283000 task=10ee39b0)

Quoted 13 lines
Stack: 128daba0 0bda8080 0a7e1800 0397c91c 129d3b29 029d91a8 129d84f0 00000000
      0e283000 00000000 0e283fde 00000000 129d3f49 00000000 00000000 
0000007b
      0000007b 129d3ef1 00000000 021041d9 00000000 00000000 00000000
Call Trace:
[<129d3b29>] rfcomm_worker+0x10b/0x3a6 [rfcomm]
[<129d3f49>] rfcomm_run+0x58/0x6b [rfcomm]
[<129d3ef1>] rfcomm_run+0x0/0x6b [rfcomm]
[<021041d9>] kernel_thread_helper+0x5/0xb

Code: 0f 0b 45 01 ff 5f 9d 12 ff 05 00 89 9d 12 89 d8 5b 5e 5f 5d

what kernel is this? Try the latest one.

Regards

Marcel

Quoted 11 lines

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#9 lore raw

Hi Mike,

Quoted 2 lines

It is 2.6.5, which is default kernel of Fedora 2.
Does it the problem on kernel?Actually, i really no idea for that.

I have an idea for that. Try a 2.6.10 and see if this oops still appears.

Regards

Marcel

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel