summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-hci.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-04-24 18:19:24 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-04-24 18:19:24 +0000
commit3286581f8afecebbdae8a9f9ae96fefda8c611a8 (patch)
tree343821265c6d8590c744c250f03faafd631512dd /hcid/dbus-hci.c
parent712a6619937ca6109be36f3b764da6c388a0b487 (diff)
Send signal when requesting remote device name
Diffstat (limited to 'hcid/dbus-hci.c')
-rw-r--r--hcid/dbus-hci.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/hcid/dbus-hci.c b/hcid/dbus-hci.c
index ca25dd70..e9a03b22 100644
--- a/hcid/dbus-hci.c
+++ b/hcid/dbus-hci.c
@@ -1005,7 +1005,7 @@ int found_device_req_name(struct adapter *adapter)
/* send at least one request or return failed if the list is empty */
do {
- DBusMessage *failed_signal = NULL;
+ DBusMessage *signal = NULL;
struct remote_dev_info *dev = l->data;
char *peer_addr;
bdaddr_t tmp;
@@ -1023,7 +1023,7 @@ int found_device_req_name(struct adapter *adapter)
if (hci_send_req(dd, &rq, 500) < 0) {
error("Unable to send the HCI remote name request: %s (%d)",
strerror(errno), errno);
- failed_signal = dev_signal_factory(adapter->dev_id,
+ signal = dev_signal_factory(adapter->dev_id,
"RemoteNameFailed",
DBUS_TYPE_STRING, &peer_addr,
DBUS_TYPE_INVALID);
@@ -1032,21 +1032,32 @@ int found_device_req_name(struct adapter *adapter)
if (rp.status) {
error("Remote name request failed with status 0x%02x",
rp.status);
- failed_signal = dev_signal_factory(adapter->dev_id,
+ signal = dev_signal_factory(adapter->dev_id,
"RemoteNameFailed",
DBUS_TYPE_STRING, &peer_addr,
DBUS_TYPE_INVALID);
}
+ if (!signal) {
+ req_sent = 1;
+ /* if we are in discovery, inform application of getting name */
+ if (adapter->discov_type & (STD_INQUIRY | PERIODIC_INQUIRY)) {
+ signal = dev_signal_factory(adapter->dev_id,
+ "RemoteNameRequested",
+ DBUS_TYPE_STRING, &peer_addr,
+ DBUS_TYPE_INVALID);
+ }
+ }
+
free(peer_addr);
- if (!failed_signal) {
- req_sent = 1;
- break;
+ if (signal) {
+ send_message_and_unref(connection, signal);
+ signal = NULL;
}
- send_message_and_unref(connection, failed_signal);
- failed_signal = NULL;
+ if (req_sent)
+ break;
/* if failed, request the next element */
/* remove the element from the list */