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
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 16hci_rx_task: hci0hci_send_to_sock: hdev 81a83a08 len 16hci_rx_task: hci0 ACL data packethci_acldata_packet: hci0 len 12 handle 0x7 flags 0x2l2cap_recv_acldata: conn 81a45960 len 12 flags 0x2l2cap_recv_frame: len 8, cid 0x0001l2cap_raw_recv: conn 81a45960l2cap_sig_channel: code 0x06 len 4 id 0x03l2cap_disconnect_req: scid 0x0045 dcid 0x0040l2cap_build_cmd: conn 81a45960, code 0x07, ident 0x03, len 4l2cap_send_rsp: code 0x07hci_send_acl: hci0 conn 814c3d60 flags 0x0hci_send_acl: hci0 nonfrag skb 8191d9a0 len 16l2cap_sock_clear_timer: sock 80718980 state 1l2cap_chan_del: sk 80718980, conn 81a45960, err 131hci_tx_task: hci0 acl 10 sco 0hci_sched_acl: hci0hci_low_sent: conn 814c3d60 quote 10hci_sched_acl: skb 8191d9a0 len 16hci_send_frame: hci0 type 2 len 16hci_send_to_sock: hdev 81a83a08 len 16hci_low_sent: conn 00000000 quote 0hci_sched_sco: hci0bluez_sock_poll: sock 8070db18, sk 80718680hci_recv_frame: hci0 type 4 len 7hci_rx_task: hci0hci_send_to_sock: hdev 81a83a08 len 7hci_event_packet: hci0 evt 0x13hci_num_comp_pkts_evt: hci0 num_hndl 1hci_tx_task: hci0 acl 10 sco 0hci_sched_acl: hci0hci_low_sent: conn 00000000 quote 0hci_sched_sco: hci0bluez_sock_poll: sock 8070dcf8, sk 80718380bluez_sock_poll: sock 80f71b38, sk 80718980prbluez_sock_recvmsg: sock 80f71b38 sk 80718980 len 512ocl2cap_sock_release: sock 80f71b38, sk 80718980hci_recv_frame: hci0 type 4 len 8hci_rx_task: hci0hci_send_to_sock: hdev 81a83a08 len 8hci_event_packet: hci0 evt 0x14hci_recv_frame: hci0 type 4 len 6hci_rx_task: hci0hci_send_to_sock: hdev 81a83a08 len 6hci_event_packet: hci0 evt 0x5hci_disconn_complete_evt: hci0 status 0l2cap_disconn_ind: hcon 814c3d60 reason 19l2cap_conn_del: hcon 814c3d60 conn 81a45960, err 131sco_disconn_ind: hcon 814c3d60 reason 19hci_conn_del: hci0 conn 814c3d60 handle 7l2cap_sock_shutdown: sock 80f71b38, sk 80718980l2cap_sock_kill: sk 80718980 state 9l2cap_sock_destruct: sk 80718980bluez_sock_poll: sock 8070db18, sk 80718680bluez_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.
***********************************************
Marcel Holtmann
maintainerHi Mayank,
Quoted 4 lines
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
Quoted 8 lines
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