* non-blocking hci_inquiry()
[not found] <5eee8c670907280453i76f4957fvcca9c3954576580d@mail.gmail.com>
@ 2009-07-28 11:55 ` Alexander H Deriziotis
2009-07-28 12:31 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: Alexander H Deriziotis @ 2009-07-28 11:55 UTC (permalink / raw)
To: linux-bluetooth
Hi,
I've been playing with the linux wiimote daemon called Cwiid, and
noticed that while it's waiting for a connection from a wiimote, it's
blocking the bluetooth adapter from doing anything else.
Searching around and looking at the code, I can see it's calling
hci_inquiry() in a loop which is blocking the device.
Does a non-blocking hci_inquiry() function exist? If not, could I get
some help on how to go about writing one?
Looking around, someone mentions that it might be the ioctl() function
called within hci_inquiry() which is causing the blocking, could it be
something as trivial as playing with that?
from lib/hci.c:
int hci_inquiry(int dev_id, int len, int nrsp, const uint8_t *lap,
inquiry_info **ii, long flags)
{
[snip]
ret = ioctl(dd, HCIINQUIRY, (unsigned long) buf);
if (ret < 0)
goto free;
Many thanks,
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: non-blocking hci_inquiry()
2009-07-28 11:55 ` non-blocking hci_inquiry() Alexander H Deriziotis
@ 2009-07-28 12:31 ` Marcel Holtmann
2009-08-12 22:37 ` Alexander H Deriziotis
0 siblings, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2009-07-28 12:31 UTC (permalink / raw)
To: Alexander H Deriziotis; +Cc: linux-bluetooth
Hi Alex,
> I've been playing with the linux wiimote daemon called Cwiid, and
> noticed that while it's waiting for a connection from a wiimote, it's
> blocking the bluetooth adapter from doing anything else.
>
> Searching around and looking at the code, I can see it's calling
> hci_inquiry() in a loop which is blocking the device.
>
> Does a non-blocking hci_inquiry() function exist? If not, could I get
> some help on how to go about writing one?
use the D-Bus interface for non-blocking inquiry.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: non-blocking hci_inquiry()
2009-07-28 12:31 ` Marcel Holtmann
@ 2009-08-12 22:37 ` Alexander H Deriziotis
2009-08-12 22:40 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: Alexander H Deriziotis @ 2009-08-12 22:37 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
2009/7/28 Marcel Holtmann <marcel@holtmann.org>:
>
> use the D-Bus interface for non-blocking inquiry.
I'm following the GLib with C example in the following doc:
http://wiki.bluez.org/wiki/HOWTO/DiscoveringDevices and having
problems running the example code.
It compiles perfectly fine, however, when I run it, it gives me the
following error:
jackflap@genesis:~/Desktop/cwiid-0.6.00/new_test$ ./bluetooth
Failed to discover devices: Method "DiscoverDevices" with signature ""
on interface "org.bluez.Adapter" doesn't exist
I'm getting the impression that it's the following line in the code
that isn't working:
obj = dbus_g_proxy_new_for_name(bus, "org.bluez",
"/org/bluez/hci0", "org.bluez.Adapter");
I'm certain my bluetooth adapter is recognized and is configured as hci0.
What am I missing?
Thanks,
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: non-blocking hci_inquiry()
2009-08-12 22:37 ` Alexander H Deriziotis
@ 2009-08-12 22:40 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2009-08-12 22:40 UTC (permalink / raw)
To: Alexander H Deriziotis; +Cc: linux-bluetooth
Hi Alex,
> > use the D-Bus interface for non-blocking inquiry.
>
> I'm following the GLib with C example in the following doc:
> http://wiki.bluez.org/wiki/HOWTO/DiscoveringDevices and having
> problems running the example code.
>
> It compiles perfectly fine, however, when I run it, it gives me the
> following error:
>
> jackflap@genesis:~/Desktop/cwiid-0.6.00/new_test$ ./bluetooth
> Failed to discover devices: Method "DiscoverDevices" with signature ""
> on interface "org.bluez.Adapter" doesn't exist
>
> I'm getting the impression that it's the following line in the code
> that isn't working:
>
> obj = dbus_g_proxy_new_for_name(bus, "org.bluez",
> "/org/bluez/hci0", "org.bluez.Adapter");
>
> I'm certain my bluetooth adapter is recognized and is configured as hci0.
looks like you are not using the 4.x API. That one works differently.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-12 22:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5eee8c670907280453i76f4957fvcca9c3954576580d@mail.gmail.com>
2009-07-28 11:55 ` non-blocking hci_inquiry() Alexander H Deriziotis
2009-07-28 12:31 ` Marcel Holtmann
2009-08-12 22:37 ` Alexander H Deriziotis
2009-08-12 22:40 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox