mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
Implement suspend/resume handling
This commit is contained in:
75
src/device.c
75
src/device.c
@ -475,6 +475,81 @@ _fprint_device_get_id (FprintDevice *rdev)
|
||||
return priv->id;
|
||||
}
|
||||
|
||||
static void
|
||||
suspend_cb (GObject *source_obj,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr(GTask) task = user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
fp_device_suspend_finish (FP_DEVICE (source_obj), res, &error);
|
||||
if (error)
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
resume_cb (GObject *source_obj,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr(GTask) task = user_data;
|
||||
GError *error = NULL;
|
||||
|
||||
fp_device_resume_finish (FP_DEVICE (source_obj), res, &error);
|
||||
if (error)
|
||||
g_task_return_error (task, error);
|
||||
else
|
||||
g_task_return_boolean (task, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
fprint_device_suspend (FprintDevice *rdev,
|
||||
GAsyncReadyCallback callback,
|
||||
void *user_data)
|
||||
{
|
||||
GTask *task = NULL;
|
||||
FprintDevicePrivate *priv = fprint_device_get_instance_private (rdev);
|
||||
|
||||
/* Just forward to libfprint. */
|
||||
|
||||
task = g_task_new (rdev, NULL, callback, user_data);
|
||||
fp_device_suspend (priv->dev, NULL, suspend_cb, task);
|
||||
}
|
||||
|
||||
void
|
||||
fprint_device_resume (FprintDevice *rdev,
|
||||
GAsyncReadyCallback callback,
|
||||
void *user_data)
|
||||
{
|
||||
GTask *task = NULL;
|
||||
FprintDevicePrivate *priv = fprint_device_get_instance_private (rdev);
|
||||
|
||||
/* Just forward to libfprint. */
|
||||
|
||||
task = g_task_new (rdev, NULL, callback, user_data);
|
||||
fp_device_resume (priv->dev, NULL, resume_cb, task);
|
||||
}
|
||||
|
||||
void
|
||||
fprint_device_suspend_finish (FprintDevice *rdev,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
void
|
||||
fprint_device_resume_finish (FprintDevice *rdev,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_task_propagate_boolean (G_TASK (res), error);
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
fp_finger_to_name (FpFinger finger)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user