From: Andrei Emeltchenko <[email protected]>
---
android/adapter.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/android/adapter.c b/android/adapter.c
index cb92f2f..8210d1a 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -1016,13 +1016,32 @@ static void send_adapter_address(void)
g_free(ev);
}
-static bool get_name(void)
+static bool send_adapter_name(void)
{
- DBG("Not implemented");
+ struct hal_ev_adapter_props_changed *ev;
+ size_t len;
- /* TODO: Add implementation */
+ if (!adapter->name)
+ return false;
- return false;
+ len = sizeof(*ev) + sizeof(struct hal_property) +
+ strlen(adapter->name) + 1;
+
+ ev = g_malloc0(len);
+
+ ev->num_props = 1;
+ ev->status = HAL_STATUS_SUCCESS;
+
+ ev->props[0].type = HAL_PROP_ADAPTER_NAME;
+ ev->props[0].len = strlen(adapter->name) + 1;
+ memcpy(&ev->props[0].val, adapter->name, strlen(adapter->name));
+
+ ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+ HAL_EV_ADAPTER_PROPS_CHANGED, len, ev, -1);
+
+ g_free(ev);
+
+ return true;
}
static bool get_uuids(void)
@@ -1097,7 +1116,7 @@ static bool get_property(void *buf, uint16_t len)
send_adapter_address();
return true;
case HAL_PROP_ADAPTER_NAME:
- return get_name();
+ return send_adapter_name();
case HAL_PROP_ADAPTER_UUIDS:
return get_uuids();
case HAL_PROP_ADAPTER_CLASS:
--
1.7.10.4
Hi Andrei,
On Mon, Nov 04, 2013, Andrei Emeltchenko wrote:
> ---
> android/adapter.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
The patch doesn't compile:
android/adapter.c: In function ‘send_adapter_name’:
android/adapter.c:1024:2: error: pointer targets in passing argument 1 of ‘adapter_name_changed’ differ in signedness [-Werror=pointer-sign]
adapter_name_changed(adapter->name);
^
android/adapter.c:145:13: note: expected ‘const uint8_t *’ but argument is of type ‘char *’
static void adapter_name_changed(const uint8_t *name)
^
cc1: all warnings being treated as errors
make[1]: *** [android/adapter.o] Error 1
> @@ -71,6 +71,8 @@ static void mgmt_local_name_changed_event(uint16_t index, uint16_t length,
> {
> const struct mgmt_cp_set_local_name *rp = param;
>
> + DBG("");
> +
> if (length < sizeof(*rp)) {
> error("Wrong size of local name changed parameters");
> return;
This change seems unrelated. Just drop it or move it to another patch.
Johan
From: Andrei Emeltchenko <[email protected]>
---
android/adapter.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/android/adapter.c b/android/adapter.c
index cb92f2f..55c495c 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -71,6 +71,8 @@ static void mgmt_local_name_changed_event(uint16_t index, uint16_t length,
{
const struct mgmt_cp_set_local_name *rp = param;
+ DBG("");
+
if (length < sizeof(*rp)) {
error("Wrong size of local name changed parameters");
return;
@@ -1016,13 +1018,14 @@ static void send_adapter_address(void)
g_free(ev);
}
-static bool get_name(void)
+static bool send_adapter_name(void)
{
- DBG("Not implemented");
+ if (!adapter->name)
+ return false;
- /* TODO: Add implementation */
+ adapter_name_changed(adapter->name);
- return false;
+ return true;
}
static bool get_uuids(void)
@@ -1097,7 +1100,7 @@ static bool get_property(void *buf, uint16_t len)
send_adapter_address();
return true;
case HAL_PROP_ADAPTER_NAME:
- return get_name();
+ return send_adapter_name();
case HAL_PROP_ADAPTER_UUIDS:
return get_uuids();
case HAL_PROP_ADAPTER_CLASS:
--
1.7.10.4
On Mon, Nov 04, 2013 at 11:22:13AM +0200, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <[email protected]>
Sorry, there is similar function exist, I will reuse it.
Best regards
Andrei Emeltchenko
>
> ---
> android/adapter.c | 29 ++++++++++++++++++++++++-----
> 1 file changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/android/adapter.c b/android/adapter.c
> index cb92f2f..8210d1a 100644
> --- a/android/adapter.c
> +++ b/android/adapter.c
> @@ -1016,13 +1016,32 @@ static void send_adapter_address(void)
> g_free(ev);
> }
>
> -static bool get_name(void)
> +static bool send_adapter_name(void)
> {
> - DBG("Not implemented");
> + struct hal_ev_adapter_props_changed *ev;
> + size_t len;
>
> - /* TODO: Add implementation */
> + if (!adapter->name)
> + return false;
>
> - return false;
> + len = sizeof(*ev) + sizeof(struct hal_property) +
> + strlen(adapter->name) + 1;
> +
> + ev = g_malloc0(len);
> +
> + ev->num_props = 1;
> + ev->status = HAL_STATUS_SUCCESS;
> +
> + ev->props[0].type = HAL_PROP_ADAPTER_NAME;
> + ev->props[0].len = strlen(adapter->name) + 1;
> + memcpy(&ev->props[0].val, adapter->name, strlen(adapter->name));
> +
> + ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
> + HAL_EV_ADAPTER_PROPS_CHANGED, len, ev, -1);
> +
> + g_free(ev);
> +
> + return true;
> }
>
> static bool get_uuids(void)
> @@ -1097,7 +1116,7 @@ static bool get_property(void *buf, uint16_t len)
> send_adapter_address();
> return true;
> case HAL_PROP_ADAPTER_NAME:
> - return get_name();
> + return send_adapter_name();
> case HAL_PROP_ADAPTER_UUIDS:
> return get_uuids();
> case HAL_PROP_ADAPTER_CLASS:
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html