* [Bluez-users] multithread / multi process use
@ 2007-01-25 10:29 Emanuele Novelli
2007-01-25 10:42 ` Marcel Holtmann
2007-01-28 2:30 ` Albert Huang
0 siblings, 2 replies; 5+ messages in thread
From: Emanuele Novelli @ 2007-01-25 10:29 UTC (permalink / raw)
To: bluez-users
[-- Attachment #1.1: Type: text/plain, Size: 2741 bytes --]
Hello I'm new here, I searched for this issue but found nothing.
Using 2 threads or 2 process for reading a name of a 2 remote devices at
same time reports always the same name.
Is this a bug or the hci functions in library do not support concurrent use
?
(using 2.6.19 kernel on FC6 and bluez libs 3.7.1)
This is a simply way to reproduce this:
open a 2 shells and issue 2 commands at same time
hcitool name <bdaddress of a device close to you>
they both report the same name
here an HCI dump of what's happening
2007-01-25 11:15:06.093319 < HCI Command: Remote Name Request (0x01|0x0019)
plen 10
bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
2007-01-25 11:15:06.114456 > HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
2007-01-25 11:15:06.712794 < HCI Command: Remote Name Request (0x01|0x0019)
plen 10
bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
2007-01-25 11:15:06.717442 > HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 0
2007-01-25 11:15:07.238429 > HCI Event: Remote Name Req Complete (0x07) plen
255
status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
2007-01-25 11:15:07.239434 > HCI Event: Command Status (0x0f) plen 4
Unknown (0x00|0x0000) status 0x00 ncmd 1
2007-01-25 11:15:10.151342 > HCI Event: Remote Name Req Complete (0x07) plen
255
status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
the second event with the second name is tracked but never reported back to
the caller cause the unknown event received.
so i see the name 'Seleso' as result on both the shells
this is the behaviour if I use the 2 command sequentially they works fine.
hcitool name 00:0A:28:DF:2B:D8
2007-01-25 11:19:51.930394 < HCI Command: Remote Name Request (0x01|0x0019)
plen 10
bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
2007-01-25 11:19:51.951520 > HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
2007-01-25 11:19:52.199514 > HCI Event: Remote Name Req Complete (0x07) plen
255
status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
hcitool name 00:17:4B:D3:9F:5B
2007-01-25 11:20:39.520967 < HCI Command: Remote Name Request (0x01|0x0019)
plen 10
bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
2007-01-25 11:20:39.542195 > HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
2007-01-25 11:20:43.358090 > HCI Event: Remote Name Req Complete (0x07) plen
255
status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
Since I need to use search names and search services (FAX especially) on a
multi-threaded application i'd like to know if is this possible or somewhere
there is a issue that prevent this.
[-- Attachment #1.2: Type: text/html, Size: 3230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Bluez-users] multithread / multi process use
2007-01-25 10:29 [Bluez-users] multithread / multi process use Emanuele Novelli
@ 2007-01-25 10:42 ` Marcel Holtmann
2007-01-28 2:30 ` Albert Huang
1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2007-01-25 10:42 UTC (permalink / raw)
To: BlueZ users
Hi Emanuele,
> Using 2 threads or 2 process for reading a name of a 2 remote devices
> at same time reports always the same name.
> Is this a bug or the hci functions in library do not support
> concurrent use ?
> (using 2.6.19 kernel on FC6 and bluez libs 3.7.1)
>
> This is a simply way to reproduce this:
>
> open a 2 shells and issue 2 commands at same time
>
> hcitool name <bdaddress of a device close to you>
>
> they both report the same name
>
> here an HCI dump of what's happening
>
> 2007-01-25 11:15:06.093319 < HCI Command: Remote Name Request (0x01|
> 0x0019) plen 10
> bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
> 2007-01-25 11:15:06.114456 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> 2007-01-25 11:15:06.712794 < HCI Command: Remote Name Request (0x01|
> 0x0019) plen 10
> bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
> 2007-01-25 11:15:06.717442 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 0
> 2007-01-25 11:15:07.238429 > HCI Event: Remote Name Req Complete
> (0x07) plen 255
> status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
> 2007-01-25 11:15:07.239434 > HCI Event: Command Status (0x0f) plen 4
> Unknown (0x00|0x0000) status 0x00 ncmd 1
> 2007-01-25 11:15:10.151342 > HCI Event: Remote Name Req Complete
> (0x07) plen 255
> status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
>
> the second event with the second name is tracked but never reported
> back to the caller cause the unknown event received.
> so i see the name 'Seleso' as result on both the shells
>
> this is the behaviour if I use the 2 command sequentially they works
> fine.
>
> hcitool name 00:0A:28:DF:2B:D8
>
> 2007-01-25 11:19:51.930394 < HCI Command: Remote Name Request (0x01|
> 0x0019) plen 10
> bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
> 2007-01-25 11:19:51.951520 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> 2007-01-25 11:19:52.199514 > HCI Event: Remote Name Req Complete
> (0x07) plen 255
> status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
>
> hcitool name 00:17:4B:D3:9F:5B
>
> 2007-01-25 11:20:39.520967 < HCI Command: Remote Name Request (0x01|
> 0x0019) plen 10
> bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
> 2007-01-25 11:20:39.542195 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> 2007-01-25 11:20:43.358090 > HCI Event: Remote Name Req Complete
> (0x07) plen 255
> status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
>
>
>
>
> Since I need to use search names and search services (FAX especially)
> on a multi-threaded application i'd like to know if is this possible
> or somewhere there is a issue that prevent this.
actually this is a known bug and basically not really fixable except
doing a massive rework of the HCI API. You are better off to use the
D-Bus interface to get the remote names. It will automatically take of
this for you and also do caching of the names.
Regards
Marcel
-------------------------------------------------------------------------
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] 5+ messages in thread
* Re: [Bluez-users] multithread / multi process use
2007-01-25 10:29 [Bluez-users] multithread / multi process use Emanuele Novelli
2007-01-25 10:42 ` Marcel Holtmann
@ 2007-01-28 2:30 ` Albert Huang
2007-01-30 14:39 ` Emanuele Novelli
1 sibling, 1 reply; 5+ messages in thread
From: Albert Huang @ 2007-01-28 2:30 UTC (permalink / raw)
To: BlueZ users
I think the proper thing to do here is to have your application use
the D-Bus API, which should do the right thing across multiple
processes. Maybe someone else who's more in touch with hcid can give
more details.
-albert
On 1/25/07, Emanuele Novelli <ema.novelli@gmail.com> wrote:
> Hello I'm new here, I searched for this issue but found nothing.
>
> Using 2 threads or 2 process for reading a name of a 2 remote devices at
> same time reports always the same name.
> Is this a bug or the hci functions in library do not support concurrent use
> ?
> (using 2.6.19 kernel on FC6 and bluez libs 3.7.1)
>
> This is a simply way to reproduce this:
>
> open a 2 shells and issue 2 commands at same time
>
> hcitool name <bdaddress of a device close to you>
>
> they both report the same name
>
> here an HCI dump of what's happening
>
> 2007-01-25 11:15:06.093319 < HCI Command: Remote Name Request (0x01|0x0019)
> plen 10
> bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
> 2007-01-25 11:15:06.114456 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> 2007-01-25 11:15:06.712794 < HCI Command: Remote Name Request (0x01|0x0019)
> plen 10
> bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
> 2007-01-25 11:15:06.717442 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 0
> 2007-01-25 11:15:07.238429 > HCI Event: Remote Name Req Complete (0x07) plen
> 255
> status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
> 2007-01-25 11:15:07.239434 > HCI Event: Command Status (0x0f) plen 4
> Unknown (0x00|0x0000) status 0x00 ncmd 1
> 2007-01-25 11:15:10.151342 > HCI Event: Remote Name Req Complete (0x07) plen
> 255
> status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
>
> the second event with the second name is tracked but never reported back to
> the caller cause the unknown event received.
> so i see the name 'Seleso' as result on both the shells
>
> this is the behaviour if I use the 2 command sequentially they works fine.
>
> hcitool name 00:0A:28:DF:2B:D8
>
> 2007-01-25 11:19:51.930394 < HCI Command: Remote Name Request (0x01|0x0019)
> plen 10
> bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
> 2007-01-25 11:19:51.951520 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> 2007-01-25 11:19:52.199514 > HCI Event: Remote Name Req Complete (0x07) plen
> 255
> status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
>
> hcitool name 00:17:4B:D3:9F:5B
>
> 2007-01-25 11:20:39.520967 < HCI Command: Remote Name Request (0x01|0x0019)
> plen 10
> bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
> 2007-01-25 11:20:39.542195 > HCI Event: Command Status (0x0f) plen 4
> Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> 2007-01-25 11:20:43.358090 > HCI Event: Remote Name Req Complete (0x07) plen
> 255
> status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
>
>
>
>
> Since I need to use search names and search services (FAX especially) on a
> multi-threaded application i'd like to know if is this possible or somewhere
> there is a issue that prevent this.
>
>
>
> -------------------------------------------------------------------------
> 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
>
>
>
-------------------------------------------------------------------------
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] 5+ messages in thread
* Re: [Bluez-users] multithread / multi process use
2007-01-28 2:30 ` Albert Huang
@ 2007-01-30 14:39 ` Emanuele Novelli
2007-01-30 22:15 ` Albert Huang
0 siblings, 1 reply; 5+ messages in thread
From: Emanuele Novelli @ 2007-01-30 14:39 UTC (permalink / raw)
To: BlueZ users
[-- Attachment #1.1: Type: text/plain, Size: 4710 bytes --]
Well I maybe I could try this, just 2 questions:
1 .can the daemon hci manage simultenous requests from variuos
process/threads without problem ?
2 .where I can find some api docs(if any) about the hcid ?
2007/1/28, Albert Huang <albert@csail.mit.edu>:
>
> I think the proper thing to do here is to have your application use
> the D-Bus API, which should do the right thing across multiple
> processes. Maybe someone else who's more in touch with hcid can give
> more details.
>
> -albert
>
> On 1/25/07, Emanuele Novelli <ema.novelli@gmail.com> wrote:
> > Hello I'm new here, I searched for this issue but found nothing.
> >
> > Using 2 threads or 2 process for reading a name of a 2 remote devices at
> > same time reports always the same name.
> > Is this a bug or the hci functions in library do not support concurrent
> use
> > ?
> > (using 2.6.19 kernel on FC6 and bluez libs 3.7.1)
> >
> > This is a simply way to reproduce this:
> >
> > open a 2 shells and issue 2 commands at same time
> >
> > hcitool name <bdaddress of a device close to you>
> >
> > they both report the same name
> >
> > here an HCI dump of what's happening
> >
> > 2007-01-25 11:15:06.093319 < HCI Command: Remote Name Request
> (0x01|0x0019)
> > plen 10
> > bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
> > 2007-01-25 11:15:06.114456 > HCI Event: Command Status (0x0f) plen 4
> > Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> > 2007-01-25 11:15:06.712794 < HCI Command: Remote Name Request
> (0x01|0x0019)
> > plen 10
> > bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
> > 2007-01-25 11:15:06.717442 > HCI Event: Command Status (0x0f) plen 4
> > Remote Name Request (0x01|0x0019) status 0x00 ncmd 0
> > 2007-01-25 11:15:07.238429 > HCI Event: Remote Name Req Complete (0x07)
> plen
> > 255
> > status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
> > 2007-01-25 11:15:07.239434 > HCI Event: Command Status (0x0f) plen 4
> > Unknown (0x00|0x0000) status 0x00 ncmd 1
> > 2007-01-25 11:15:10.151342 > HCI Event: Remote Name Req Complete (0x07)
> plen
> > 255
> > status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
> >
> > the second event with the second name is tracked but never reported back
> to
> > the caller cause the unknown event received.
> > so i see the name 'Seleso' as result on both the shells
> >
> > this is the behaviour if I use the 2 command sequentially they works
> fine.
> >
> > hcitool name 00:0A:28:DF:2B:D8
> >
> > 2007-01-25 11:19:51.930394 < HCI Command: Remote Name Request
> (0x01|0x0019)
> > plen 10
> > bdaddr 00:0A:28:DF:2B:D8 mode 2 clkoffset 0x0000
> > 2007-01-25 11:19:51.951520 > HCI Event: Command Status (0x0f) plen 4
> > Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> > 2007-01-25 11:19:52.199514 > HCI Event: Remote Name Req Complete (0x07)
> plen
> > 255
> > status 0x00 bdaddr 00:0A:28:DF:2B:D8 name 'Seleso'
> >
> > hcitool name 00:17:4B:D3:9F:5B
> >
> > 2007-01-25 11:20:39.520967 < HCI Command: Remote Name Request
> (0x01|0x0019)
> > plen 10
> > bdaddr 00:17:4B:D3:9F:5B mode 2 clkoffset 0x0000
> > 2007-01-25 11:20:39.542195 > HCI Event: Command Status (0x0f) plen 4
> > Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> > 2007-01-25 11:20:43.358090 > HCI Event: Remote Name Req Complete (0x07)
> plen
> > 255
> > status 0x00 bdaddr 00:17:4B:D3:9F:5B name 'Wince'
> >
> >
> >
> >
> > Since I need to use search names and search services (FAX especially) on
> a
> > multi-threaded application i'd like to know if is this possible or
> somewhere
> > there is a issue that prevent this.
> >
> >
> >
> >
> -------------------------------------------------------------------------
> > 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
> >
> >
> >
>
> -------------------------------------------------------------------------
> 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
>
[-- Attachment #1.2: Type: text/html, Size: 6230 bytes --]
[-- Attachment #2: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Bluez-users] multithread / multi process use
2007-01-30 14:39 ` Emanuele Novelli
@ 2007-01-30 22:15 ` Albert Huang
0 siblings, 0 replies; 5+ messages in thread
From: Albert Huang @ 2007-01-30 22:15 UTC (permalink / raw)
To: BlueZ users
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
> 1 .can the daemon hci manage simultenous requests from variuos
> process/threads without problem ?
yes. Currently, if one process attempts to start a device inquiry
while one is already in progress, then hcid will raise a DBusException
and refuse to honor the second request. The second process may still
listen for discovery and name lookup events.
> 2 .where I can find some api docs(if any) about the hcid ?
current document exists, but is difficult to find and not very
beginner friendly. Downoad the bluez-utils source and look in
hcid/dbus-api.txt You can use the attached python script as a
starting point. It's not terribly elegant about detecting when an
inquiry is already in process, but I don't think that hcid is sending
standardized error codes in its exceptions...
-albert
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: inquiry-with-names.py --]
[-- Type: text/x-python; name="inquiry-with-names.py", Size: 823 bytes --]
import gobject
import dbus
import dbus.glib
def onRemoteNameUpdated( address, name ):
print address, name.encode("utf-8")
def onDiscoveryCompleted():
print "discovery completed"
mainloop.quit()
bus = dbus.SystemBus()
bluez = bus.get_object('org.bluez', '/org/bluez')
manager = dbus.Interface(bluez, 'org.bluez.Manager')
obj = bus.get_object('org.bluez', manager.DefaultAdapter())
adapter = dbus.Interface(obj, 'org.bluez.Adapter')
try:
adapter.DiscoverDevices()
except dbus.DBusException, e:
if e.args[0] == "Discover in progress":
print "hcid reports existing device discovery already in progress."
adapter.connect_to_signal( 'DiscoveryCompleted', onDiscoveryCompleted )
adapter.connect_to_signal( 'RemoteNameUpdated', onRemoteNameUpdated )
mainloop = gobject.MainLoop()
mainloop.run()
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
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
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-01-30 22:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-25 10:29 [Bluez-users] multithread / multi process use Emanuele Novelli
2007-01-25 10:42 ` Marcel Holtmann
2007-01-28 2:30 ` Albert Huang
2007-01-30 14:39 ` Emanuele Novelli
2007-01-30 22:15 ` Albert Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox