Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] sdp: Remove sdp_general_inquiry API
@ 2010-08-18 10:13 Zhenhua Zhang
  2010-08-18 11:59 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenhua Zhang @ 2010-08-18 10:13 UTC (permalink / raw)
  To: linux-bluetooth

So that sdp.c won't include hci.h and hci_lib.h. The inquiry operation
could be done by simply invoking hci_inquiry().
---
 lib/sdp.c       |   16 ----------------
 lib/sdp_lib.h   |    5 -----
 tools/sdptool.c |    6 ++++--
 3 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/lib/sdp.c b/lib/sdp.c
index 8a31b55..76695af 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -43,8 +43,6 @@
 #include <netinet/in.h>
 
 #include "bluetooth.h"
-#include "hci.h"
-#include "hci_lib.h"
 #include "l2cap.h"
 #include "sdp.h"
 #include "sdp_lib.h"
@@ -4523,20 +4521,6 @@ end:
 	return status;
 }
 
-/*
- * Find devices in the piconet.
- */
-int sdp_general_inquiry(inquiry_info *ii, int num_dev, int duration, uint8_t *found)
-{
-	int n = hci_inquiry(-1, 10, num_dev, NULL, &ii, 0);
-	if (n < 0) {
-		SDPERR("Inquiry failed:%s", strerror(errno));
-		return -1;
-	}
-	*found = n;
-	return 0;
-}
-
 int sdp_close(sdp_session_t *session)
 {
 	struct sdp_transaction *t;
diff --git a/lib/sdp_lib.h b/lib/sdp_lib.h
index e506ac1..5ad4b56 100644
--- a/lib/sdp_lib.h
+++ b/lib/sdp_lib.h
@@ -146,11 +146,6 @@ int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *sear
 
 uint16_t sdp_gen_tid(sdp_session_t *session);
 
-/*
- * find all devices in the piconet
- */
-int sdp_general_inquiry(inquiry_info *ii, int dev_num, int duration, uint8_t *found);
-
 /* flexible extraction of basic attributes - Jean II */
 int sdp_get_int_attr(const sdp_record_t *rec, uint16_t attr, int *value);
 int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int valuelen);
diff --git a/tools/sdptool.c b/tools/sdptool.c
index d06b159..3ce0fc3 100644
--- a/tools/sdptool.c
+++ b/tools/sdptool.c
@@ -3733,11 +3733,13 @@ static int cmd_del(int argc, char **argv)
 static void inquiry(handler_t handler, void *arg)
 {
 	inquiry_info ii[20];
-	uint8_t count = 0;
+	int count = 0;
 	int i;
 
 	printf("Inquiring ...\n");
-	if (sdp_general_inquiry(ii, 20, 8, &count) < 0) {
+
+	count = hci_inquiry(-1, 10, 20, NULL, (inquiry_info **) &ii, 0);
+	if (count < 0) {
 		printf("Inquiry failed\n");
 		return;
 	}
-- 
1.7.0.4


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

* Re: [PATCH] sdp: Remove sdp_general_inquiry API
  2010-08-18 10:13 [PATCH] sdp: Remove sdp_general_inquiry API Zhenhua Zhang
@ 2010-08-18 11:59 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2010-08-18 11:59 UTC (permalink / raw)
  To: Zhenhua Zhang; +Cc: linux-bluetooth

Hi Zhenhua,

> So that sdp.c won't include hci.h and hci_lib.h. The inquiry operation
> could be done by simply invoking hci_inquiry().
> ---
>  lib/sdp.c       |   16 ----------------
>  lib/sdp_lib.h   |    5 -----
>  tools/sdptool.c |    6 ++++--
>  3 files changed, 4 insertions(+), 23 deletions(-)
> 
> diff --git a/lib/sdp.c b/lib/sdp.c
> index 8a31b55..76695af 100644
> --- a/lib/sdp.c
> +++ b/lib/sdp.c
> @@ -43,8 +43,6 @@
>  #include <netinet/in.h>
>  
>  #include "bluetooth.h"
> -#include "hci.h"
> -#include "hci_lib.h"
>  #include "l2cap.h"
>  #include "sdp.h"
>  #include "sdp_lib.h"
> @@ -4523,20 +4521,6 @@ end:
>  	return status;
>  }
>  
> -/*
> - * Find devices in the piconet.
> - */
> -int sdp_general_inquiry(inquiry_info *ii, int num_dev, int duration, uint8_t *found)
> -{
> -	int n = hci_inquiry(-1, 10, num_dev, NULL, &ii, 0);
> -	if (n < 0) {
> -		SDPERR("Inquiry failed:%s", strerror(errno));
> -		return -1;
> -	}
> -	*found = n;
> -	return 0;
> -}
> -

this breaks API and ABI compatibility. Even if most likely nobody in the
world uses this function, we should keep it for now.

>  int sdp_close(sdp_session_t *session)
>  {
>  	struct sdp_transaction *t;
> diff --git a/lib/sdp_lib.h b/lib/sdp_lib.h
> index e506ac1..5ad4b56 100644
> --- a/lib/sdp_lib.h
> +++ b/lib/sdp_lib.h
> @@ -146,11 +146,6 @@ int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *sear
>  
>  uint16_t sdp_gen_tid(sdp_session_t *session);
>  
> -/*
> - * find all devices in the piconet
> - */
> -int sdp_general_inquiry(inquiry_info *ii, int dev_num, int duration, uint8_t *found);
> -
>  /* flexible extraction of basic attributes - Jean II */
>  int sdp_get_int_attr(const sdp_record_t *rec, uint16_t attr, int *value);
>  int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int valuelen);
> diff --git a/tools/sdptool.c b/tools/sdptool.c
> index d06b159..3ce0fc3 100644
> --- a/tools/sdptool.c
> +++ b/tools/sdptool.c
> @@ -3733,11 +3733,13 @@ static int cmd_del(int argc, char **argv)
>  static void inquiry(handler_t handler, void *arg)
>  {
>  	inquiry_info ii[20];
> -	uint8_t count = 0;
> +	int count = 0;
>  	int i;
>  
>  	printf("Inquiring ...\n");
> -	if (sdp_general_inquiry(ii, 20, 8, &count) < 0) {
> +
> +	count = hci_inquiry(-1, 10, 20, NULL, (inquiry_info **) &ii, 0);
> +	if (count < 0) {
>  		printf("Inquiry failed\n");
>  		return;
>  	}

This change is fine btw. Send a separate patch for this.

Regards

Marcel




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

end of thread, other threads:[~2010-08-18 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 10:13 [PATCH] sdp: Remove sdp_general_inquiry API Zhenhua Zhang
2010-08-18 11:59 ` Marcel Holtmann

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