Skip to contentSkip to conversation

About socket interface

Bluez-devel Jui-Hao Chiang 2 participants 4 messages Jul 24, 2008 – Jul 25, 2008 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,
I have a question about the user socket interface.
When I run the scotest -d, I know it will basically call sco_sock_accept in sco.c Inside it, there is a wait queue and try to find a new socket.
The accept() will be notified when there is a new connection coming from another client.
My question is: how the bluez notify the user socket "accept()"? Can anyone tell me where the event is generated and finally notify user socket accept()? Just need a keyword.

Hope this time someone can answer me. maybe I am keeping asking stupid question so that nobody wants to answer it.

Bests

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

The HCI event that triggers this is the Connection Request Event 0x04, probably handled in hci_event.c

2008/7/25 Jui-Hao Chiang <[email protected]>:

Quoted 21 lines

Hi,
I have a question about the user socket interface.
When I run the scotest -d, I know it will basically call sco_sock_accept in sco.c
Inside it, there is a wait queue and try to find a new socket. The accept() will be notified when there is a new connection coming from another
client.
My question is: how the bluez notify the user socket "accept()"? Can anyone tell
me where the event is generated and finally notify user socket accept()? Just
need a keyword.

Hope this time someone can answer me. maybe I am keeping asking stupid question
so that nobody wants to answer it.

Bests

Quoted 12 lines

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

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

#2 lore raw
Quoted 2 lines · Nick Pelly <npelly <at> gmail.com> writes:

The HCI event that triggers this is the Connection Request Event 0x04,

probably handled in hci_event.c

Thanks for the response. But I haven't seen any code inside hci_event_packet to notify the user socket. (Maybe I am blind..)
In scotest program, there is a debug message below accept(), so that I know when it is returned from the accept() call.

Quoted 1 line
Quoted 1 line

From my tracing, I thought the user accept() will eventually wait inside

sco_sock_accept(), which keeps itself in the wait queue. And I guess the function return of sco_sock_accept will eventually executing the next line of accept() in user program (printing the message). But the accept() returns earlier than the sco_sock_accept() as the following message.

hci_event_packet: hci0 evt 0x4 <== the SCO connection request comes !!!!
hci_conn_request_evt: hci0 Connection request: EE:E9:63:67:11:00 type 0x0
sco_connect_ind: hdev hci0, bdaddr EE:E9:63:67:11:00
hci_conn_add: hci0 dst EE:E9:63:67:11:00
hci_usb_notify: hci0 evt 1
hci_conn_add_sysfs: conn d45db800
.... (omit..)
hci_event_packet: hci0 evt 0x1b
__recv_frame: hci0 type 4 data dfa75670 count 6
__recv_frame: new packet len 6
hci_rx_task: hci0
hci_event_packet: hci0 evt 0xf
hci_cs_link_ctl: hci0 ocf 0x9
hci_cs_link_ctl: hci0 Command status: ogf LINK_CTL ocf 9 status 0 scotest[5844]: Connect from 00:11:67:63:E9:EE [handle 2, class 0x080104] <=== user accept() Has returned !!!!
scotest[5844]: Receiving ...
.... (omit..)
bt_accept_unlink: sk f53e1800 state 1
sco_sock_accept: new socket f53e1800 <== sco_sock_accept() will return !!!!

Jui-Hao

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

I just observed that
when user socket is listening.
The debug message following the listen() function will be printed before the message in sco_sock_listen().
So... I guess it's because the "printk in kernel" and "syslog in user space" are running asynchronously in /var/log/messages.

Jui-Hao

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel