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
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.
> HCI Event: Connect Request (0x04) plen 10
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
> HCI Event: Command Status (0x0f) plen 4
> HCI Event: Connect Complete (0x03) plen 11
< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
> 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
> 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
> 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
> 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
> 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
> 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
> HCI Event: Number of Completed Packets (0x13) plen 5
> HCI Event: Disconn Complete (0x05) plen 4
Thanks for helping
best regard
Mike,Lee
Marcel Holtmann wrote:
>Hi Mike,
>
>
>
>> 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
>
>
>
-------------------------------------------------------
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
Hi Mike,
> 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
Hi Mike,
> 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
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
Marcel Holtmann wrote:
>Hi Mike,
>
>
>
>> 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
>>
>>
>
>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
>
>
>
-------------------------------------------------------
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
Hi Mike,
> 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
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
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
Marcel Holtmann wrote:
>Hi Mike,
>
>
>
>> 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
>
>
>
-------------------------------------------------------
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
Hi,
> int main(void)
> {
> int sock, client, alen;
> struct sockaddr_rc addr;
>
> if (sock = socket(AF_BLUETOOTH,
> SOCK_STREAM, BTPROTO_RFCOMM) < 0) {
> perror("socket");
> exit(1);
> }
>
> addr.rc_family = AF_BLUETOOTH;
> bacpy(&addr.rc_bdaddr, BDADDR_ANY);
> addr.rc_channel = htobs(CHANNEL);
you don't need a byteswap here. The rc_channel is only uint8_t.
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
Hi Marcel, this is the complete code
int main(void)
{
int sock, client, alen;
struct sockaddr_rc addr;
if (sock =3D socket(AF_BLUETOOTH,
SOCK_STREAM, BTPROTO_RFCOMM) < 0) {
perror("socket");
exit(1);
}
addr.rc_family =3D AF_BLUETOOTH;
bacpy(&addr.rc_bdaddr, BDADDR_ANY);
addr.rc_channel =3D htobs(CHANNEL);
alen =3D sizeof(addr);
if (bind(sock, (struct sockaddr
*)&addr, alen) < 0) {
perror("bind");
exit(1);
}
listen(sock,QUEUE);
printf("Waiting for
connections...\n\n");
while(client =3D accept(sock, (struct
sockaddr *)&addr, &alen)) {
printf("Got a connection
attempt!\n");
close(client);
}
close(sock);
return 0;
}
> Hi,
>
> > First of all i would like to say
> > thanks for you previuos help. Well, I
> > am having problems on RFCOMM
socket too.
> >
> > if (bind(sock, (struct sockaddr
> > *)&addr, alen) < 0) {
> > perror("bind");
> > exit(1);
> > }
> >
> > can you tell me if there is anything
> > wrong is this code? I got a run time
> > error that says
> >
> > bind:Socket operation on non socket
>
> this code as-is looks correct, but
the context is missing. Show us the
> complete function.
>
> 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
> =0A =0A________________________________________________________________=
__________=0AAcabe com aquelas janelinhas que pulam na sua tela.=0AAntiPo=
p-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A
-------------------------------------------------------
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
Hi,
> First of all i would like to say
> thanks for you previuos help. Well, I
> am having problems on RFCOMM socket too.
>
> if (bind(sock, (struct sockaddr
> *)&addr, alen) < 0) {
> perror("bind");
> exit(1);
> }
>
> can you tell me if there is anything
> wrong is this code? I got a run time
> error that says
>
> bind:Socket operation on non socket
this code as-is looks correct, but the context is missing. Show us the
complete function.
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
Hi Marcel,
First of all i would like to say
thanks for you previuos help. Well, I
am having problems on RFCOMM socket too.
if (bind(sock, (struct sockaddr
*)&addr, alen) < 0) {
perror("bind");
exit(1);
}
can you tell me if there is anything
wrong is this code? I got a run time
error that says
bind:Socket operation on non socket
> Hi Mike,
>
> > 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
> =0A =0A________________________________________________________________=
__________=0AAcabe com aquelas janelinhas que pulam na sua tela.=0AAntiPo=
p-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A
-------------------------------------------------------
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
Hi Mike,
> 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
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
Marcel Holtmann wrote:
>Hi Mike,
>
>
>
>> 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
>
>
>
-------------------------------------------------------
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
Hi Mike,
> 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