Commit e0131622 authored by Florent Revest's avatar Florent Revest

bluez5: advertise hostname in BLE ad payload to have a recognizable name in AsteroidOSSync

parent 539357e1
From: Florent Revest <revestflo@gmail.com>
Date: Thu, 24 Nov 2016 17:39:00 +0200
Subject: [PATCH] Forces GLES2 the dirty way
---
--- a/src/shared/ad.c
+++ b/src/shared/ad.c
@@ -110,6 +110,18 @@
free(ad);
}
+static size_t local_name_length()
+{
+ size_t length = 0;
+ char hostname[1024];
+
+ length += 2; /* one byte for length and one byte for 0x09 */
+ gethostname(hostname, 1024);
+ length += strlen(&hostname);
+
+ return length;
+}
+
static size_t uuid_list_length(struct queue *uuid_queue)
{
bool uuid16_included = false;
@@ -187,6 +199,8 @@
{
size_t length = 0;
+ length += local_name_length();
+
length += uuid_list_length(ad->service_uuids);
length += uuid_list_length(ad->solicit_uuids);
@@ -198,6 +212,22 @@
return length;
}
+
+static void serialize_local_name(uint8_t *buf, uint8_t *pos)
+{
+ char hostname[1024];
+ uint8_t hostname_len;
+
+ gethostname(hostname, 1024);
+ hostname_len = strlen(&hostname);
+
+ buf[(*pos)++] = hostname_len + 1;
+ buf[(*pos)++] = EIR_NAME_COMPLETE;
+
+ memcpy(buf + *pos, &hostname, hostname_len);
+ *pos += hostname_len;
+}
+
static void serialize_uuids(struct queue *uuids, uint8_t uuid_type,
uint8_t ad_type, uint8_t *buf,
uint8_t *pos)
@@ -330,6 +360,8 @@
if (!adv_data)
return NULL;
+ serialize_local_name(adv_data, &pos);
+
serialize_service_uuids(ad->service_uuids, adv_data, &pos);
serialize_solicit_uuids(ad->solicit_uuids, adv_data, &pos);
FILESEXTRAPATHS_prepend := "${THISDIR}/bluez5:"
SRC_URI += "file://main.conf \
file://bluetooth.service \
file://bluetooth.conf"
file://bluetooth.conf \
file://advertise-name.patch"
do_install_append() {
install -d ${D}/etc/bluetooth/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment