public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-users] Timeout for connections
@ 2006-12-03 18:30 Mikael Lindqvist
  2006-12-03 18:40 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Lindqvist @ 2006-12-03 18:30 UTC (permalink / raw)
  To: BlueZ users

Hello,

I would like to be able to set a timeout for service discoveries (and
eventually for rfcomm connections as well, but so far I've been
experimenting with service discoveries). For this I use non blocking
sockets by passing SDP_NON_BLOCKING to sdp_connect. Then I use select
with a timeout on the socket, and if it times out I call sdp_close.

The problem is that after I have done this I can't use the bluetooth
chip for other connections for some time. Dumping the traffic with
hcidump, I saw that this is because even though the l2cap socket is
closed, the bluetooth chip is still doing the connection in the
background. For this connection to actually get canceled the chip
needs to be sent a HCI_Create_Connection_Cancel command, but it is not
sent when the socket is closed.

To work around this I made some code to send this command myself
before calling sdp_close. This works, but the problem is that you need
to be root to send the HCI_Create_Connection_Cancel command. The
implication being that if you want to set a timeout for service
discovery, you need to be root. And this can't be the case, am I
thinking wrong in some fundamental way?

Or can this be considered a bug? shouldn't
HCI_Create_Connection_Cancel be sent automatically on some lower level
of bluez if you close an l2cap/rfcomm socket while it is connecting?

Or is there some other way to set a timeout for l2cap/rfcomm connections?

Thanks in advance,

Mikael

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-12-04  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-03 18:30 [Bluez-users] Timeout for connections Mikael Lindqvist
2006-12-03 18:40 ` Marcel Holtmann
2006-12-03 19:22   ` Mikael Lindqvist
2006-12-03 21:15     ` Marcel Holtmann
2006-12-04  8:36       ` Mikael Lindqvist
2006-12-04  8:45         ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox