diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-03-14 22:10:29 +0000 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-03-14 22:10:29 +0000 |
commit | 44b781c2d0553702ed830006a14d3bf4e3473b4c (patch) | |
tree | 06ce965523470618d82bedacd709cd8e65f213b5 | |
parent | 0eff1c8f3f32cc248bae49ed2368c54117aa31e3 (diff) |
Fix RequestMode when no agent is registered or the new mode is the same.
-rw-r--r-- | hcid/adapter.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index a17ee5eb..3214820e 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -3764,7 +3764,7 @@ static DBusHandlerResult request_mode(DBusConnection *conn, return error_invalid_arguments(conn, msg, NULL); /* No need to change mode */ - if (adapter->mode > new_mode) { + if (adapter->mode >= new_mode) { reply = dbus_message_new_method_return(msg); if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; @@ -3772,6 +3772,9 @@ static DBusHandlerResult request_mode(DBusConnection *conn, return send_message_and_unref(conn, reply); } + if (!adapter->agent) + return error_failed(conn, msg, "No agent registered"); + req = g_new0(struct mode_req, 1); req->adapter = adapter; req->conn = dbus_connection_ref(conn); |