mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
Compare commits
1 Commits
benzea/dea
...
benzea/add
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7cab77fc1 |
@@ -308,15 +308,6 @@ dev_deinit (FpImageDevice *dev)
|
|||||||
fpi_device_add_timeout (FP_DEVICE (dev), 100, (FpTimeoutFunc) fpi_image_device_close_complete, NULL, NULL);
|
fpi_device_add_timeout (FP_DEVICE (dev), 100, (FpTimeoutFunc) fpi_image_device_close_complete, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
dev_deactivate (FpImageDevice *dev)
|
|
||||||
{
|
|
||||||
G_DEBUG_HERE ();
|
|
||||||
|
|
||||||
/* Delay result to open up the possibility of testing race conditions. */
|
|
||||||
fpi_device_add_timeout (FP_DEVICE (dev), 100, (FpTimeoutFunc) fpi_image_device_deactivate_complete, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fpi_device_virtual_image_init (FpDeviceVirtualImage *self)
|
fpi_device_virtual_image_init (FpDeviceVirtualImage *self)
|
||||||
{
|
{
|
||||||
@@ -340,6 +331,4 @@ fpi_device_virtual_image_class_init (FpDeviceVirtualImageClass *klass)
|
|||||||
|
|
||||||
img_class->img_open = dev_init;
|
img_class->img_open = dev_init;
|
||||||
img_class->img_close = dev_deinit;
|
img_class->img_close = dev_deinit;
|
||||||
|
|
||||||
img_class->deactivate = dev_deactivate;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -354,6 +354,24 @@ transfer_finish_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
|
|||||||
fpi_usb_transfer_unref (transfer);
|
fpi_usb_transfer_unref (transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
transfer_cancel_cb (FpiUsbTransfer *transfer)
|
||||||
|
{
|
||||||
|
GError *error;
|
||||||
|
FpiUsbTransferCallback callback;
|
||||||
|
|
||||||
|
error = g_error_new_literal (G_IO_ERROR,
|
||||||
|
G_IO_ERROR_CANCELLED,
|
||||||
|
"Transfer was cancelled before being started");
|
||||||
|
callback = transfer->callback;
|
||||||
|
transfer->callback = NULL;
|
||||||
|
transfer->actual_length = -1;
|
||||||
|
callback (transfer, transfer->device, transfer->user_data, error);
|
||||||
|
|
||||||
|
fpi_usb_transfer_unref (transfer);
|
||||||
|
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fpi_usb_transfer_submit:
|
* fpi_usb_transfer_submit:
|
||||||
@@ -387,6 +405,18 @@ fpi_usb_transfer_submit (FpiUsbTransfer *transfer,
|
|||||||
|
|
||||||
log_transfer (transfer, TRUE, NULL);
|
log_transfer (transfer, TRUE, NULL);
|
||||||
|
|
||||||
|
/* Work around libgusb cancellation issue, see
|
||||||
|
* https://github.com/hughsie/libgusb/pull/42
|
||||||
|
* should be fixed with libgusb 0.3.7.
|
||||||
|
* Note that this is not race free, we rely on libfprint and API users
|
||||||
|
* not cancelling from a different thread here.
|
||||||
|
*/
|
||||||
|
if (cancellable && g_cancellable_is_cancelled (cancellable))
|
||||||
|
{
|
||||||
|
g_idle_add ((GSourceFunc) transfer_cancel_cb, transfer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (transfer->type)
|
switch (transfer->type)
|
||||||
{
|
{
|
||||||
case FP_TRANSFER_BULK:
|
case FP_TRANSFER_BULK:
|
||||||
|
|||||||
Reference in New Issue
Block a user