non-blocking hci_inquiry()
From: Alexander H Deriziotis <hidden>
Date: 2009-07-28 11:55:17
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