diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-06-22 19:14:38 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-06-22 19:14:38 +0000 |
commit | 7fb02908be38aaa273643ac6b78c5d72e40ae545 (patch) | |
tree | 8f103fe3a56f07d682fc27909efaace24a8533a9 /input/manager.c | |
parent | a47211b0097fe3612b96246f08bf37dccd15fd61 (diff) |
input: fixed CreateDevice - verify the src and the dst address to discover if the device already exists
Diffstat (limited to 'input/manager.c')
-rw-r--r-- | input/manager.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/input/manager.c b/input/manager.c index 666c0e44..74654893 100644 --- a/input/manager.c +++ b/input/manager.c @@ -778,23 +778,12 @@ done: dbus_message_unref(reply); } -static int path_bdaddr_cmp(const char *path, const bdaddr_t *bdaddr) -{ - bdaddr_t src, dst; - - if (input_device_get_bdaddr(connection, path, &src, &dst) < 0) - return -1; - - return bacmp(&dst, bdaddr); -} - static DBusHandlerResult create_device(DBusConnection *conn, DBusMessage *msg, void *data) { struct pending_req *pr; DBusError derr; const char *addr; - GSList *l; bdaddr_t src, dst; uint32_t cls = 0; int dev_id; @@ -821,10 +810,7 @@ static DBusHandlerResult create_device(DBusConnection *conn, } str2ba(addr, &dst); - - l = g_slist_find_custom(device_paths, &dst, - (GCompareFunc) path_bdaddr_cmp); - if (l) + if (input_device_is_registered(&src, &dst)) return err_already_exists(conn, msg, "Input Already exists"); if (read_device_class(&src, &dst, &cls) < 0) { |