diff --git a/pam/pam_fprintd.c b/pam/pam_fprintd.c index 0b5e84e..23a2ae0 100644 --- a/pam/pam_fprintd.c +++ b/pam/pam_fprintd.c @@ -187,25 +187,22 @@ static DBusGProxy *create_manager (DBusGConnection **ret_conn, GMainLoop **ret_l static DBusGProxy *open_device(DBusGConnection *connection, DBusGProxy *manager, const char *username) { GError *error = NULL; - GPtrArray *devices; gchar *path; DBusGProxy *dev; - if (!dbus_g_proxy_call (manager, "GetDevices", &error, - G_TYPE_INVALID, dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), - &devices, G_TYPE_INVALID)) { - D(g_message("list_devices failed: %s", error->message)); + if (!dbus_g_proxy_call (manager, "GetDefaultDevice", &error, + G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, + &path, G_TYPE_INVALID)) { + D(g_message("get_default_devices failed: %s", error->message)); g_error_free (error); return NULL; } - if (devices->len == 0) { + if (path == NULL) { D(g_message("No devices found\n")); return NULL; } - D(g_message("found %d devices\n", devices->len)); - path = g_ptr_array_index(devices, 0); D(g_message("Using device %s\n", path)); dev = dbus_g_proxy_new_for_name(connection, @@ -213,8 +210,7 @@ static DBusGProxy *open_device(DBusGConnection *connection, DBusGProxy *manager, path, "net.reactivated.Fprint.Device"); - g_ptr_array_foreach(devices, (GFunc) g_free, NULL); - g_ptr_array_free(devices, TRUE); + g_free (path); if (!dbus_g_proxy_call (dev, "Claim", &error, G_TYPE_STRING, username, G_TYPE_INVALID, G_TYPE_INVALID)) { D(g_message("failed to claim device: %s\n", error->message)); diff --git a/tests/enroll.c b/tests/enroll.c index e1df99e..8a871a4 100644 --- a/tests/enroll.c +++ b/tests/enroll.c @@ -73,34 +73,24 @@ static void create_manager(void) static DBusGProxy *open_device(const char *username) { GError *error = NULL; - GPtrArray *devices; gchar *path; DBusGProxy *dev; - guint i; - if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error)) + if (!net_reactivated_Fprint_Manager_get_default_device(manager, &path, &error)) g_error("list_devices failed: %s", error->message); - if (devices->len == 0) { + if (path == NULL) { g_print("No devices found\n"); exit(1); } - g_print("found %d devices\n", devices->len); - for (i = 0; i < devices->len; i++) { - path = g_ptr_array_index(devices, i); - g_print("Device at %s\n", path); - } - - path = g_ptr_array_index(devices, 0); g_print("Using device %s\n", path); /* FIXME use for_name_owner?? */ dev = dbus_g_proxy_new_for_name(connection, "net.reactivated.Fprint", path, "net.reactivated.Fprint.Device"); - g_ptr_array_foreach(devices, (GFunc) g_free, NULL); - g_ptr_array_free(devices, TRUE); + g_free (path); if (!net_reactivated_Fprint_Device_claim(dev, username, &error)) g_error("failed to claim device: %s", error->message); diff --git a/tests/verify.c b/tests/verify.c index f7e5076..1f02b9d 100644 --- a/tests/verify.c +++ b/tests/verify.c @@ -75,34 +75,24 @@ static void create_manager(void) static DBusGProxy *open_device(const char *username) { GError *error = NULL; - GPtrArray *devices; gchar *path; DBusGProxy *dev; - guint i; - if (!net_reactivated_Fprint_Manager_get_devices(manager, &devices, &error)) + if (!net_reactivated_Fprint_Manager_get_default_device(manager, &path, &error)) g_error("list_devices failed: %s", error->message); - if (devices->len == 0) { + if (path == NULL) { g_print("No devices found\n"); exit(1); } - g_print("found %d devices\n", devices->len); - for (i = 0; i < devices->len; i++) { - path = g_ptr_array_index(devices, i); - g_print("Device at %s\n", path); - } - - path = g_ptr_array_index(devices, 0); g_print("Using device %s\n", path); /* FIXME use for_name_owner?? */ dev = dbus_g_proxy_new_for_name(connection, "net.reactivated.Fprint", path, "net.reactivated.Fprint.Device"); - g_ptr_array_foreach(devices, (GFunc) g_free, NULL); - g_ptr_array_free(devices, TRUE); + g_free (path); if (!net_reactivated_Fprint_Device_claim(dev, username, &error)) g_error("failed to claim device: %s", error->message);