summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/device.c15
-rw-r--r--sdpd/sdpd.h1
-rw-r--r--sdpd/service.c17
3 files changed, 21 insertions, 12 deletions
diff --git a/hcid/device.c b/hcid/device.c
index 983071d0..c80f5875 100644
--- a/hcid/device.c
+++ b/hcid/device.c
@@ -45,6 +45,7 @@
#include "dbus-helper.h"
#include "hcid.h"
+#include "sdpd.h"
#include "logging.h"
#include "textfile.h"
@@ -218,18 +219,8 @@ static void update_ext_inquiry_response(int dd, struct hci_dev *dev)
memset(data, 0, sizeof(data));
- if (dev->ssp_mode > 0) {
- int len;
-
- len = strlen((char *) dev->name);
- if (len > 48) {
- len = 48;
- data[1] = 0x08;
- } else
- data[1] = 0x09;
- data[0] = len + 1;
- memcpy(data + 2, dev->name, len);
- }
+ if (dev->ssp_mode > 0)
+ create_ext_inquiry_response((char *) dev->name, data);
if (hci_write_ext_inquiry_response(dd, fec, data, 2000) < 0)
error("Can't write extended inquiry response: %s (%d)",
diff --git a/sdpd/sdpd.h b/sdpd/sdpd.h
index ad7a2d4f..0a2bccf4 100644
--- a/sdpd/sdpd.h
+++ b/sdpd/sdpd.h
@@ -91,3 +91,4 @@ typedef void (*service_classes_callback_t) (const bdaddr_t *bdaddr, uint8_t valu
uint8_t get_service_classes(const bdaddr_t *bdaddr);
void set_service_classes_callback(service_classes_callback_t callback);
+void create_ext_inquiry_response(const char *name, uint8_t *data);
diff --git a/sdpd/service.c b/sdpd/service.c
index 7f8296f4..bbc7fcc8 100644
--- a/sdpd/service.c
+++ b/sdpd/service.c
@@ -139,6 +139,23 @@ void set_service_classes_callback(service_classes_callback_t callback)
service_classes_callback = callback;
}
+void create_ext_inquiry_response(const char *name, uint8_t *data)
+{
+ if (name) {
+ int len = strlen(name);
+
+ if (len > 48) {
+ len = 48;
+ data[1] = 0x08;
+ } else
+ data[1] = 0x09;
+
+ data[0] = len + 1;
+
+ memcpy(data + 2, name, len);
+ }
+}
+
void register_public_browse_group(void)
{
sdp_list_t *browselist;