device: Gracefully handle identify on devices with no support

We were crashing as trying to still call the identify vfunc, so check if
identification is supported and if not return a relative error.

Added test as well
This commit is contained in:
Marco Trevisan (Treviño)
2021-04-01 17:43:07 +02:00
parent 59767af552
commit 4031bb62d7
2 changed files with 17 additions and 0 deletions

View File

@@ -1038,6 +1038,14 @@ fp_device_identify (FpDevice *device,
return;
}
if (!fp_device_supports_identify (device))
{
g_task_return_error (task,
fpi_device_error_new_msg (FP_DEVICE_ERROR_NOT_SUPPORTED,
"Device has not identification support"));
return;
}
priv->current_action = FPI_DEVICE_ACTION_IDENTIFY;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);