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.
This commit is contained in:
parent
a855c0cc79
commit
2642fc6560
20 changed files with 10 additions and 87 deletions
|
@ -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;
|
||||
}
|
||||
;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 ||
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue