summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-19 19:46:09 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-19 19:46:09 +0000
commit4b0b4c6b25a119e7011d2da9827481a6c1690dc0 (patch)
treefea7e1c272e88b2b52f7b208bea7e478fa90743c
parent4c172501d839e5d7c3f46510432b731ea2768dbf (diff)
GetName: Check if the adapter is ready before send the read local name cmd
-rw-r--r--hcid/dbus-adapter.c11
-rw-r--r--hcid/dbus-api.txt6
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)