760 lines
28 KiB
Diff
760 lines
28 KiB
Diff
From b789fda58d5ddf9bc8b6f2830e6fc93d222e6c34 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
Date: Tue, 26 Nov 2019 21:23:42 +0100
|
|
Subject: [PATCH 029/181] fpi-usb-transfer: Take ownership of the transfer when
|
|
submitting it
|
|
|
|
When a transfer is completed, we automatically unref it since we can't
|
|
consider it valid anymore since this point.
|
|
|
|
Update the drivers not to free the transfer after submitting anymore.
|
|
---
|
|
libfprint/drivers/aes1610.c | 3 ---
|
|
libfprint/drivers/aes2501.c | 4 ----
|
|
libfprint/drivers/aes2550.c | 9 ---------
|
|
libfprint/drivers/aes3k.c | 1 -
|
|
libfprint/drivers/aeslib.c | 1 -
|
|
libfprint/drivers/aesx660.c | 2 --
|
|
libfprint/drivers/elan.c | 2 --
|
|
libfprint/drivers/etes603.c | 1 -
|
|
libfprint/drivers/synaptics/synaptics.c | 8 +++-----
|
|
libfprint/drivers/upeksonly.c | 5 -----
|
|
libfprint/drivers/upektc.c | 6 ------
|
|
libfprint/drivers/upektc_img.c | 3 ---
|
|
libfprint/drivers/upekts.c | 11 -----------
|
|
libfprint/drivers/uru4000.c | 3 ---
|
|
libfprint/drivers/vcom5s.c | 3 ---
|
|
libfprint/drivers/vfs0050.c | 5 -----
|
|
libfprint/drivers/vfs101.c | 3 ---
|
|
libfprint/drivers/vfs301_proto.c | 10 +++-------
|
|
libfprint/drivers/vfs5011.c | 3 ---
|
|
libfprint/fpi-usb-transfer.c | 14 ++++----------
|
|
20 files changed, 10 insertions(+), 87 deletions(-)
|
|
|
|
diff --git a/libfprint/drivers/aes1610.c b/libfprint/drivers/aes1610.c
|
|
index 0326565..4261b05 100644
|
|
--- a/libfprint/drivers/aes1610.c
|
|
+++ b/libfprint/drivers/aes1610.c
|
|
@@ -155,7 +155,6 @@ generic_read_ignore_data (FpiSsm *ssm, FpDevice *dev,
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
generic_ignore_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/****** FINGER PRESENCE DETECTION ******/
|
|
@@ -238,7 +237,6 @@ finger_det_reqs_cb (FpImageDevice *dev, GError *error,
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
finger_det_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -683,7 +681,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_read_strip_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
}
|
|
;
|
|
diff --git a/libfprint/drivers/aes2501.c b/libfprint/drivers/aes2501.c
|
|
index 1b59c56..e18b4fe 100644
|
|
--- a/libfprint/drivers/aes2501.c
|
|
+++ b/libfprint/drivers/aes2501.c
|
|
@@ -126,7 +126,6 @@ read_regs_rq_cb (FpImageDevice *dev, GError *error, void *user_data)
|
|
fpi_usb_transfer_fill_bulk (transfer, EP_IN, READ_REGS_LEN);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
read_regs_data_cb, rdata);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -210,7 +209,6 @@ generic_read_ignore_data (FpiSsm *ssm, FpDevice *dev,
|
|
fpi_usb_transfer_fill_bulk (transfer, EP_IN, bytes);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
generic_ignore_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/****** IMAGE PROCESSING ******/
|
|
@@ -315,7 +313,6 @@ finger_det_reqs_cb (FpImageDevice *dev, GError *error,
|
|
fpi_usb_transfer_fill_bulk (transfer, EP_IN, FINGER_DETECTION_LEN);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
finger_det_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -547,7 +544,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *device)
|
|
fpi_usb_transfer_fill_bulk (transfer, EP_IN, STRIP_CAPTURE_LEN);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_read_strip_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
}
|
|
}
|
|
diff --git a/libfprint/drivers/aes2550.c b/libfprint/drivers/aes2550.c
|
|
index b95b053..f3f51d6 100644
|
|
--- a/libfprint/drivers/aes2550.c
|
|
+++ b/libfprint/drivers/aes2550.c
|
|
@@ -134,7 +134,6 @@ finger_det_reqs_cb (FpiUsbTransfer *t, FpDevice *device,
|
|
fpi_usb_transfer_fill_bulk (transfer, EP_IN, AES2550_EP_IN_BUF_SIZE);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
finger_det_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -157,7 +156,6 @@ start_finger_detection (FpImageDevice *dev)
|
|
sizeof (finger_det_reqs), NULL);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
finger_det_reqs_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/****** CAPTURE ******/
|
|
@@ -335,7 +333,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_reqs_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -347,7 +344,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_read_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -363,7 +359,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_set_idle_reqs_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
}
|
|
@@ -482,7 +477,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
init_reqs_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -494,7 +488,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
init_read_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -509,7 +502,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
init_reqs_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -521,7 +513,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
calibrate_read_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
}
|
|
diff --git a/libfprint/drivers/aes3k.c b/libfprint/drivers/aes3k.c
|
|
index f73ac02..da3b6a3 100644
|
|
--- a/libfprint/drivers/aes3k.c
|
|
+++ b/libfprint/drivers/aes3k.c
|
|
@@ -142,7 +142,6 @@ do_capture (FpImageDevice *dev)
|
|
fpi_usb_transfer_submit (priv->img_trf, 0,
|
|
fpi_device_get_cancellable (FP_DEVICE (dev)),
|
|
img_cb, NULL);
|
|
- fpi_usb_transfer_unref (priv->img_trf);
|
|
}
|
|
|
|
static void
|
|
diff --git a/libfprint/drivers/aeslib.c b/libfprint/drivers/aeslib.c
|
|
index 8f92d87..4839c62 100644
|
|
--- a/libfprint/drivers/aeslib.c
|
|
+++ b/libfprint/drivers/aeslib.c
|
|
@@ -88,7 +88,6 @@ do_write_regv (FpImageDevice *dev, struct write_regv_data *wdata, int upper_boun
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
write_regv_trf_complete, wdata);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* write the next batch of registers to be written, or if there are no more,
|
|
diff --git a/libfprint/drivers/aesx660.c b/libfprint/drivers/aesx660.c
|
|
index 3f13252..b4d8603 100644
|
|
--- a/libfprint/drivers/aesx660.c
|
|
+++ b/libfprint/drivers/aesx660.c
|
|
@@ -68,7 +68,6 @@ aesX660_send_cmd_timeout (FpiSsm *ssm,
|
|
cmd_len, NULL);
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, timeout, NULL, callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -100,7 +99,6 @@ aesX660_read_response (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
transfer->short_is_error = short_is_error;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, cancel, callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c
|
|
index 5e80be5..e2767dd 100644
|
|
--- a/libfprint/drivers/elan.c
|
|
+++ b/libfprint/drivers/elan.c
|
|
@@ -406,7 +406,6 @@ elan_cmd_read (FpiSsm *ssm, FpDevice *dev)
|
|
cancellable = fpi_device_get_cancellable (dev);
|
|
|
|
fpi_usb_transfer_submit (transfer, self->cmd_timeout, cancellable, elan_cmd_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -449,7 +448,6 @@ elan_run_cmd (FpiSsm *ssm,
|
|
cancellable,
|
|
elan_cmd_cb,
|
|
NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
enum stop_capture_states {
|
|
diff --git a/libfprint/drivers/etes603.c b/libfprint/drivers/etes603.c
|
|
index 55f0139..5cd7f0b 100644
|
|
--- a/libfprint/drivers/etes603.c
|
|
+++ b/libfprint/drivers/etes603.c
|
|
@@ -710,7 +710,6 @@ async_tx (FpDevice *dev, unsigned int ep, void *cb,
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_fill_bulk_full (transfer, ep, buffer, length, NULL);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
|
|
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
|
|
index 4932d01..ccaf60e 100644
|
|
--- a/libfprint/drivers/synaptics/synaptics.c
|
|
+++ b/libfprint/drivers/synaptics/synaptics.c
|
|
@@ -205,7 +205,7 @@ static void
|
|
synaptics_cmd_run_state (FpiSsm *ssm,
|
|
FpDevice *dev)
|
|
{
|
|
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
|
+ FpiUsbTransfer *transfer;
|
|
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (dev);
|
|
|
|
switch (fpi_ssm_get_cur_state (ssm))
|
|
@@ -219,7 +219,7 @@ synaptics_cmd_run_state (FpiSsm *ssm,
|
|
NULL,
|
|
fpi_ssm_usb_transfer_cb,
|
|
NULL);
|
|
- g_clear_pointer (&self->cmd_pending_transfer, fpi_usb_transfer_unref);
|
|
+ self->cmd_pending_transfer = NULL;
|
|
}
|
|
else
|
|
{
|
|
@@ -317,7 +317,7 @@ synaptics_sensor_cmd (FpiDeviceSynaptics *self,
|
|
gssize payload_len,
|
|
SynCmdMsgCallback callback)
|
|
{
|
|
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
|
+ FpiUsbTransfer *transfer;
|
|
guint8 real_seq_num;
|
|
gint msg_len;
|
|
gint res;
|
|
@@ -984,7 +984,6 @@ dev_probe (FpDevice *device)
|
|
transfer->buffer[0] = SENSOR_CMD_GET_VERSION;
|
|
if (!fpi_usb_transfer_submit_sync (transfer, 1000, &error))
|
|
goto err_close;
|
|
- fpi_usb_transfer_unref (transfer);
|
|
|
|
|
|
transfer = fpi_usb_transfer_new (device);
|
|
@@ -1039,7 +1038,6 @@ dev_probe (FpDevice *device)
|
|
fp_dbg ("Target: %d", self->mis_version.target);
|
|
fp_dbg ("Product: %d", self->mis_version.product);
|
|
|
|
- fpi_usb_transfer_unref (transfer);
|
|
|
|
/* We need at least firmware version 10.1, and for 10.1 build 2989158 */
|
|
if (self->mis_version.version_major < 10 ||
|
|
diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c
|
|
index e1cd7e5..f477b83 100644
|
|
--- a/libfprint/drivers/upeksonly.c
|
|
+++ b/libfprint/drivers/upeksonly.c
|
|
@@ -635,7 +635,6 @@ write_regs_iterate (struct write_regs_data *wrdata)
|
|
transfer->short_is_error = TRUE;
|
|
transfer->ssm = wrdata->ssm;
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, write_regs_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
|
|
transfer->buffer[0] = regwrite->value;
|
|
}
|
|
@@ -688,7 +687,6 @@ sm_write_reg (FpiSsm *ssm,
|
|
transfer->short_is_error = TRUE;
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_write_reg_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
|
|
transfer->buffer[0] = value;
|
|
}
|
|
@@ -737,7 +735,6 @@ sm_read_reg (FpiSsm *ssm,
|
|
NULL,
|
|
sm_read_reg_cb,
|
|
NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -782,7 +779,6 @@ sm_await_intr (FpiSsm *ssm,
|
|
fpi_device_get_cancellable (FP_DEVICE (dev)),
|
|
sm_await_intr_cb,
|
|
NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/***** AWAIT FINGER *****/
|
|
@@ -1419,7 +1415,6 @@ dev_activate (FpImageDevice *dev)
|
|
self->deactivating = FALSE;
|
|
self->capturing = FALSE;
|
|
|
|
- self->img_transfers = g_ptr_array_new_full (NUM_BULK_TRANSFERS, (GDestroyNotify) fpi_usb_transfer_unref);
|
|
self->num_flying = 0;
|
|
|
|
for (i = 0; i < self->img_transfers->len; i++)
|
|
diff --git a/libfprint/drivers/upektc.c b/libfprint/drivers/upektc.c
|
|
index e1254ce..92b1930 100644
|
|
--- a/libfprint/drivers/upektc.c
|
|
+++ b/libfprint/drivers/upektc.c
|
|
@@ -128,7 +128,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
write_init_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -142,7 +141,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
read_init_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
}
|
|
@@ -225,7 +223,6 @@ finger_det_cmd_cb (FpiUsbTransfer *t, FpDevice *device,
|
|
IMAGE_SIZE);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
finger_det_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -249,7 +246,6 @@ start_finger_detection (FpImageDevice *dev)
|
|
UPEKTC_CMD_LEN, NULL);
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
finger_det_cmd_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/****** CAPTURE ******/
|
|
@@ -309,7 +305,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_cmd_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
@@ -323,7 +318,6 @@ capture_run_state (FpiSsm *ssm, FpDevice *_dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
capture_read_data_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
}
|
|
diff --git a/libfprint/drivers/upektc_img.c b/libfprint/drivers/upektc_img.c
|
|
index 28a709f..b9724c1 100644
|
|
--- a/libfprint/drivers/upektc_img.c
|
|
+++ b/libfprint/drivers/upektc_img.c
|
|
@@ -100,7 +100,6 @@ upektc_img_submit_req (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -120,7 +119,6 @@ upektc_img_read_data (FpiSsm *ssm,
|
|
NULL);
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/****** CAPTURE ******/
|
|
@@ -557,7 +555,6 @@ activate_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL,
|
|
init_reqs_ctrl_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
break;
|
|
|
|
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
|
|
index 4bc6556..05cd9c5 100644
|
|
--- a/libfprint/drivers/upekts.c
|
|
+++ b/libfprint/drivers/upekts.c
|
|
@@ -226,7 +226,6 @@ busy_ack_retry_read (FpDevice *device, struct read_msg_data *udata)
|
|
transfer->short_is_error = TRUE;
|
|
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, busy_ack_sent_cb, udata);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* Returns 0 if message was handled, 1 if it was a device-busy message, and
|
|
@@ -416,7 +415,6 @@ read_msg_cb (FpiUsbTransfer *transfer, FpDevice *device,
|
|
fpi_usb_transfer_submit (etransfer, TIMEOUT,
|
|
NULL,
|
|
read_msg_extend_cb, udata);
|
|
- fpi_usb_transfer_unref (etransfer);
|
|
return;
|
|
}
|
|
|
|
@@ -442,7 +440,6 @@ __read_msg_async (FpDevice *device, struct read_msg_data *udata)
|
|
|
|
fpi_usb_transfer_fill_bulk_full (transfer, EP_IN, udata->buffer, udata->buflen, NULL);
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, read_msg_cb, udata);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -676,7 +673,6 @@ initsm_send_msg28_handler (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -697,7 +693,6 @@ initsm_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
|
|
case READ_MSG03:
|
|
@@ -709,7 +704,6 @@ initsm_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
|
|
case READ_MSG05:
|
|
@@ -820,7 +814,6 @@ deinitsm_state_handler (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
|
|
case READ_MSG01:;
|
|
@@ -953,7 +946,6 @@ enroll_start_sm_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
|
|
case READ_ENROLL_MSG28:;
|
|
@@ -1205,7 +1197,6 @@ enroll_iterate (FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, enroll_iterate_cmd_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -1319,7 +1310,6 @@ verify_start_sm_run_state (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, fpi_ssm_usb_transfer_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
|
|
break;
|
|
}
|
|
@@ -1519,7 +1509,6 @@ verify_iterate (FpDevice *dev)
|
|
transfer->short_is_error = TRUE;
|
|
|
|
fpi_usb_transfer_submit (transfer, TIMEOUT, NULL, verify_wr2800_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
}
|
|
|
|
diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c
|
|
index 89328d0..7e28724 100644
|
|
--- a/libfprint/drivers/uru4000.c
|
|
+++ b/libfprint/drivers/uru4000.c
|
|
@@ -181,7 +181,6 @@ write_regs (FpImageDevice *dev, uint16_t first_reg,
|
|
num_regs);
|
|
memcpy (transfer->buffer, values, num_regs);
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, callback, user_data);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -207,7 +206,6 @@ read_regs (FpImageDevice *dev, uint16_t first_reg,
|
|
G_USB_DEVICE_RECIPIENT_DEVICE,
|
|
USB_RQ, first_reg, 0, num_regs);
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, callback, user_data);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/*
|
|
@@ -365,7 +363,6 @@ start_irq_handler (FpImageDevice *dev)
|
|
EP_INTR,
|
|
IRQ_LENGTH);
|
|
fpi_usb_transfer_submit (transfer, 0, self->irq_cancellable, irq_handler, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
diff --git a/libfprint/drivers/vcom5s.c b/libfprint/drivers/vcom5s.c
|
|
index edd2dd4..1a2b795 100644
|
|
--- a/libfprint/drivers/vcom5s.c
|
|
+++ b/libfprint/drivers/vcom5s.c
|
|
@@ -103,7 +103,6 @@ sm_write_reg (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_write_reg_cb,
|
|
NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void
|
|
@@ -133,7 +132,6 @@ sm_exec_cmd (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, sm_exec_cmd_cb,
|
|
NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/***** FINGER DETECTION *****/
|
|
@@ -227,7 +225,6 @@ capture_iterate (FpiSsm *ssm,
|
|
NULL);
|
|
|
|
fpi_usb_transfer_submit (transfer, CTRL_TIMEOUT, NULL, capture_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
|
|
diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c
|
|
index 1be272b..43252c0 100644
|
|
--- a/libfprint/drivers/vfs0050.c
|
|
+++ b/libfprint/drivers/vfs0050.c
|
|
@@ -56,7 +56,6 @@ async_write (FpiSsm *ssm,
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
|
async_write_callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* Callback for async_read */
|
|
@@ -108,7 +107,6 @@ async_read (FpiSsm *ssm,
|
|
|
|
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
|
async_read_callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* Callback for async_abort */
|
|
@@ -160,7 +158,6 @@ async_abort (FpDevice *dev, FpiSsm *ssm, int ep)
|
|
|
|
fpi_usb_transfer_submit (transfer, VFS_USB_ABORT_TIMEOUT, NULL,
|
|
async_abort_callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* Image processing functions */
|
|
@@ -564,7 +561,6 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
|
0,
|
|
fpi_device_get_cancellable (dev),
|
|
interrupt_callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
|
|
/* I've put it here to be sure that data is cleared */
|
|
clear_data (self);
|
|
@@ -614,7 +610,6 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, VFS_USB_TIMEOUT, NULL,
|
|
receive_callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
}
|
|
|
|
diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c
|
|
index 9ca1b0a..5dedab7 100644
|
|
--- a/libfprint/drivers/vfs101.c
|
|
+++ b/libfprint/drivers/vfs101.c
|
|
@@ -219,7 +219,6 @@ async_send (FpiSsm *ssm,
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
async_send_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* Callback of asynchronous recv */
|
|
@@ -282,7 +281,6 @@ async_recv (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
async_recv_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
static void async_load (FpiSsm *ssm,
|
|
@@ -369,7 +367,6 @@ async_load (FpiSsm *ssm,
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, BULK_TIMEOUT, NULL,
|
|
async_load_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/* Submit asynchronous sleep */
|
|
diff --git a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
|
|
index 5d02597..103e890 100644
|
|
--- a/libfprint/drivers/vfs301_proto.c
|
|
+++ b/libfprint/drivers/vfs301_proto.c
|
|
@@ -67,8 +67,7 @@ static void
|
|
usb_recv (FpDeviceVfs301 *dev, guint8 endpoint, int max_bytes, FpiUsbTransfer **out, GError **error)
|
|
{
|
|
GError *err = NULL;
|
|
-
|
|
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
|
+ FpiUsbTransfer *transfer;
|
|
|
|
/* XXX: This function swallows any transfer errors, that is obviously
|
|
* quite bad (it used to assert on no-error)! */
|
|
@@ -98,8 +97,7 @@ static void
|
|
usb_send (FpDeviceVfs301 *dev, const guint8 *data, gssize length, GError **error)
|
|
{
|
|
GError *err = NULL;
|
|
-
|
|
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
|
+ FpiUsbTransfer *transfer = NULL;
|
|
|
|
/* XXX: This function swallows any transfer errors, that is obviously
|
|
* quite bad (it used to assert on no-error)! */
|
|
@@ -471,7 +469,7 @@ int
|
|
vfs301_proto_peek_event (FpDeviceVfs301 *dev)
|
|
{
|
|
g_autoptr(GError) error = NULL;
|
|
- g_autoptr(FpiUsbTransfer) transfer = NULL;
|
|
+ FpiUsbTransfer *transfer;
|
|
|
|
const char no_event[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
const char got_event[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00};
|
|
@@ -540,7 +538,6 @@ vfs301_proto_process_event_cb (FpiUsbTransfer *transfer,
|
|
fpi_usb_transfer_fill_bulk (new, VFS301_RECEIVE_ENDPOINT_DATA, VFS301_FP_RECV_LEN_2);
|
|
fpi_usb_transfer_submit (new, VFS301_FP_RECV_TIMEOUT, NULL,
|
|
vfs301_proto_process_event_cb, NULL);
|
|
- fpi_usb_transfer_unref (new);
|
|
return;
|
|
}
|
|
}
|
|
@@ -580,7 +577,6 @@ vfs301_proto_process_event_start (FpDeviceVfs301 *dev)
|
|
fpi_usb_transfer_fill_bulk (transfer, VFS301_RECEIVE_ENDPOINT_DATA, VFS301_FP_RECV_LEN_1);
|
|
fpi_usb_transfer_submit (transfer, VFS301_FP_RECV_TIMEOUT, NULL,
|
|
vfs301_proto_process_event_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
int
|
|
diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c
|
|
index 007e486..dbf8276 100644
|
|
--- a/libfprint/drivers/vfs5011.c
|
|
+++ b/libfprint/drivers/vfs5011.c
|
|
@@ -168,7 +168,6 @@ usbexchange_loop (FpiSsm *ssm, FpDevice *_dev)
|
|
transfer->short_is_error = TRUE;
|
|
fpi_usb_transfer_submit (transfer, data->timeout, NULL,
|
|
async_send_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
|
|
case ACTION_RECEIVE:
|
|
@@ -180,7 +179,6 @@ usbexchange_loop (FpiSsm *ssm, FpDevice *_dev)
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, data->timeout, NULL,
|
|
async_recv_cb, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
break;
|
|
|
|
default:
|
|
@@ -466,7 +464,6 @@ capture_chunk_async (FpDeviceVfs5011 *self,
|
|
transfer->ssm = ssm;
|
|
fpi_usb_transfer_submit (transfer, timeout, fpi_device_get_cancellable (FP_DEVICE (self)),
|
|
chunk_capture_callback, NULL);
|
|
- fpi_usb_transfer_unref (transfer);
|
|
}
|
|
|
|
/*
|
|
diff --git a/libfprint/fpi-usb-transfer.c b/libfprint/fpi-usb-transfer.c
|
|
index 6b29621..64d706f 100644
|
|
--- a/libfprint/fpi-usb-transfer.c
|
|
+++ b/libfprint/fpi-usb-transfer.c
|
|
@@ -356,7 +356,7 @@ transfer_finish_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
|
|
|
|
/**
|
|
* fpi_usb_transfer_submit:
|
|
- * @transfer: The transfer to submit, must have been filled.
|
|
+ * @transfer: (transfer full): The transfer to submit, must have been filled.
|
|
* @timeout_ms: Timeout for the transfer in ms
|
|
* @cancellable: Cancellable to use, e.g. fpi_device_get_cancellable()
|
|
* @callback: Callback on completion or error
|
|
@@ -364,10 +364,9 @@ transfer_finish_cb (GObject *source_object, GAsyncResult *res, gpointer user_dat
|
|
*
|
|
* Submit a USB transfer with a specific timeout and callback functions.
|
|
*
|
|
- * Note that #FpiUsbTransfer is owned by the user. In most cases, you
|
|
- * should call fpi_usb_transfer_unref() just after calling this function.
|
|
- * Doing so means that all associated data will be free'ed automatically
|
|
- * after the callback ran.
|
|
+ * Note that #FpiUsbTransfer will be stolen when this function is called.
|
|
+ * So that all associated data will be free'ed automatically, after the
|
|
+ * callback ran unless fpi_usb_transfer_ref() is explictly called.
|
|
*/
|
|
void
|
|
fpi_usb_transfer_submit (FpiUsbTransfer *transfer,
|
|
@@ -385,11 +384,6 @@ fpi_usb_transfer_submit (FpiUsbTransfer *transfer,
|
|
transfer->callback = callback;
|
|
transfer->user_data = user_data;
|
|
|
|
- /* Grab a reference, this means that one can simply unref after submit and
|
|
- * trust for the data to disappear without explicit management by the callback
|
|
- * function. */
|
|
- fpi_usb_transfer_ref (transfer);
|
|
-
|
|
log_transfer (transfer, TRUE, NULL);
|
|
|
|
switch (transfer->type)
|
|
--
|
|
2.24.1
|
|
|