mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
device: Expose finger status as DBus properties
libfprint v1.90.4 introduced a new finger status API to expose to the UI the finger status on sensor. Add two new properties to the Device interface that represent the possible values. Add new tests.
This commit is contained in:
committed by
Benjamin Berg
parent
30eaaf2def
commit
1835d99265
23
src/device.c
23
src/device.c
@ -327,6 +327,24 @@ on_scan_type_changed (FprintDevice *rdev,
|
||||
fprint_dbus_device_get_scan_type (dbus_dev));
|
||||
}
|
||||
|
||||
static void
|
||||
on_finger_status_changed (FprintDevice *rdev,
|
||||
GParamSpec *spec,
|
||||
FpDevice *device)
|
||||
{
|
||||
FprintDBusDevice *dbus_dev = FPRINT_DBUS_DEVICE (rdev);
|
||||
FpFingerStatusFlags finger_status = fp_device_get_finger_status (device);
|
||||
gboolean present, needed;
|
||||
|
||||
present = !!(finger_status & FP_FINGER_STATUS_PRESENT);
|
||||
fprint_dbus_device_set_finger_present (dbus_dev, present);
|
||||
g_debug ("Finger present %d", present);
|
||||
|
||||
needed = !!(finger_status & FP_FINGER_STATUS_NEEDED);
|
||||
fprint_dbus_device_set_finger_needed (dbus_dev, needed);
|
||||
g_debug ("Finger needed %d", needed);
|
||||
}
|
||||
|
||||
static void
|
||||
fprint_device_constructed (GObject *object)
|
||||
{
|
||||
@ -346,6 +364,11 @@ fprint_device_constructed (GObject *object)
|
||||
rdev, G_CONNECT_SWAPPED);
|
||||
on_nr_enroll_stages_changed (rdev, NULL, priv->dev);
|
||||
|
||||
g_signal_connect_object (priv->dev, "notify::finger-status",
|
||||
G_CALLBACK (on_finger_status_changed),
|
||||
rdev, G_CONNECT_SWAPPED);
|
||||
on_finger_status_changed (rdev, NULL, priv->dev);
|
||||
|
||||
G_OBJECT_CLASS (fprint_device_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user