2005-04-29 06:19:36

by Mayank Sharma

[permalink] [raw]
Subject: [Bluez-devel] Help with L2CAP sockets

Hi all,
I am developing an application using the L2CAP sockets provided by
BlueZ. I am creating a pool of sockets and listening to all of them
simultaneously. To avoid spawning of a thread for each socket, i tried
using the async capabilities of the socket. I set the FASYNC flag using
the ioctl to the socket, and set my pid to it. Thereafter i get a SIGIO
whenever data is available on any of the socket. Everything seems fine
except for disconnection. When an L2CAP socket is disconnected from the
remote device, i do not get any SIGIO. Hence i am not able to do get the
disconnection indication since i am not doing a read on the socket. I do
a read only when i receive a SIGIO.
I want to know if there is a way i can add code to the L2CAP file of
bluez to send a sigio whenever it receives a disconnection indication.
Can anyone help me with this ?

Regards,
Mayank



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2005-04-29 09:39:25

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Help with L2CAP sockets

Hi Mayank,

> I am developing an application using the L2CAP sockets provided by
> BlueZ. I am creating a pool of sockets and listening to all of them
> simultaneously. To avoid spawning of a thread for each socket, i tried
> using the async capabilities of the socket. I set the FASYNC flag using
> the ioctl to the socket, and set my pid to it. Thereafter i get a SIGIO
> whenever data is available on any of the socket. Everything seems fine
> except for disconnection. When an L2CAP socket is disconnected from the
> remote device, i do not get any SIGIO. Hence i am not able to do get the
> disconnection indication since i am not doing a read on the socket. I do
> a read only when i receive a SIGIO.
> I want to know if there is a way i can add code to the L2CAP file of
> bluez to send a sigio whenever it receives a disconnection indication.

I have no idea, but I never used FASYNC with BlueZ. Use select()/poll()
and write an event loop.

Regards

Marcel




-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-04-29 06:46:12

by gao.yingbin

[permalink] [raw]
Subject: [Bluez-devel] 答复: [Bluez-devel] Help with L2CAP sockets

Hi, I don't agree that your problem is L2CAP socket's bug. you can see my
debug messages of remote device disconnect:
hci_recv_frame: hci0 type 2 len 16
hci_rx_task: hci0
hci_send_to_sock: hdev 81a83a08 len 16
hci_rx_task: hci0 ACL data packet
hci_acldata_packet: hci0 len 12 handle 0x7 flags 0x2
l2cap_recv_acldata: conn 81a45960 len 12 flags 0x2
l2cap_recv_frame: len 8, cid 0x0001
l2cap_raw_recv: conn 81a45960
l2cap_sig_channel: code 0x06 len 4 id 0x03
l2cap_disconnect_req: scid 0x0045 dcid 0x0040
l2cap_build_cmd: conn 81a45960, code 0x07, ident 0x03, len 4
l2cap_send_rsp: code 0x07
hci_send_acl: hci0 conn 814c3d60 flags 0x0
hci_send_acl: hci0 nonfrag skb 8191d9a0 len 16
l2cap_sock_clear_timer: sock 80718980 state 1
l2cap_chan_del: sk 80718980, conn 81a45960, err 131
hci_tx_task: hci0 acl 10 sco 0
hci_sched_acl: hci0
hci_low_sent: conn 814c3d60 quote 10
hci_sched_acl: skb 8191d9a0 len 16
hci_send_frame: hci0 type 2 len 16
hci_send_to_sock: hdev 81a83a08 len 16
hci_low_sent: conn 00000000 quote 0
hci_sched_sco: hci0
bluez_sock_poll: sock 8070db18, sk 80718680
hci_recv_frame: hci0 type 4 len 7
hci_rx_task: hci0
hci_send_to_sock: hdev 81a83a08 len 7
hci_event_packet: hci0 evt 0x13
hci_num_comp_pkts_evt: hci0 num_hndl 1
hci_tx_task: hci0 acl 10 sco 0
hci_sched_acl: hci0
hci_low_sent: conn 00000000 quote 0
hci_sched_sco: hci0
bluez_sock_poll: sock 8070dcf8, sk 80718380
bluez_sock_poll: sock 80f71b38, sk 80718980
prbluez_sock_recvmsg: sock 80f71b38 sk 80718980 len 512
ocl2cap_sock_release: sock 80f71b38, sk 80718980
hci_recv_frame: hci0 type 4 len 8
hci_rx_task: hci0
hci_send_to_sock: hdev 81a83a08 len 8
hci_event_packet: hci0 evt 0x14
hci_recv_frame: hci0 type 4 len 6
hci_rx_task: hci0
hci_send_to_sock: hdev 81a83a08 len 6
hci_event_packet: hci0 evt 0x5
hci_disconn_complete_evt: hci0 status 0
l2cap_disconn_ind: hcon 814c3d60 reason 19
l2cap_conn_del: hcon 814c3d60 conn 81a45960, err 131
sco_disconn_ind: hcon 814c3d60 reason 19
hci_conn_del: hci0 conn 814c3d60 handle 7
l2cap_sock_shutdown: sock 80f71b38, sk 80718980
l2cap_sock_kill: sk 80718980 state 9
l2cap_sock_destruct: sk 80718980
bluez_sock_poll: sock 8070db18, sk 80718680
bluez_sock_poll: sock 8070dcf8, sk 80718380
*******************the end *************************************

Why do you use the system call "select()" to do it ? I always use it and
have never encountered your problems.


***********************************************
信息安全声明:本邮件包含信息归ZTE所有,
ZTE对该邮件拥有所有权利。请接收者注意
保密,未经发件人书面许可,不得向任何第
三方组织和个人透露本邮件所含信息的全部
或部分。以上声明仅适用于工作邮件。
Information Security Notice:
The information contained in this mail is
solely property of ZTE Corporation.
This mail communication is confidential.
Recipients named above are obligated to
maintain secrecy and are not permitted to
disclose the contents of this communication
to others.
***********************************************