linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use alias for LE devices
@ 2011-12-01 19:01 Sheldon Demario
  2011-12-08 12:39 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Sheldon Demario @ 2011-12-01 19:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

As in BR/EDR, use alias for LE devices or, if there is no alias, set
it to either the name or to the device address.
---
 src/adapter.c |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 84e33a7..1a701a4 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2773,6 +2773,15 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 		dev->uuid_count = uuid_count;
 	}
 
+	if (!dev->alias) {
+		if (!dev->name) {
+			alias = g_strdup(peer_addr);
+			g_strdelimit(alias, ":", '-');
+		} else
+			alias = g_strdup(dev->name);
+	} else
+		alias = g_strdup(dev->alias);
+
 	if (dev->le) {
 		gboolean broadcaster;
 
@@ -2785,36 +2794,27 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
 				"Address", DBUS_TYPE_STRING, &paddr,
 				"RSSI", DBUS_TYPE_INT16, &rssi,
 				"Name", DBUS_TYPE_STRING, &dev->name,
+				"Alias", DBUS_TYPE_STRING, &alias,
 				"Paired", DBUS_TYPE_BOOLEAN, &paired,
 				"Broadcaster", DBUS_TYPE_BOOLEAN, &broadcaster,
 				"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids, uuid_count,
 				NULL);
-		return;
-	}
-
-	icon = class_to_icon(dev->class);
-
-	if (!dev->alias) {
-		if (!dev->name) {
-			alias = g_strdup(peer_addr);
-			g_strdelimit(alias, ":", '-');
-		} else
-			alias = g_strdup(dev->name);
-	} else
-		alias = g_strdup(dev->alias);
+	} else {
+		icon = class_to_icon(dev->class);
 
-	emit_device_found(adapter->path, paddr,
-			"Address", DBUS_TYPE_STRING, &paddr,
-			"Class", DBUS_TYPE_UINT32, &dev->class,
-			"Icon", DBUS_TYPE_STRING, &icon,
-			"RSSI", DBUS_TYPE_INT16, &rssi,
-			"Name", DBUS_TYPE_STRING, &dev->name,
-			"Alias", DBUS_TYPE_STRING, &alias,
-			"LegacyPairing", DBUS_TYPE_BOOLEAN, &dev->legacy,
-			"Paired", DBUS_TYPE_BOOLEAN, &paired,
-			"Trusted", DBUS_TYPE_BOOLEAN, &trusted,
-			"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids, uuid_count,
-			NULL);
+		emit_device_found(adapter->path, paddr,
+				"Address", DBUS_TYPE_STRING, &paddr,
+				"Class", DBUS_TYPE_UINT32, &dev->class,
+				"Icon", DBUS_TYPE_STRING, &icon,
+				"RSSI", DBUS_TYPE_INT16, &rssi,
+				"Name", DBUS_TYPE_STRING, &dev->name,
+				"Alias", DBUS_TYPE_STRING, &alias,
+				"LegacyPairing", DBUS_TYPE_BOOLEAN, &dev->legacy,
+				"Paired", DBUS_TYPE_BOOLEAN, &paired,
+				"Trusted", DBUS_TYPE_BOOLEAN, &trusted,
+				"UUIDs", DBUS_TYPE_ARRAY, &dev->uuids, uuid_count,
+				NULL);
+	}
 
 	g_free(alias);
 }
-- 
1.7.4.1


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

* Re: [PATCH] Use alias for LE devices
  2011-12-01 19:01 [PATCH] Use alias for LE devices Sheldon Demario
@ 2011-12-08 12:39 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-12-08 12:39 UTC (permalink / raw)
  To: Sheldon Demario; +Cc: linux-bluetooth

Hi Sheldon,

On Thu, Dec 01, 2011, Sheldon Demario wrote:
> As in BR/EDR, use alias for LE devices or, if there is no alias, set
> it to either the name or to the device address.
> ---
>  src/adapter.c |   50 +++++++++++++++++++++++++-------------------------
>  1 files changed, 25 insertions(+), 25 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2011-12-08 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01 19:01 [PATCH] Use alias for LE devices Sheldon Demario
2011-12-08 12:39 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).