linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-users] DiscoverDevices with apitest?
@ 2006-10-19 11:56 Stefan Seyfried
  2006-10-19 12:04 ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Seyfried @ 2006-10-19 11:56 UTC (permalink / raw)
  To: bluez-users

Hi,

i tried today to discover devices with apitest (instead of "hcitool scan"),
but it did not work:

seife@strolchi:~> apitest DiscoverDevices
None

and it returns immediately. So i tried my luck with direct "dbus-send":
seife@strolchi:~> dbus-send --system --dest=3Dorg.bluez --print-reply /org/=
bluez/hci0 org.bluez.Adapter.DiscoverDevices
method return sender=3D:1.541 -> dest=3D:1.867

No luck either.
I always get this in my syslog from hcid:
Oct 19 13:52:39 strolchi hcid[17330]: Introspect path:/org/bluez
Oct 19 13:52:39 strolchi hcid[17330]: Introspect path:/org/bluez/hci0
Oct 19 13:52:39 strolchi hcid[17330]: name_listener_add(:1.869)
Oct 19 13:52:39 strolchi hcid[17330]: DiscoverDevices requestor at :1.869 e=
xited before the operation finished
Oct 19 13:52:39 strolchi hcid[17330]: name_listener_remove(:1.869)
Oct 19 13:52:39 strolchi hcid[17330]: remove_name_listener: no listener for=
 :1.869

So why doesn't the dbus call block? I also tried with a "apitest -l"
running in parallel, to see if this would get something discovered, but it
didn't:
seife@strolchi:~> apitest -l
Listening for events...
DiscoveryStarted - /org/bluez/hci0:
DiscoveryCompleted - /org/bluez/hci0:
DiscoveryStarted - /org/bluez/hci0:
DiscoveryCompleted - /org/bluez/hci0:
Caught signal, exiting

So am i doing something wrong?

I'm running bluez-{libs,utils} version 3.7 on 2.6.18.
-- =

Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, N=FCrnberg  | "Well, surrounding them's out." =


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easi=
er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

* Re: [Bluez-users] DiscoverDevices with apitest?
  2006-10-19 11:56 [Bluez-users] DiscoverDevices with apitest? Stefan Seyfried
@ 2006-10-19 12:04 ` Marcel Holtmann
  2006-10-19 12:31   ` Johan Hedberg
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2006-10-19 12:04 UTC (permalink / raw)
  To: BlueZ users

Hi Stefan,

> i tried today to discover devices with apitest (instead of "hcitool scan"),
> but it did not work:
> 
> seife@strolchi:~> apitest DiscoverDevices
> None
> 
> and it returns immediately. So i tried my luck with direct "dbus-send":
> seife@strolchi:~> dbus-send --system --dest=org.bluez --print-reply /org/bluez/hci0 org.bluez.Adapter.DiscoverDevices
> method return sender=:1.541 -> dest=:1.867
> 
> No luck either.
> I always get this in my syslog from hcid:
> Oct 19 13:52:39 strolchi hcid[17330]: Introspect path:/org/bluez
> Oct 19 13:52:39 strolchi hcid[17330]: Introspect path:/org/bluez/hci0
> Oct 19 13:52:39 strolchi hcid[17330]: name_listener_add(:1.869)
> Oct 19 13:52:39 strolchi hcid[17330]: DiscoverDevices requestor at :1.869 exited before the operation finished
> Oct 19 13:52:39 strolchi hcid[17330]: name_listener_remove(:1.869)
> Oct 19 13:52:39 strolchi hcid[17330]: remove_name_listener: no listener for :1.869
> 
> So why doesn't the dbus call block? I also tried with a "apitest -l"
> running in parallel, to see if this would get something discovered, but it
> didn't:
> seife@strolchi:~> apitest -l
> Listening for events...
> DiscoveryStarted - /org/bluez/hci0:
> DiscoveryCompleted - /org/bluez/hci0:
> DiscoveryStarted - /org/bluez/hci0:
> DiscoveryCompleted - /org/bluez/hci0:
> Caught signal, exiting

You need to keep the calling application running, because otherwise hcid
will stop the discovery. That is actually what you see in syslog.

It is not blocking, because this is simply not a blocking task. You
might wanna have a look at this blog on how to do it with Python:

http://blogs.gnome.org/view/jamesh/2006/10/19/0

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

* Re: [Bluez-users] DiscoverDevices with apitest?
  2006-10-19 12:04 ` Marcel Holtmann
@ 2006-10-19 12:31   ` Johan Hedberg
  2006-10-19 12:35     ` Johan Hedberg
  2006-10-19 12:41     ` Stefan Seyfried
  0 siblings, 2 replies; 7+ messages in thread
From: Johan Hedberg @ 2006-10-19 12:31 UTC (permalink / raw)
  To: BlueZ users

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

On Thu, Oct 19, 2006, Marcel Holtmann wrote:
> You need to keep the calling application running, because otherwise hcid
> will stop the discovery. That is actually what you see in syslog.

You could also try the attached patch. After that the following command 
should do the trick:
./apitest -l DiscoverDevices

I think we may want to apply this to CVS. Marcel, what do you think?

Johan

[-- Attachment #2: apitest.patch --]
[-- Type: text/plain, Size: 878 bytes --]

Index: apitest
===================================================================
RCS file: /cvsroot/bluez/utils/test/apitest,v
retrieving revision 1.1
diff -u -r1.1 apitest
--- apitest	28 Sep 2006 15:23:24 -0000	1.1
+++ apitest	19 Oct 2006 12:30:33 -0000
@@ -399,7 +399,8 @@
             self.dbus_mgr_sig_setup()
             self.dbus_dev_sig_setup()
             print 'Listening for events...'
-        elif self.cmd in mgr_cmds:
+
+        if self.cmd in mgr_cmds:
             try:
                 self.dbus_mgr_setup()
             except dbus.DBusException, e:
@@ -413,7 +414,7 @@
                 print 'Failed to setup device interface: %s' % e
                 sys.exit(1)
             self.call_dev_dbus_func()
-        else:
+        else if not self.listen:
             print 'Unknown command: %s' % self.cmd
             self.usage()
             sys.exit(1)

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- 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] 7+ messages in thread

* Re: [Bluez-users] DiscoverDevices with apitest?
  2006-10-19 12:31   ` Johan Hedberg
@ 2006-10-19 12:35     ` Johan Hedberg
  2006-10-19 12:42       ` Marcel Holtmann
  2006-10-19 12:41     ` Stefan Seyfried
  1 sibling, 1 reply; 7+ messages in thread
From: Johan Hedberg @ 2006-10-19 12:35 UTC (permalink / raw)
  To: BlueZ users

Should have actually tested the patch first...

On Thu, Oct 19, 2006, Johan Hedberg wrote:
> +        else if not self.listen:

This should of course be "elif not self.listen:"

Johan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

* Re: [Bluez-users] DiscoverDevices with apitest?
  2006-10-19 12:31   ` Johan Hedberg
  2006-10-19 12:35     ` Johan Hedberg
@ 2006-10-19 12:41     ` Stefan Seyfried
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Seyfried @ 2006-10-19 12:41 UTC (permalink / raw)
  To: BlueZ users

On Thu, Oct 19, 2006 at 03:31:33PM +0300, Johan Hedberg wrote:
> On Thu, Oct 19, 2006, Marcel Holtmann wrote:
> > You need to keep the calling application running, because otherwise hcid
> > will stop the discovery. That is actually what you see in syslog.
> =

> You could also try the attached patch. After that the following command =

> should do the trick:
> ./apitest -l DiscoverDevices

almost, see below
 =

> I think we may want to apply this to CVS. Marcel, what do you think?

I like it :-) I already had tried apitest -l DiscoverDevices, but it did
not work.

> Index: apitest
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/bluez/utils/test/apitest,v
> retrieving revision 1.1
> diff -u -r1.1 apitest
> --- apitest	28 Sep 2006 15:23:24 -0000	1.1
> +++ apitest	19 Oct 2006 12:30:33 -0000
> @@ -399,7 +399,8 @@
>              self.dbus_mgr_sig_setup()
>              self.dbus_dev_sig_setup()
>              print 'Listening for events...'
> -        elif self.cmd in mgr_cmds:
> +
> +        if self.cmd in mgr_cmds:
>              try:
>                  self.dbus_mgr_setup()
>              except dbus.DBusException, e:
> @@ -413,7 +414,7 @@
>                  print 'Failed to setup device interface: %s' % e
>                  sys.exit(1)
>              self.call_dev_dbus_func()
> -        else:
> +        else if not self.listen:

           elif not self.listen

>              print 'Unknown command: %s' % self.cmd
>              self.usage()
>              sys.exit(1)
-- =

Stefan Seyfried                  \ "I didn't want to write for pay. I
QA / R&D Team Mobile Devices      \ wanted to be paid for what I write."
SUSE LINUX Products GmbH, N=FCrnberg \                    -- Leonard Cohen

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easi=
er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

* Re: [Bluez-users] DiscoverDevices with apitest?
  2006-10-19 12:35     ` Johan Hedberg
@ 2006-10-19 12:42       ` Marcel Holtmann
  2006-10-19 12:49         ` Johan Hedberg
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2006-10-19 12:42 UTC (permalink / raw)
  To: BlueZ users

Hi Johan,

> Should have actually tested the patch first...
> 
> On Thu, Oct 19, 2006, Johan Hedberg wrote:
> > +        else if not self.listen:
> 
> This should of course be "elif not self.listen:"

commit the fixed version.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

* Re: [Bluez-users] DiscoverDevices with apitest?
  2006-10-19 12:42       ` Marcel Holtmann
@ 2006-10-19 12:49         ` Johan Hedberg
  0 siblings, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2006-10-19 12:49 UTC (permalink / raw)
  To: BlueZ users

On Thu, Oct 19, 2006, Marcel Holtmann wrote:
> commit the fixed version.

Done.

Johan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

end of thread, other threads:[~2006-10-19 12:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-19 11:56 [Bluez-users] DiscoverDevices with apitest? Stefan Seyfried
2006-10-19 12:04 ` Marcel Holtmann
2006-10-19 12:31   ` Johan Hedberg
2006-10-19 12:35     ` Johan Hedberg
2006-10-19 12:42       ` Marcel Holtmann
2006-10-19 12:49         ` Johan Hedberg
2006-10-19 12:41     ` Stefan Seyfried

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).