linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anderson Lizardo <anderson.lizardo@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Anderson Lizardo <anderson.lizardo@openbossa.org>
Subject: [PATCH BlueZ 3/3] Fix not showing name if first EIR has no name info
Date: Tue, 17 Jan 2012 12:18:02 -0400	[thread overview]
Message-ID: <1326817082-6787-3-git-send-email-anderson.lizardo@openbossa.org> (raw)
In-Reply-To: <1326817082-6787-1-git-send-email-anderson.lizardo@openbossa.org>

Some devices may not advertise their name right on the first EIR data
sent (e.g. LE devices where name is set on either advertises or scan
responses, but not both). Given that the "found devices" cache does not
refresh the name on each EIR received, the UI may never show the name
during a discovery session.

This fix improves the Discovery UI by showing names immediately as they
are received. This works by emitting DeviceFound signals when the name
is received, even if RSSI stays the same.

Further discovery sessions will use the stored complete name, as usual.
---
 src/adapter.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 7e4bbb6..2984d80 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2806,6 +2806,15 @@ void adapter_update_found_devices(struct btd_adapter *adapter,
 	if (dev) {
 		adapter->oor_devices = g_slist_remove(adapter->oor_devices,
 							dev);
+
+		/* If an existing device had no name but the newly received EIR
+		 * data has (complete or not), we want to present it to the
+		 * user. */
+		if (dev->name == NULL && eir_data.name != NULL) {
+			dev->name = g_strdup(eir_data.name);
+			goto done;
+		}
+
 		if (dev->rssi != rssi)
 			goto done;
 
-- 
1.7.0.4


  parent reply	other threads:[~2012-01-17 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 16:18 [PATCH BlueZ 1/3] Fix wrong offset in EIR name parsing Anderson Lizardo
2012-01-17 16:18 ` [PATCH BlueZ 2/3] Fix g_strndup() call for EIR name Anderson Lizardo
2012-01-17 16:18 ` Anderson Lizardo [this message]
2012-01-17 19:43   ` [PATCH BlueZ 3/3] Fix not showing name if first EIR has no name info Johan Hedberg
2012-01-17 19:58     ` Anderson Lizardo
2012-01-17 19:35 ` [PATCH BlueZ 1/3] Fix wrong offset in EIR name parsing Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326817082-6787-3-git-send-email-anderson.lizardo@openbossa.org \
    --to=anderson.lizardo@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).