diff options
-rw-r--r-- | hcid/dbus-adapter.c | 11 | ||||
-rw-r--r-- | hcid/dbus-api.txt | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index 97330dc5..3fbd0c36 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -995,11 +995,14 @@ static DBusHandlerResult handle_dev_get_name_req(DBusConnection *conn, DBusMessa str2ba(dbus_data->address, &ba); err = read_local_name(&ba, str); - if (err < 0) - err = get_device_name(dbus_data->dev_id, str, sizeof(str)); + if (err < 0) { + if (!dbus_data->up) + return error_not_ready(conn, msg); - if (err < 0) - return error_failed(conn, msg, -err); + err = get_device_name(dbus_data->dev_id, str, sizeof(str)); + if (err < 0) + return error_failed(conn, msg, -err); + } reply = dbus_message_new_method_return(msg); if (!reply) diff --git a/hcid/dbus-api.txt b/hcid/dbus-api.txt index 32327d02..42da902b 100644 --- a/hcid/dbus-api.txt +++ b/hcid/dbus-api.txt @@ -77,6 +77,10 @@ Errors Failed Error returned when the requested adapter doesn't exists. This error is similar to ENODEV. + NotReady + + Error returned when the adapter is DOWN. + NotAvailable Error returned when a specified record is not @@ -366,7 +370,7 @@ Methods string GetAddress() Returns the local adapter name (friendly name) in UTF-8. - Possible errors: none + Possible errors: org.bluez.Error.NotReady void SetName(string name) |