diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-08-05 10:14:50 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-08-05 10:14:50 +0300 |
commit | 53c29ff120dc7ce285bb97c2ac623858f4b4c8d0 (patch) | |
tree | a477800a526f6c65ba2f7dd5191bcaa74dabd94f /src | |
parent | 31e380bc0c6baea07d204e781f63ec388fdc3e20 (diff) |
Fix Adapter Name property setting when the adapter is DOWN
It should be possible to set the name even when the adapter is down. The
recent hciops patches broke this behavior and this patch fixes it again.
Diffstat (limited to 'src')
-rw-r--r-- | src/adapter.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/adapter.c b/src/adapter.c index 15fc6130..bf69fcc6 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -903,7 +903,6 @@ static DBusMessage *set_name(DBusConnection *conn, DBusMessage *msg, { struct btd_adapter *adapter = data; struct hci_dev *dev = &adapter->dev; - int err; if (!g_utf8_validate(name, -1, NULL)) { error("Name change failed: supplied name isn't valid UTF-8"); @@ -913,12 +912,14 @@ static DBusMessage *set_name(DBusConnection *conn, DBusMessage *msg, if (strncmp(name, (char *) dev->name, MAX_NAME_LENGTH) == 0) goto done; - if (!adapter->up) - return failed_strerror(msg, -EHOSTDOWN); - - err = adapter_ops->set_name(adapter->dev_id, name); - if (err < 0) - return failed_strerror(msg, err); + if (!adapter->up) { + strncpy((char *) adapter->dev.name, name, MAX_NAME_LENGTH); + write_local_name(&adapter->bdaddr, name); + } else { + int err = adapter_ops->set_name(adapter->dev_id, name); + if (err < 0) + return failed_strerror(msg, err); + } done: return dbus_message_new_method_return(msg); |