Commit 874d8164 authored by Bastien Nocera's avatar Bastien Nocera Committed by Daniel Drake

Add ScanType and NumberEnrollStages properties

Export the type of scan the device performs, and, when the device
is claimed, the number of enrollment stages.
parent f7186c7f
......@@ -26,7 +26,5 @@ Review error cases, and possible errors
Do we swipe or scan, devices would know
Export fp_dev_get_nr_enroll_stages and swipe type through properties
Add a "done" argument to verify and enroll result signals, make it easier
to know when we're done.
......@@ -302,7 +302,7 @@ static int do_verify(DBusGConnection *connection, GMainLoop *loop, pam_handle_t
if (dbus_g_proxy_call (dev, "GetProperties", &error, G_TYPE_INVALID,
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), &props, G_TYPE_INVALID)) {
data->driver = g_strdup (g_hash_table_lookup (props, "Name"));
data->driver = g_value_dup_string (g_hash_table_lookup (props, "Name"));
g_hash_table_destroy (props);
}
if (!data->driver)
......
......@@ -1140,15 +1140,30 @@ static void fprint_device_get_properties (FprintDevice *rdev,
{
FprintDevicePrivate *priv = DEVICE_GET_PRIVATE(rdev);
GHashTable *table;
struct fp_driver *driver;
const char *driver_name;
GValue *value;
table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
driver = fp_dscv_dev_get_driver (priv->ddev);
driver_name = fp_driver_get_full_name (driver);
g_hash_table_insert (table, "Name", g_strdup (driver_name));
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, fp_driver_get_full_name (fp_dscv_dev_get_driver (priv->ddev)));
g_hash_table_insert (table, "Name", value);
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_STRING);
g_value_set_static_string (value,
fp_driver_get_scan_type (fp_dscv_dev_get_driver (priv->ddev)) == FP_SCAN_TYPE_PRESS ? "press" : "swipe");
g_hash_table_insert (table, "ScanType", value);
if (priv->dev != NULL) {
value = g_new0 (GValue, 1);
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, fp_dev_get_nr_enroll_stages (priv->dev));
g_hash_table_insert (table, "NumberEnrollStages", value);
}
dbus_g_method_return (context, table);
g_hash_table_destroy (table);
}
......@@ -55,7 +55,7 @@
</signal>
<method name="GetProperties">
<arg type="a{ss}" name="properties" direction="out" />
<arg type="a{sv}" name="properties" direction="out" />
<annotation name="org.freedesktop.DBus.GLib.Async" value="" />
</method>
......
......@@ -57,7 +57,10 @@ static void list_fingerprints(DBusGProxy *dev, const char *username)
if (!net_reactivated_Fprint_Device_get_properties(dev, &props, &error))
g_error("GetProperties failed: %s", error->message);
g_print("Fingerprints for user %s on %s:\n", username, (char *) g_hash_table_lookup (props, "Name"));
g_print("Fingerprints for user %s on %s (%s):\n",
username,
g_value_get_string (g_hash_table_lookup (props, "Name")),
g_value_get_string (g_hash_table_lookup (props, "ScanType")));
g_hash_table_destroy (props);
for (i = 0; fingers[i] != NULL; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment