summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-10-01 14:11:43 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-10-01 14:11:43 +0000
commit58d24f6c34ff7fda0c2bf291097f2f74c841e43e (patch)
treec3467fad40be6e9d95ae08546b75e746829a1441
parentcb274f87d6246eb943cd388965e3afe371ed612b (diff)
Allow SetName even when the adapter is DOWN
-rw-r--r--hcid/adapter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c
index ea536a9b..cddffcde 100644
--- a/hcid/adapter.c
+++ b/hcid/adapter.c
@@ -1083,9 +1083,6 @@ static DBusHandlerResult adapter_set_name(DBusConnection *conn,
char *str_ptr;
int ecode;
- if (!adapter->up)
- return error_not_ready(conn, msg);
-
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &str_ptr,
DBUS_TYPE_INVALID))
@@ -1096,14 +1093,18 @@ static DBusHandlerResult adapter_set_name(DBusConnection *conn,
return error_invalid_arguments(conn, msg);
}
- hci_devba(adapter->dev_id, &bdaddr);
+ str2ba(adapter->address, &bdaddr);
write_local_name(&bdaddr, str_ptr);
+ if (!adapter->up)
+ goto done;
+
ecode = set_device_name(adapter->dev_id, str_ptr);
if (ecode < 0)
return error_failed(conn, msg, -ecode);
+done:
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;