mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
virtual-device: Process supported commands on device open
When opening the device we can process commands that we left for that after the previous close, to do that we only have to inject an invalid command that will be processed (and ignored) while closing, so that at next device opening we will be able to proceed with the previously sent commands. Add tests to finally check this case!
This commit is contained in:
@@ -78,6 +78,10 @@ maybe_continue_current_action (FpDeviceVirtualDevice *self)
|
||||
FP_DEVICE_GET_CLASS (self)->delete (dev);
|
||||
break;
|
||||
|
||||
case FPI_DEVICE_ACTION_OPEN:
|
||||
FP_DEVICE_GET_CLASS (self)->open (dev);
|
||||
break;
|
||||
|
||||
case FPI_DEVICE_ACTION_CLOSE:
|
||||
FP_DEVICE_GET_CLASS (self)->close (dev);
|
||||
break;
|
||||
@@ -327,6 +331,22 @@ dev_init (FpDevice *dev)
|
||||
|
||||
G_DEBUG_HERE ();
|
||||
|
||||
process_cmds (self, FALSE, &error);
|
||||
if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
fpi_device_open_complete (dev, g_steal_pointer (&error));
|
||||
return;
|
||||
}
|
||||
else if (self->sleep_timeout_id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (self->listener)
|
||||
{
|
||||
fpi_device_open_complete (dev, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
listener = fp_device_virtual_listener_new ();
|
||||
cancellable = g_cancellable_new ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user