Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez-devel] Changes to inquiry
@ 2003-05-22 16:21 Marcel Holtmann
  0 siblings, 0 replies; only message in thread
From: Marcel Holtmann @ 2003-05-22 16:21 UTC (permalink / raw)
  To: BlueZ Mailing List

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

Hello,

the inquiry process have some problems if devices report Bluetooth
addresses more than once. This can be seen with the Nokia cards. The
kernel inside inquiry cache is able to handle this, but the number of
responses parameter will mess this up. The most problem case is if you
want to set the number of inquiry responses to zero, which means
unlimted number of inquiry reponses until the specified time is over.

Currently a value of zero will be recoded as 200, but if you use a large
time value this number can be reached very quick and not all devices
will be found. I suppose the attached change to the Bluetooth library
and fix the kernel code to dump up to 255 devices if the num_rsp
parameter is zero.

Comments?

Regards

Marcel


[-- Attachment #2: patch-libs-inq --]
[-- Type: text/x-patch, Size: 694 bytes --]

diff -urN libs/src/hci.c libs-mh/src/hci.c
--- libs/src/hci.c	Mon May 19 20:41:00 2003
+++ libs-mh/src/hci.c	Thu May 22 18:02:41 2003
@@ -473,8 +473,10 @@
 	void *buf;
 	int s, err;
 
-	if (nrsp <= 0)
-		nrsp = 200; // enough ?
+	if (nrsp < 0) {
+		errno = EINVAL;
+		return -1;
+	}
 
 	if (dev_id < 0 && (dev_id = hci_get_route(NULL)) < 0) {
 		errno = ENODEV;
@@ -485,7 +487,11 @@
 	if (s < 0)
 		return -1;
 
-	buf = malloc(sizeof(*ir) + (sizeof(inquiry_info) * (nrsp)));
+	if (nrsp == 0)
+		buf = malloc(sizeof(*ir) + (sizeof(inquiry_info) * 255));
+	else
+		buf = malloc(sizeof(*ir) + (sizeof(inquiry_info) * nrsp));
+
 	if (!buf) {
 		close(s);
 		return -1;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-05-22 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-22 16:21 [Bluez-devel] Changes to inquiry Marcel Holtmann

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