fpi-device: Mark the device as open and notify it on idle callback
We're delaying any completed operation until we've completed an idle, but the open/close state is changed and notified as soon as the device completes the operation. While this can be true, it means that we notify earlier than the finish callback is actually called, while iterations are still needed to get the actual state completed, and the current_task reset. So if we'd open/close and iterate till fp_device_is_open() returns TRUE we'd end up in a state in which the device is marked as ready, but it's actually still busy since it's priv->current_task isn't unset yet. The same if we'd try to do any action on notify::opened.
This commit is contained in:
parent
33ba248c44
commit
27c2466bda
1 changed files with 15 additions and 12 deletions
|
@ -752,6 +752,21 @@ fp_device_task_return_in_idle_cb (gpointer user_data)
|
||||||
priv->current_action = FPI_DEVICE_ACTION_NONE;
|
priv->current_action = FPI_DEVICE_ACTION_NONE;
|
||||||
priv->current_task_idle_return_source = NULL;
|
priv->current_task_idle_return_source = NULL;
|
||||||
|
|
||||||
|
if (action == FPI_DEVICE_ACTION_OPEN &&
|
||||||
|
data->type != FP_DEVICE_TASK_RETURN_ERROR)
|
||||||
|
{
|
||||||
|
priv->is_open = TRUE;
|
||||||
|
g_object_notify (G_OBJECT (data->device), "open");
|
||||||
|
}
|
||||||
|
else if (action == FPI_DEVICE_ACTION_CLOSE)
|
||||||
|
{
|
||||||
|
/* Always consider the device closed. Drivers should try hard to close the
|
||||||
|
* device. Generally, e.g. cancellations should be ignored.
|
||||||
|
*/
|
||||||
|
priv->is_open = FALSE;
|
||||||
|
g_object_notify (G_OBJECT (data->device), "open");
|
||||||
|
}
|
||||||
|
|
||||||
/* Return FP_DEVICE_ERROR_REMOVED if the device is removed,
|
/* Return FP_DEVICE_ERROR_REMOVED if the device is removed,
|
||||||
* with the exception of a successful open, which is an odd corner case. */
|
* with the exception of a successful open, which is an odd corner case. */
|
||||||
if (priv->is_removed &&
|
if (priv->is_removed &&
|
||||||
|
@ -921,12 +936,6 @@ fpi_device_open_complete (FpDevice *device, GError *error)
|
||||||
clear_device_cancel_action (device);
|
clear_device_cancel_action (device);
|
||||||
fpi_device_report_finger_status (device, FP_FINGER_STATUS_NONE);
|
fpi_device_report_finger_status (device, FP_FINGER_STATUS_NONE);
|
||||||
|
|
||||||
if (!error)
|
|
||||||
{
|
|
||||||
priv->is_open = TRUE;
|
|
||||||
g_object_notify (G_OBJECT (device), "open");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL,
|
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL,
|
||||||
GUINT_TO_POINTER (TRUE));
|
GUINT_TO_POINTER (TRUE));
|
||||||
|
@ -977,12 +986,6 @@ fpi_device_close_complete (FpDevice *device, GError *error)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always consider the device closed. Drivers should try hard to close the
|
|
||||||
* device. Generally, e.g. cancellations should be ignored.
|
|
||||||
*/
|
|
||||||
priv->is_open = FALSE;
|
|
||||||
g_object_notify (G_OBJECT (device), "open");
|
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL,
|
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL,
|
||||||
GUINT_TO_POINTER (TRUE));
|
GUINT_TO_POINTER (TRUE));
|
||||||
|
|
Loading…
Reference in a new issue