lib: Rename fpi_ssm_mark_aborted to fpi_ssm_mark_failed
This commit is contained in:
parent
10e934e234
commit
603aab0a81
19 changed files with 252 additions and 252 deletions
|
@ -156,7 +156,7 @@ fpi_ssm_start_subsm
|
||||||
fpi_ssm_next_state
|
fpi_ssm_next_state
|
||||||
fpi_ssm_jump_to_state
|
fpi_ssm_jump_to_state
|
||||||
fpi_ssm_mark_completed
|
fpi_ssm_mark_completed
|
||||||
fpi_ssm_mark_aborted
|
fpi_ssm_mark_failed
|
||||||
fpi_ssm_set_user_data
|
fpi_ssm_set_user_data
|
||||||
fpi_ssm_get_user_data
|
fpi_ssm_get_user_data
|
||||||
fpi_ssm_get_error
|
fpi_ssm_get_error
|
||||||
|
|
|
@ -104,9 +104,9 @@ static void generic_ignore_data_cb(struct libusb_transfer *transfer)
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else if (transfer->length != transfer->actual_length)
|
else if (transfer->length != transfer->actual_length)
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(ssm, result);
|
fpi_ssm_mark_failed(ssm, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read the specified number of bytes from the IN endpoint but throw them
|
/* read the specified number of bytes from the IN endpoint but throw them
|
||||||
|
@ -134,7 +134,7 @@ static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,10 +564,10 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
|
||||||
int sum, i;
|
int sum, i;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
} else if (transfer->length != transfer->actual_length) {
|
} else if (transfer->length != transfer->actual_length) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sum < 0) {
|
if (sum < 0) {
|
||||||
fpi_ssm_mark_aborted(ssm, sum);
|
fpi_ssm_mark_failed(ssm, sum);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
fp_dbg("sum=%d", sum);
|
fp_dbg("sum=%d", sum);
|
||||||
|
@ -672,7 +672,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
|
@ -184,7 +184,7 @@ static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(ssm, result);
|
fpi_ssm_mark_failed(ssm, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that read succeeded but ignore all data */
|
/* check that read succeeded but ignore all data */
|
||||||
|
@ -193,9 +193,9 @@ static void generic_ignore_data_cb(struct libusb_transfer *transfer)
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else if (transfer->length != transfer->actual_length)
|
else if (transfer->length != transfer->actual_length)
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,23 +444,23 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
|
||||||
int threshold;
|
int threshold;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
} else if (transfer->length != transfer->actual_length) {
|
} else if (transfer->length != transfer->actual_length) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
threshold = regval_from_dump(data + 1 + 192*8 + 1 + 16*2 + 1 + 8,
|
threshold = regval_from_dump(data + 1 + 192*8 + 1 + 16*2 + 1 + 8,
|
||||||
AES2501_REG_DATFMT);
|
AES2501_REG_DATFMT);
|
||||||
if (threshold < 0) {
|
if (threshold < 0) {
|
||||||
fpi_ssm_mark_aborted(ssm, threshold);
|
fpi_ssm_mark_failed(ssm, threshold);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
sum = sum_histogram_values(data + 1 + 192*8, threshold & 0x0f);
|
sum = sum_histogram_values(data + 1 + 192*8, threshold & 0x0f);
|
||||||
if (sum < 0) {
|
if (sum < 0) {
|
||||||
fpi_ssm_mark_aborted(ssm, sum);
|
fpi_ssm_mark_failed(ssm, sum);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
fp_dbg("sum=%d", sum);
|
fp_dbg("sum=%d", sum);
|
||||||
|
@ -553,7 +553,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,7 +565,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
@ -717,7 +717,7 @@ void activate_read_regs_cb(struct fp_img_dev *dev, int status,
|
||||||
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
|
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fpi_ssm_mark_aborted(ssm, status);
|
fpi_ssm_mark_failed(ssm, status);
|
||||||
} else {
|
} else {
|
||||||
fp_dbg("reg 0xaf = %x", regs[0x5f]);
|
fp_dbg("reg 0xaf = %x", regs[0x5f]);
|
||||||
if (regs[0x5f] != 0x6b || ++aesdev->read_regs_retry_count == 13)
|
if (regs[0x5f] != 0x6b || ++aesdev->read_regs_retry_count == 13)
|
||||||
|
@ -734,7 +734,7 @@ static void activate_init3_cb(struct fp_img_dev *dev, int result,
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
fpi_ssm_jump_to_state(ssm, READ_REGS);
|
fpi_ssm_jump_to_state(ssm, READ_REGS);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(ssm, result);
|
fpi_ssm_mark_failed(ssm, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void activate_run_state(fpi_ssm *ssm)
|
static void activate_run_state(fpi_ssm *ssm)
|
||||||
|
|
|
@ -237,7 +237,7 @@ static void capture_reqs_cb(struct libusb_transfer *transfer)
|
||||||
(transfer->length == transfer->actual_length)) {
|
(transfer->length == transfer->actual_length)) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
|
||||||
/* marking machine complete will re-trigger finger detection loop */
|
/* marking machine complete will re-trigger finger detection loop */
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fp_dbg("request is not completed, %d", transfer->status);
|
fp_dbg("request is not completed, %d", transfer->status);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
r = process_strip_data(ssm, data);
|
r = process_strip_data(ssm, data);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
fp_dbg("Processing strip data failed: %d", r);
|
fp_dbg("Processing strip data failed: %d", r);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
aesdev->heartbeat_cnt = 0;
|
aesdev->heartbeat_cnt = 0;
|
||||||
|
@ -333,7 +333,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_reqs,
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_reqs,
|
||||||
|
@ -341,7 +341,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -351,7 +351,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -371,7 +371,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_set_idle_reqs,
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_set_idle_reqs,
|
||||||
|
@ -379,7 +379,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -450,7 +450,7 @@ static void init_reqs_cb(struct libusb_transfer *transfer)
|
||||||
(transfer->length == transfer->actual_length)) {
|
(transfer->length == transfer->actual_length)) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ static void init_read_data_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
|
@ -477,7 +477,7 @@ static void calibrate_read_data_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
|
@ -493,7 +493,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, init_reqs,
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, init_reqs,
|
||||||
|
@ -501,7 +501,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -511,7 +511,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -531,7 +531,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, calibrate_reqs,
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, calibrate_reqs,
|
||||||
|
@ -539,7 +539,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -549,7 +549,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void aesX660_send_cmd_timeout(fpi_ssm *ssm, const unsigned char *cmd,
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static void aesX660_send_cmd_timeout(fpi_ssm *ssm, const unsigned char *cmd,
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
fp_dbg("failed to submit transfer\n");
|
fp_dbg("failed to submit transfer\n");
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ static void aesX660_read_response(fpi_ssm *ssm, size_t buf_len,
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ static void aesX660_read_response(fpi_ssm *ssm, size_t buf_len,
|
||||||
fp_dbg("Failed to submit rx transfer: %d\n", r);
|
fp_dbg("Failed to submit rx transfer: %d\n", r);
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ static void aesX660_send_cmd_cb(struct libusb_transfer *transfer)
|
||||||
} else {
|
} else {
|
||||||
fp_dbg("tx transfer status: %d, actual_len: %.4x\n",
|
fp_dbg("tx transfer status: %d, actual_len: %.4x\n",
|
||||||
transfer->status, transfer->actual_length);
|
transfer->status, transfer->actual_length);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -115,13 +115,13 @@ static void aesX660_read_calibrate_data_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
||||||
(transfer->length != transfer->actual_length)) {
|
(transfer->length != transfer->actual_length)) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* Calibrate response was read correctly? */
|
/* Calibrate response was read correctly? */
|
||||||
if (data[AESX660_RESPONSE_TYPE_OFFSET] != AESX660_CALIBRATE_RESPONSE) {
|
if (data[AESX660_RESPONSE_TYPE_OFFSET] != AESX660_CALIBRATE_RESPONSE) {
|
||||||
fp_dbg("Bogus calibrate response: %.2x\n", data[0]);
|
fp_dbg("Bogus calibrate response: %.2x\n", data[0]);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,13 +159,13 @@ static void finger_det_read_fd_data_cb(struct libusb_transfer *transfer)
|
||||||
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
||||||
(transfer->length != transfer->actual_length)) {
|
(transfer->length != transfer->actual_length)) {
|
||||||
fp_dbg("Failed to read FD data\n");
|
fp_dbg("Failed to read FD data\n");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data[AESX660_RESPONSE_TYPE_OFFSET] != AESX660_FINGER_DET_RESPONSE) {
|
if (data[AESX660_RESPONSE_TYPE_OFFSET] != AESX660_FINGER_DET_RESPONSE) {
|
||||||
fp_dbg("Bogus FD response: %.2x\n", data[0]);
|
fp_dbg("Bogus FD response: %.2x\n", data[0]);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ static void finger_det_set_idle_cmd_cb(struct libusb_transfer *transfer)
|
||||||
(transfer->length == transfer->actual_length)) {
|
(transfer->length == transfer->actual_length)) {
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ static void capture_set_idle_cmd_cb(struct libusb_transfer *transfer)
|
||||||
fpi_imgdev_report_finger_status(dev, FALSE);
|
fpi_imgdev_report_finger_status(dev, FALSE);
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ static void capture_read_stripe_data_cb(struct libusb_transfer *transfer)
|
||||||
size_t copied, actual_len = transfer->actual_length;
|
size_t copied, actual_len = transfer->actual_length;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ static void activate_read_id_cb(struct libusb_transfer *transfer)
|
||||||
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
||||||
(transfer->length != transfer->actual_length)) {
|
(transfer->length != transfer->actual_length)) {
|
||||||
fp_dbg("read_id cmd failed\n");
|
fp_dbg("read_id cmd failed\n");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* ID was read correctly */
|
/* ID was read correctly */
|
||||||
|
@ -465,7 +465,7 @@ static void activate_read_id_cb(struct libusb_transfer *transfer)
|
||||||
data[4], data[3], data[5], data[6], data[7]);
|
data[4], data[3], data[5], data[6], data[7]);
|
||||||
} else {
|
} else {
|
||||||
fp_dbg("Bogus read ID response: %.2x\n", data[AESX660_RESPONSE_TYPE_OFFSET]);
|
fp_dbg("Bogus read ID response: %.2x\n", data[AESX660_RESPONSE_TYPE_OFFSET]);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ static void activate_read_id_cb(struct libusb_transfer *transfer)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fp_dbg("Failed to init device! init status: %.2x\n", data[7]);
|
fp_dbg("Failed to init device! init status: %.2x\n", data[7]);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -509,14 +509,14 @@ static void activate_read_init_cb(struct libusb_transfer *transfer)
|
||||||
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
||||||
(transfer->length != transfer->actual_length)) {
|
(transfer->length != transfer->actual_length)) {
|
||||||
fp_dbg("read_init transfer status: %d, actual_len: %d\n", transfer->status, transfer->actual_length);
|
fp_dbg("read_init transfer status: %d, actual_len: %d\n", transfer->status, transfer->actual_length);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/* ID was read correctly */
|
/* ID was read correctly */
|
||||||
if (data[0] != 0x42 || data[3] != 0x01) {
|
if (data[0] != 0x42 || data[3] != 0x01) {
|
||||||
fp_dbg("Bogus read init response: %.2x %.2x\n", data[0],
|
fp_dbg("Bogus read init response: %.2x %.2x\n", data[0],
|
||||||
data[3]);
|
data[3]);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
aesdev->init_cmd_idx++;
|
aesdev->init_cmd_idx++;
|
||||||
|
|
|
@ -335,7 +335,7 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
|
||||||
fp_dbg("transfer length error: expected %d, got %d",
|
fp_dbg("transfer length error: expected %d, got %d",
|
||||||
transfer->length, transfer->actual_length);
|
transfer->length, transfer->actual_length);
|
||||||
elan_dev_reset(elandev);
|
elan_dev_reset(elandev);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
} else if (transfer->endpoint & LIBUSB_ENDPOINT_IN) {
|
} else if (transfer->endpoint & LIBUSB_ENDPOINT_IN) {
|
||||||
/* just finished receiving */
|
/* just finished receiving */
|
||||||
dbg_buf(elandev->last_read, transfer->actual_length);
|
dbg_buf(elandev->last_read, transfer->actual_length);
|
||||||
|
@ -348,17 +348,17 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
|
||||||
break;
|
break;
|
||||||
case LIBUSB_TRANSFER_CANCELLED:
|
case LIBUSB_TRANSFER_CANCELLED:
|
||||||
fp_dbg("transfer cancelled");
|
fp_dbg("transfer cancelled");
|
||||||
fpi_ssm_mark_aborted(ssm, -ECANCELED);
|
fpi_ssm_mark_failed(ssm, -ECANCELED);
|
||||||
elan_deactivate(dev);
|
elan_deactivate(dev);
|
||||||
break;
|
break;
|
||||||
case LIBUSB_TRANSFER_TIMED_OUT:
|
case LIBUSB_TRANSFER_TIMED_OUT:
|
||||||
fp_dbg("transfer timed out");
|
fp_dbg("transfer timed out");
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIMEDOUT);
|
fpi_ssm_mark_failed(ssm, -ETIMEDOUT);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fp_dbg("transfer failed: %d", transfer->status);
|
fp_dbg("transfer failed: %d", transfer->status);
|
||||||
elan_dev_reset(elandev);
|
elan_dev_reset(elandev);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ static void elan_cmd_read(fpi_ssm *ssm)
|
||||||
|
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elandev->cur_transfer = transfer;
|
elandev->cur_transfer = transfer;
|
||||||
|
@ -398,7 +398,7 @@ static void elan_cmd_read(fpi_ssm *ssm)
|
||||||
transfer->flags = LIBUSB_TRANSFER_FREE_TRANSFER;
|
transfer->flags = LIBUSB_TRANSFER_FREE_TRANSFER;
|
||||||
int r = libusb_submit_transfer(transfer);
|
int r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void elan_run_cmd(fpi_ssm *ssm, const struct elan_cmd *cmd,
|
static void elan_run_cmd(fpi_ssm *ssm, const struct elan_cmd *cmd,
|
||||||
|
@ -421,7 +421,7 @@ static void elan_run_cmd(fpi_ssm *ssm, const struct elan_cmd *cmd,
|
||||||
|
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elandev->cur_transfer = transfer;
|
elandev->cur_transfer = transfer;
|
||||||
|
@ -432,7 +432,7 @@ static void elan_run_cmd(fpi_ssm *ssm, const struct elan_cmd *cmd,
|
||||||
transfer->flags = LIBUSB_TRANSFER_FREE_TRANSFER;
|
transfer->flags = LIBUSB_TRANSFER_FREE_TRANSFER;
|
||||||
int r = libusb_submit_transfer(transfer);
|
int r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum stop_capture_states {
|
enum stop_capture_states {
|
||||||
|
@ -521,12 +521,12 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
fpi_imgdev_report_finger_status(dev, TRUE);
|
fpi_imgdev_report_finger_status(dev, TRUE);
|
||||||
elan_run_cmd(ssm, &get_image_cmd, ELAN_CMD_TIMEOUT);
|
elan_run_cmd(ssm, &get_image_cmd, ELAN_CMD_TIMEOUT);
|
||||||
} else
|
} else
|
||||||
fpi_ssm_mark_aborted(ssm, -EBADMSG);
|
fpi_ssm_mark_failed(ssm, -EBADMSG);
|
||||||
break;
|
break;
|
||||||
case CAPTURE_CHECK_ENOUGH_FRAMES:
|
case CAPTURE_CHECK_ENOUGH_FRAMES:
|
||||||
r = elan_save_img_frame(elandev);
|
r = elan_save_img_frame(elandev);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
else if (elandev->num_frames < ELAN_MAX_FRAMES) {
|
else if (elandev->num_frames < ELAN_MAX_FRAMES) {
|
||||||
/* quickly stop if finger is removed */
|
/* quickly stop if finger is removed */
|
||||||
elandev->cmd_timeout = ELAN_FINGER_TIMEOUT;
|
elandev->cmd_timeout = ELAN_FINGER_TIMEOUT;
|
||||||
|
@ -660,7 +660,7 @@ static void calibrate_run_state(fpi_ssm *ssm)
|
||||||
ELAN_CMD_TIMEOUT);
|
ELAN_CMD_TIMEOUT);
|
||||||
else {
|
else {
|
||||||
fp_dbg("calibration failed");
|
fp_dbg("calibration failed");
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CALIBRATE_CHECK_STATUS:
|
case CALIBRATE_CHECK_STATUS:
|
||||||
|
@ -680,7 +680,7 @@ static void calibrate_run_state(fpi_ssm *ssm)
|
||||||
&& elandev->last_read[0] == 0x01)
|
&& elandev->last_read[0] == 0x01)
|
||||||
elandev->calib_status = 0x01;
|
elandev->calib_status = 0x01;
|
||||||
if (!fpi_timeout_add(50, fpi_ssm_next_state_async, ssm))
|
if (!fpi_timeout_add(50, fpi_ssm_next_state_async, ssm))
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIME);
|
fpi_ssm_mark_failed(ssm, -ETIME);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CALIBRATE_REPEAT_STATUS:
|
case CALIBRATE_REPEAT_STATUS:
|
||||||
|
|
|
@ -676,7 +676,7 @@ static void async_tx_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fp_warn("transfer is not completed (status=%d)",
|
fp_warn("transfer is not completed (status=%d)",
|
||||||
transfer->status);
|
transfer->status);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
} else {
|
} else {
|
||||||
unsigned char endpoint = transfer->endpoint;
|
unsigned char endpoint = transfer->endpoint;
|
||||||
|
@ -691,7 +691,7 @@ static void async_tx_cb(struct libusb_transfer *transfer)
|
||||||
length, actual_length);
|
length, actual_length);
|
||||||
/* Chained with the answer */
|
/* Chained with the answer */
|
||||||
if (async_tx(idev, EP_IN, async_tx_cb, ssm))
|
if (async_tx(idev, EP_IN, async_tx_cb, ssm))
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
} else if (endpoint == EP_IN) {
|
} else if (endpoint == EP_IN) {
|
||||||
dev->ans_len = actual_length;
|
dev->ans_len = actual_length;
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
@ -724,7 +724,7 @@ static void m_exit_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void m_exit_complete(fpi_ssm *ssm)
|
static void m_exit_complete(fpi_ssm *ssm)
|
||||||
|
@ -827,7 +827,7 @@ static void m_capture_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void m_capture_complete(fpi_ssm *ssm)
|
static void m_capture_complete(fpi_ssm *ssm)
|
||||||
|
@ -945,7 +945,7 @@ static void m_finger_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void m_finger_complete(fpi_ssm *ssm)
|
static void m_finger_complete(fpi_ssm *ssm)
|
||||||
|
@ -1131,7 +1131,7 @@ static void m_tunevrb_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void m_tunevrb_complete(fpi_ssm *ssm)
|
static void m_tunevrb_complete(fpi_ssm *ssm)
|
||||||
|
@ -1255,7 +1255,7 @@ static void m_tunedc_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ static void m_init_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
err:
|
err:
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ static void last_transfer_killed(struct fp_img_dev *dev)
|
||||||
switch (sdev->killing_transfers) {
|
switch (sdev->killing_transfers) {
|
||||||
case ABORT_SSM:
|
case ABORT_SSM:
|
||||||
fp_dbg("abort ssm error %d", sdev->kill_status_code);
|
fp_dbg("abort ssm error %d", sdev->kill_status_code);
|
||||||
fpi_ssm_mark_aborted(sdev->kill_ssm, sdev->kill_status_code);
|
fpi_ssm_mark_failed(sdev->kill_ssm, sdev->kill_status_code);
|
||||||
return;
|
return;
|
||||||
case ITERATE_SSM:
|
case ITERATE_SSM:
|
||||||
fp_dbg("iterate ssm");
|
fp_dbg("iterate ssm");
|
||||||
|
@ -534,7 +534,7 @@ static void write_regs_finished(struct write_regs_data *wrdata, int result)
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
fpi_ssm_next_state(wrdata->ssm);
|
fpi_ssm_next_state(wrdata->ssm);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(wrdata->ssm, result);
|
fpi_ssm_mark_failed(wrdata->ssm, result);
|
||||||
g_free(wrdata);
|
g_free(wrdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ static void sm_write_regs(fpi_ssm *ssm,
|
||||||
wrdata->transfer = libusb_alloc_transfer(0);
|
wrdata->transfer = libusb_alloc_transfer(0);
|
||||||
if (!wrdata->transfer) {
|
if (!wrdata->transfer) {
|
||||||
g_free(wrdata);
|
g_free(wrdata);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ static void sm_write_reg_cb(struct libusb_transfer *transfer)
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ static void sm_write_reg(fpi_ssm *ssm, uint8_t reg, uint8_t value)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ static void sm_write_reg(fpi_ssm *ssm, uint8_t reg, uint8_t value)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ static void sm_read_reg_cb(struct libusb_transfer *transfer)
|
||||||
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
|
struct sonly_dev *sdev = fpi_imgdev_get_user_data(dev);
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
} else {
|
} else {
|
||||||
sdev->read_reg_result = libusb_control_transfer_get_data(transfer)[0];
|
sdev->read_reg_result = libusb_control_transfer_get_data(transfer)[0];
|
||||||
fp_dbg("read reg result = %02x", sdev->read_reg_result);
|
fp_dbg("read reg result = %02x", sdev->read_reg_result);
|
||||||
|
@ -670,7 +670,7 @@ static void sm_read_reg(fpi_ssm *ssm, uint8_t reg)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ static void sm_read_reg(fpi_ssm *ssm, uint8_t reg)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ static void sm_await_intr_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
fpi_ssm_mark_aborted(ssm, transfer->status);
|
fpi_ssm_mark_failed(ssm, transfer->status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,7 +721,7 @@ static void sm_await_intr(fpi_ssm *ssm)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ static void sm_await_intr(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
g_free(data);
|
g_free(data);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +861,7 @@ static void capsm_fire_bulk(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
/* first one failed: easy peasy */
|
/* first one failed: easy peasy */
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ static void write_init_cb(struct libusb_transfer *transfer)
|
||||||
else
|
else
|
||||||
upektc_next_init_cmd(ssm);
|
upektc_next_init_cmd(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ static void read_init_data_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED)
|
||||||
upektc_next_init_cmd(ssm);
|
upektc_next_init_cmd(ssm);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
|
||||||
|
@ -118,7 +118,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -128,7 +128,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -289,7 +289,7 @@ static void capture_cmd_cb(struct libusb_transfer *transfer)
|
||||||
(transfer->length == transfer->actual_length)) {
|
(transfer->length == transfer->actual_length)) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -303,11 +303,11 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fp_dbg("request is not completed, %d", transfer->status);
|
fp_dbg("request is not completed, %d", transfer->status);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
} else if (transfer->length != transfer->actual_length) {
|
} else if (transfer->length != transfer->actual_length) {
|
||||||
fp_dbg("expected %d, sent %d bytes", transfer->length, transfer->actual_length);
|
fp_dbg("expected %d, sent %d bytes", transfer->length, transfer->actual_length);
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), upekdev->ep_out,
|
||||||
|
@ -341,7 +341,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -351,7 +351,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ static void capture_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void upektc_img_submit_req(fpi_ssm *ssm,
|
||||||
BUG_ON(buf_size > MAX_CMD_SIZE);
|
BUG_ON(buf_size > MAX_CMD_SIZE);
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ static void upektc_img_submit_req(fpi_ssm *ssm,
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ static void upektc_img_read_data(fpi_ssm *ssm, size_t buf_size, size_t buf_offse
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ static void upektc_img_read_data(fpi_ssm *ssm, size_t buf_size, size_t buf_offse
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ static void capture_reqs_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
||||||
(transfer->length != transfer->actual_length)) {
|
(transfer->length != transfer->actual_length)) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||||
|
@ -190,7 +190,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fp_dbg("request is not completed, %d", transfer->status);
|
fp_dbg("request is not completed, %d", transfer->status);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fp_err("Uknown response!\n");
|
fp_err("Uknown response!\n");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -300,7 +300,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fp_err("Not handled response!\n");
|
fp_err("Not handled response!\n");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ static void deactivate_reqs_cb(struct libusb_transfer *transfer)
|
||||||
(transfer->length == transfer->actual_length)) {
|
(transfer->length == transfer->actual_length)) {
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA);
|
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ static void deactivate_read_data_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ static void init_reqs_ctrl_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ static void init_reqs_cb(struct libusb_transfer *transfer)
|
||||||
(transfer->length == transfer->actual_length)) {
|
(transfer->length == transfer->actual_length)) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ static void init_read_data_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
transfer = libusb_alloc_transfer(0);
|
transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER |
|
transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER |
|
||||||
|
@ -531,7 +531,7 @@ static void activate_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -494,15 +494,15 @@ static void initsm_read_msg_response_cb(fpi_ssm *ssm,
|
||||||
if (status != READ_MSG_RESPONSE) {
|
if (status != READ_MSG_RESPONSE) {
|
||||||
fp_err("expected response, got %d seq=%x in state %d", status, seq,
|
fp_err("expected response, got %d seq=%x in state %d", status, seq,
|
||||||
fpi_ssm_get_cur_state(ssm));
|
fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else if (subcmd != expect_subcmd) {
|
} else if (subcmd != expect_subcmd) {
|
||||||
fp_warn("expected response to subcmd 0x%02x, got response to %02x in "
|
fp_warn("expected response to subcmd 0x%02x, got response to %02x in "
|
||||||
"state %d", expect_subcmd, subcmd, fpi_ssm_get_cur_state(ssm));
|
"state %d", expect_subcmd, subcmd, fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else if (seq != upekdev->seq) {
|
} else if (seq != upekdev->seq) {
|
||||||
fp_err("expected response to cmd seq=%02x, got response to %02x "
|
fp_err("expected response to cmd seq=%02x, got response to %02x "
|
||||||
"in state %d", upekdev->seq, seq, fpi_ssm_get_cur_state(ssm));
|
"in state %d", upekdev->seq, seq, fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else {
|
} else {
|
||||||
fp_dbg("state %d completed", fpi_ssm_get_cur_state(ssm));
|
fp_dbg("state %d completed", fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
@ -556,19 +556,19 @@ static void initsm_read_msg_cmd_cb(fpi_ssm *ssm,
|
||||||
struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
|
struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
|
||||||
|
|
||||||
if (status == READ_MSG_ERROR) {
|
if (status == READ_MSG_ERROR) {
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
return;
|
return;
|
||||||
} else if (status != READ_MSG_CMD) {
|
} else if (status != READ_MSG_CMD) {
|
||||||
fp_err("expected command, got %d seq=%x in state %d", status, seq,
|
fp_err("expected command, got %d seq=%x in state %d", status, seq,
|
||||||
fpi_ssm_get_cur_state(ssm));
|
fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
upekdev->seq = seq;
|
upekdev->seq = seq;
|
||||||
if (seq != expect_seq) {
|
if (seq != expect_seq) {
|
||||||
fp_err("expected seq=%x, got %x in state %d", expect_seq, seq,
|
fp_err("expected seq=%x, got %x in state %d", expect_seq, seq,
|
||||||
fpi_ssm_get_cur_state(ssm));
|
fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ static void ctrl400_cb(struct libusb_transfer *transfer)
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status == LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ static void initsm_read_msg_handler(fpi_ssm *ssm,
|
||||||
int r = read_msg_async(fpi_ssm_get_dev(ssm), callback, ssm);
|
int r = read_msg_async(fpi_ssm_get_dev(ssm), callback, ssm);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
fp_err("async read msg failed in state %d", fpi_ssm_get_cur_state(ssm));
|
fp_err("async read msg failed in state %d", fpi_ssm_get_cur_state(ssm));
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ static void initsm_send_msg_cb(struct libusb_transfer *transfer)
|
||||||
} else {
|
} else {
|
||||||
fp_err("failed, state=%d rqlength=%d actual_length=%d", fpi_ssm_get_cur_state(ssm),
|
fp_err("failed, state=%d rqlength=%d actual_length=%d", fpi_ssm_get_cur_state(ssm),
|
||||||
transfer->length, transfer->actual_length);
|
transfer->length, transfer->actual_length);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
}
|
}
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ static void initsm_send_msg28_handler(fpi_ssm *ssm,
|
||||||
transfer = alloc_send_cmd28_transfer(dev, subcmd, data, innerlen,
|
transfer = alloc_send_cmd28_transfer(dev, subcmd, data, innerlen,
|
||||||
initsm_send_msg_cb, ssm);
|
initsm_send_msg_cb, ssm);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +645,7 @@ static void initsm_send_msg28_handler(fpi_ssm *ssm,
|
||||||
fp_err("urb submission failed error %d in state %d", r, fpi_ssm_get_cur_state(ssm));
|
fp_err("urb submission failed error %d in state %d", r, fpi_ssm_get_cur_state(ssm));
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ static void initsm_run_state(fpi_ssm *ssm)
|
||||||
|
|
||||||
transfer = libusb_alloc_transfer(0);
|
transfer = libusb_alloc_transfer(0);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ static void initsm_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_MSG03:
|
case READ_MSG03:
|
||||||
|
@ -686,7 +686,7 @@ static void initsm_run_state(fpi_ssm *ssm)
|
||||||
transfer = alloc_send_cmdresponse_transfer(dev, ++upekdev->seq,
|
transfer = alloc_send_cmdresponse_transfer(dev, ++upekdev->seq,
|
||||||
init_resp03, sizeof(init_resp03), initsm_send_msg_cb, ssm);
|
init_resp03, sizeof(init_resp03), initsm_send_msg_cb, ssm);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ static void initsm_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_MSG05:
|
case READ_MSG05:
|
||||||
|
@ -751,9 +751,9 @@ static void send_resp07_cb(struct libusb_transfer *transfer)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else if (transfer->length != transfer->actual_length)
|
else if (transfer->length != transfer->actual_length)
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
|
@ -767,17 +767,17 @@ static void read_msg01_cb(struct fp_dev *dev, enum read_msg_status status,
|
||||||
struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
|
struct upekts_dev *upekdev = fpi_dev_get_user_data(dev);
|
||||||
|
|
||||||
if (status == READ_MSG_ERROR) {
|
if (status == READ_MSG_ERROR) {
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
return;
|
return;
|
||||||
} else if (status != READ_MSG_CMD) {
|
} else if (status != READ_MSG_CMD) {
|
||||||
fp_err("expected command, got %d seq=%x", status, seq);
|
fp_err("expected command, got %d seq=%x", status, seq);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
upekdev->seq = seq;
|
upekdev->seq = seq;
|
||||||
if (seq != 1) {
|
if (seq != 1) {
|
||||||
fp_err("expected seq=1, got %x", seq);
|
fp_err("expected seq=1, got %x", seq);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ static void deinitsm_state_handler(fpi_ssm *ssm)
|
||||||
transfer = alloc_send_cmdresponse_transfer(dev, 0x07, &dummy, 1,
|
transfer = alloc_send_cmdresponse_transfer(dev, 0x07, &dummy, 1,
|
||||||
send_resp07_cb, ssm);
|
send_resp07_cb, ssm);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,13 +805,13 @@ static void deinitsm_state_handler(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_MSG01: ;
|
case READ_MSG01: ;
|
||||||
r = read_msg_async(dev, read_msg01_cb, ssm);
|
r = read_msg_async(dev, read_msg01_cb, ssm);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -875,7 +875,7 @@ static void enroll_start_sm_cb_initsm(fpi_ssm *initsm)
|
||||||
|
|
||||||
fpi_ssm_free(initsm);
|
fpi_ssm_free(initsm);
|
||||||
if (error)
|
if (error)
|
||||||
fpi_ssm_mark_aborted(enroll_start_ssm, error);
|
fpi_ssm_mark_failed(enroll_start_ssm, error);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(enroll_start_ssm);
|
fpi_ssm_next_state(enroll_start_ssm);
|
||||||
}
|
}
|
||||||
|
@ -885,9 +885,9 @@ static void enroll_start_sm_cb_init(struct libusb_transfer *transfer)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else if (transfer->length != transfer->actual_length)
|
else if (transfer->length != transfer->actual_length)
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
|
@ -902,15 +902,15 @@ static void enroll_start_sm_cb_msg28(struct fp_dev *dev,
|
||||||
|
|
||||||
if (status != READ_MSG_RESPONSE) {
|
if (status != READ_MSG_RESPONSE) {
|
||||||
fp_err("expected response, got %d seq=%x", status, seq);
|
fp_err("expected response, got %d seq=%x", status, seq);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else if (subcmd != 0) {
|
} else if (subcmd != 0) {
|
||||||
fp_warn("expected response to subcmd 0, got response to %02x",
|
fp_warn("expected response to subcmd 0, got response to %02x",
|
||||||
subcmd);
|
subcmd);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else if (seq != upekdev->seq) {
|
} else if (seq != upekdev->seq) {
|
||||||
fp_err("expected response to cmd seq=%02x, got response to %02x",
|
fp_err("expected response to cmd seq=%02x, got response to %02x",
|
||||||
upekdev->seq, seq);
|
upekdev->seq, seq);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
}
|
}
|
||||||
|
@ -932,7 +932,7 @@ static void enroll_start_sm_run_state(fpi_ssm *ssm)
|
||||||
transfer = alloc_send_cmd28_transfer(dev, 0x02, enroll_init,
|
transfer = alloc_send_cmd28_transfer(dev, 0x02, enroll_init,
|
||||||
sizeof(enroll_init), enroll_start_sm_cb_init, ssm);
|
sizeof(enroll_init), enroll_start_sm_cb_init, ssm);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ static void enroll_start_sm_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_ENROLL_MSG28: ;
|
case READ_ENROLL_MSG28: ;
|
||||||
|
@ -950,7 +950,7 @@ static void enroll_start_sm_run_state(fpi_ssm *ssm)
|
||||||
* include a 30 01 poll somewhere? */
|
* include a 30 01 poll somewhere? */
|
||||||
r = read_msg_async(dev, enroll_start_sm_cb_msg28, ssm);
|
r = read_msg_async(dev, enroll_start_sm_cb_msg28, ssm);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1183,7 @@ static void verify_start_sm_cb_initsm(fpi_ssm *initsm)
|
||||||
|
|
||||||
err = fpi_ssm_get_error(initsm);
|
err = fpi_ssm_get_error(initsm);
|
||||||
if (err)
|
if (err)
|
||||||
fpi_ssm_mark_aborted(verify_start_ssm, err);
|
fpi_ssm_mark_failed(verify_start_ssm, err);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(verify_start_ssm);
|
fpi_ssm_next_state(verify_start_ssm);
|
||||||
fpi_ssm_free(initsm);
|
fpi_ssm_free(initsm);
|
||||||
|
@ -1193,9 +1193,9 @@ static void verify_init_2803_cb(struct libusb_transfer *transfer)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else if (transfer->length != transfer->actual_length)
|
else if (transfer->length != transfer->actual_length)
|
||||||
fpi_ssm_mark_aborted(ssm, -EPROTO);
|
fpi_ssm_mark_failed(ssm, -EPROTO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
|
@ -1225,7 +1225,7 @@ static void verify_start_sm_run_state(fpi_ssm *ssm)
|
||||||
verify_init_2803_cb, ssm);
|
verify_init_2803_cb, ssm);
|
||||||
g_free(data);
|
g_free(data);
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1233,7 +1233,7 @@ static void verify_start_sm_run_state(fpi_ssm *ssm)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(transfer->buffer);
|
g_free(transfer->buffer);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ static void response_cb(struct fp_img_dev *dev, int status, void *user_data)
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
else
|
else
|
||||||
fpi_ssm_mark_aborted(ssm, status);
|
fpi_ssm_mark_failed(ssm, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void challenge_cb(struct fp_img_dev *dev, int status,
|
static void challenge_cb(struct fp_img_dev *dev, int status,
|
||||||
|
@ -324,7 +324,7 @@ static void challenge_cb(struct fp_img_dev *dev, int status,
|
||||||
|
|
||||||
r = status;
|
r = status;
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fpi_ssm_mark_aborted(ssm, status);
|
fpi_ssm_mark_failed(ssm, status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ static void challenge_cb(struct fp_img_dev *dev, int status,
|
||||||
g_free(respdata);
|
g_free(respdata);
|
||||||
}
|
}
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -362,7 +362,7 @@ static void sm_do_challenge_response(fpi_ssm *ssm)
|
||||||
G_DEBUG_HERE();
|
G_DEBUG_HERE();
|
||||||
r = read_regs(dev, REG_CHALLENGE, CR_LENGTH, challenge_cb, ssm);
|
r = read_regs(dev, REG_CHALLENGE, CR_LENGTH, challenge_cb, ssm);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** INTERRUPT HANDLING *****/
|
/***** INTERRUPT HANDLING *****/
|
||||||
|
@ -511,7 +511,7 @@ static void sm_write_reg_cb(struct fp_img_dev *dev, int result, void *user_data)
|
||||||
fpi_ssm *ssm = user_data;
|
fpi_ssm *ssm = user_data;
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
fpi_ssm_mark_aborted(ssm, result);
|
fpi_ssm_mark_failed(ssm, result);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ static void sm_write_regs(fpi_ssm *ssm, uint16_t first_reg, uint16_t num_regs,
|
||||||
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
|
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
|
||||||
int r = write_regs(dev, first_reg, num_regs, data, sm_write_reg_cb, ssm);
|
int r = write_regs(dev, first_reg, num_regs, data, sm_write_reg_cb, ssm);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm_write_reg(fpi_ssm *ssm, uint16_t reg,
|
static void sm_write_reg(fpi_ssm *ssm, uint16_t reg,
|
||||||
|
@ -538,7 +538,7 @@ static void sm_read_reg_cb(struct fp_img_dev *dev, int result,
|
||||||
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
|
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
fpi_ssm_mark_aborted(ssm, result);
|
fpi_ssm_mark_failed(ssm, result);
|
||||||
} else {
|
} else {
|
||||||
memcpy(urudev->last_reg_rd, data, num_regs);
|
memcpy(urudev->last_reg_rd, data, num_regs);
|
||||||
fp_dbg("reg value %x", urudev->last_reg_rd[0]);
|
fp_dbg("reg value %x", urudev->last_reg_rd[0]);
|
||||||
|
@ -553,14 +553,14 @@ static void sm_read_regs(fpi_ssm *ssm, uint16_t reg, uint16_t num_regs)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (num_regs > sizeof(urudev->last_reg_rd)) {
|
if (num_regs > sizeof(urudev->last_reg_rd)) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fp_dbg("read %d regs at %x", num_regs, reg);
|
fp_dbg("read %d regs at %x", num_regs, reg);
|
||||||
r = read_regs(dev, reg, num_regs, sm_read_reg_cb, ssm);
|
r = read_regs(dev, reg, num_regs, sm_read_reg_cb, ssm);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sm_read_reg(fpi_ssm *ssm, uint16_t reg)
|
static void sm_read_reg(fpi_ssm *ssm, uint16_t reg)
|
||||||
|
@ -591,10 +591,10 @@ static void image_transfer_cb(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
|
if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
|
||||||
fp_dbg("cancelled");
|
fp_dbg("cancelled");
|
||||||
fpi_ssm_mark_aborted(ssm, -ECANCELED);
|
fpi_ssm_mark_failed(ssm, -ECANCELED);
|
||||||
} else if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
} else if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fp_dbg("error");
|
fp_dbg("error");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
}
|
}
|
||||||
|
@ -706,7 +706,7 @@ static void imaging_run_state(fpi_ssm *ssm)
|
||||||
urudev->img_data, sizeof(struct uru4k_image), image_transfer_cb, ssm, 0);
|
urudev->img_data, sizeof(struct uru4k_image), image_transfer_cb, ssm, 0);
|
||||||
r = libusb_submit_transfer(urudev->img_transfer);
|
r = libusb_submit_transfer(urudev->img_transfer);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
break;
|
break;
|
||||||
case IMAGING_SEND_INDEX:
|
case IMAGING_SEND_INDEX:
|
||||||
fp_dbg("hw header lines %d", img->num_lines);
|
fp_dbg("hw header lines %d", img->num_lines);
|
||||||
|
@ -868,7 +868,7 @@ static void rebootpwr_pause_cb(void *data)
|
||||||
|
|
||||||
if (!--urudev->rebootpwr_ctr) {
|
if (!--urudev->rebootpwr_ctr) {
|
||||||
fp_err("could not reboot device power");
|
fp_err("could not reboot device power");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_jump_to_state(ssm, REBOOTPWR_GET_HWSTAT);
|
fpi_ssm_jump_to_state(ssm, REBOOTPWR_GET_HWSTAT);
|
||||||
}
|
}
|
||||||
|
@ -896,7 +896,7 @@ static void rebootpwr_run_state(fpi_ssm *ssm)
|
||||||
break;
|
break;
|
||||||
case REBOOTPWR_PAUSE:
|
case REBOOTPWR_PAUSE:
|
||||||
if (fpi_timeout_add(10, rebootpwr_pause_cb, ssm) == NULL)
|
if (fpi_timeout_add(10, rebootpwr_pause_cb, ssm) == NULL)
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIME);
|
fpi_ssm_mark_failed(ssm, -ETIME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ static void powerup_pause_cb(void *data)
|
||||||
|
|
||||||
if (!--urudev->powerup_ctr) {
|
if (!--urudev->powerup_ctr) {
|
||||||
fp_err("could not power device up");
|
fp_err("could not power device up");
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
} else if (!urudev->profile->auth_cr) {
|
} else if (!urudev->profile->auth_cr) {
|
||||||
fpi_ssm_jump_to_state(ssm, POWERUP_SET_HWSTAT);
|
fpi_ssm_jump_to_state(ssm, POWERUP_SET_HWSTAT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -979,7 +979,7 @@ static void powerup_run_state(fpi_ssm *ssm)
|
||||||
break;
|
break;
|
||||||
case POWERUP_PAUSE:
|
case POWERUP_PAUSE:
|
||||||
if (fpi_timeout_add(10, powerup_pause_cb, ssm) == NULL)
|
if (fpi_timeout_add(10, powerup_pause_cb, ssm) == NULL)
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIME);
|
fpi_ssm_mark_failed(ssm, -ETIME);
|
||||||
break;
|
break;
|
||||||
case POWERUP_CHALLENGE_RESPONSE:
|
case POWERUP_CHALLENGE_RESPONSE:
|
||||||
sm_do_challenge_response(ssm);
|
sm_do_challenge_response(ssm);
|
||||||
|
@ -1028,7 +1028,7 @@ static void init_scanpwr_irq_cb(struct fp_img_dev *dev, int status,
|
||||||
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
|
struct uru4k_dev *urudev = fpi_imgdev_get_user_data(dev);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
fpi_ssm_mark_aborted(ssm, status);
|
fpi_ssm_mark_failed(ssm, status);
|
||||||
else if (type != IRQDATA_SCANPWR_ON)
|
else if (type != IRQDATA_SCANPWR_ON)
|
||||||
fp_dbg("ignoring interrupt");
|
fp_dbg("ignoring interrupt");
|
||||||
else if (fpi_ssm_get_cur_state(ssm) != INIT_AWAIT_SCAN_POWER) {
|
else if (fpi_ssm_get_cur_state(ssm) != INIT_AWAIT_SCAN_POWER) {
|
||||||
|
@ -1052,7 +1052,7 @@ static void init_scanpwr_timeout(void *user_data)
|
||||||
|
|
||||||
if (++urudev->scanpwr_irq_timeouts >= 3) {
|
if (++urudev->scanpwr_irq_timeouts >= 3) {
|
||||||
fp_err("powerup timed out 3 times, giving up");
|
fp_err("powerup timed out 3 times, giving up");
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIMEDOUT);
|
fpi_ssm_mark_failed(ssm, -ETIMEDOUT);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_jump_to_state(ssm, INIT_GET_HWSTAT);
|
fpi_ssm_jump_to_state(ssm, INIT_GET_HWSTAT);
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1088,7 @@ static void init_run_state(fpi_ssm *ssm)
|
||||||
break;
|
break;
|
||||||
case INIT_POWERUP: ;
|
case INIT_POWERUP: ;
|
||||||
if (!IRQ_HANDLER_IS_RUNNING(urudev)) {
|
if (!IRQ_HANDLER_IS_RUNNING(urudev)) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
urudev->irq_cb_data = ssm;
|
urudev->irq_cb_data = ssm;
|
||||||
|
@ -1111,7 +1111,7 @@ static void init_run_state(fpi_ssm *ssm)
|
||||||
urudev->scanpwr_irq_timeout = fpi_timeout_add(300,
|
urudev->scanpwr_irq_timeout = fpi_timeout_add(300,
|
||||||
init_scanpwr_timeout, ssm);
|
init_scanpwr_timeout, ssm);
|
||||||
if (!urudev->scanpwr_irq_timeout) {
|
if (!urudev->scanpwr_irq_timeout) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIME);
|
fpi_ssm_mark_failed(ssm, -ETIME);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -77,7 +77,7 @@ static void sm_write_reg_cb(struct libusb_transfer *transfer)
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ static void sm_write_reg(fpi_ssm *ssm, unsigned char reg,
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ static void sm_write_reg(fpi_ssm *ssm, unsigned char reg,
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ static void sm_exec_cmd_cb(struct libusb_transfer *transfer)
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
fpi_ssm *ssm = transfer->user_data;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(ssm);
|
fpi_ssm_next_state(ssm);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static void sm_exec_cmd(fpi_ssm *ssm, unsigned char cmd,
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ static void sm_exec_cmd(fpi_ssm *ssm, unsigned char cmd,
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
g_free(data);
|
g_free(data);
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ static void capture_cb(struct libusb_transfer *transfer)
|
||||||
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
|
struct v5s_dev *vdev = fpi_imgdev_get_user_data(dev);
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ static void capture_iterate(fpi_ssm *ssm)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!transfer) {
|
if (!transfer) {
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ static void capture_iterate(fpi_ssm *ssm)
|
||||||
r = libusb_submit_transfer(transfer);
|
r = libusb_submit_transfer(transfer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,14 @@ static void async_write_callback(struct libusb_transfer *transfer)
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
fp_err("USB write transfer: %s", libusb_error_name(error));
|
fp_err("USB write transfer: %s", libusb_error_name(error));
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transferred != len) {
|
if (transferred != len) {
|
||||||
fp_err("Written only %d of %d bytes", transferred, len);
|
fp_err("Written only %d of %d bytes", transferred, len);
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@ static void async_read_callback(struct libusb_transfer *transfer)
|
||||||
fp_err("USB read transfer on endpoint %d: %s", ep - 0x80,
|
fp_err("USB read transfer on endpoint %d: %s", ep - 0x80,
|
||||||
libusb_error_name(error));
|
libusb_error_name(error));
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transferred != len) {
|
if (transferred != len) {
|
||||||
fp_err("Received %d instead of %d bytes", transferred, len);
|
fp_err("Received %d instead of %d bytes", transferred, len);
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ static void async_abort_callback(struct libusb_transfer *transfer)
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
fp_err("USB write transfer: %s", libusb_error_name(error));
|
fp_err("USB write transfer: %s", libusb_error_name(error));
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ static void clear_ep2_ssm(fpi_ssm *ssm)
|
||||||
default:
|
default:
|
||||||
fp_err("Unknown SUBSM1 state");
|
fp_err("Unknown SUBSM1 state");
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ static void send_control_packet_ssm(fpi_ssm *ssm)
|
||||||
(vdev->interrupt, empty_interrupt, VFS_INTERRUPT_SIZE)) {
|
(vdev->interrupt, empty_interrupt, VFS_INTERRUPT_SIZE)) {
|
||||||
fp_err("Unknown SUBSM2 state");
|
fp_err("Unknown SUBSM2 state");
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
async_abort(ssm, 3);
|
async_abort(ssm, 3);
|
||||||
|
@ -380,7 +380,7 @@ static void send_control_packet_ssm(fpi_ssm *ssm)
|
||||||
default:
|
default:
|
||||||
fp_err("Unknown SUBSM2 state");
|
fp_err("Unknown SUBSM2 state");
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ static void interrupt_callback(struct libusb_transfer *transfer)
|
||||||
fp_err("USB read interrupt transfer: %s",
|
fp_err("USB read interrupt transfer: %s",
|
||||||
libusb_error_name(error));
|
libusb_error_name(error));
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ static void interrupt_callback(struct libusb_transfer *transfer)
|
||||||
fp_err("Unknown interrupt size %d", transferred);
|
fp_err("Unknown interrupt size %d", transferred);
|
||||||
/* Abort ssm */
|
/* Abort ssm */
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ static void interrupt_callback(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
/* Abort ssm */
|
/* Abort ssm */
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void receive_callback(struct libusb_transfer *transfer)
|
static void receive_callback(struct libusb_transfer *transfer)
|
||||||
|
@ -476,7 +476,7 @@ static void receive_callback(struct libusb_transfer *transfer)
|
||||||
fp_err("USB read transfer: %s", libusb_error_name(error));
|
fp_err("USB read transfer: %s", libusb_error_name(error));
|
||||||
|
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ static void activate_ssm(fpi_ssm *ssm)
|
||||||
default:
|
default:
|
||||||
fp_err("Unknown state");
|
fp_err("Unknown state");
|
||||||
fpi_imgdev_session_error(idev, -EIO);
|
fpi_imgdev_session_error(idev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
|
||||||
/* Transfer not completed, return IO error */
|
/* Transfer not completed, return IO error */
|
||||||
fp_err("transfer not completed, status = %d", transfer->status);
|
fp_err("transfer not completed, status = %d", transfer->status);
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
|
||||||
fp_err("length mismatch, got %d, expected %d",
|
fp_err("length mismatch, got %d, expected %d",
|
||||||
transfer->actual_length, transfer->length);
|
transfer->actual_length, transfer->length);
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ static void async_send(fpi_ssm *ssm)
|
||||||
/* Allocation transfer failed, return no memory error */
|
/* Allocation transfer failed, return no memory error */
|
||||||
fp_err("allocation of usb transfer failed");
|
fp_err("allocation of usb transfer failed");
|
||||||
fpi_imgdev_session_error(dev, -ENOMEM);
|
fpi_imgdev_session_error(dev, -ENOMEM);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ static void async_send(fpi_ssm *ssm)
|
||||||
libusb_free_transfer(vdev->transfer);
|
libusb_free_transfer(vdev->transfer);
|
||||||
fp_err("submit of usb transfer failed");
|
fp_err("submit of usb transfer failed");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ static void async_recv_cb(struct libusb_transfer *transfer)
|
||||||
/* Transfer not completed, return IO error */
|
/* Transfer not completed, return IO error */
|
||||||
fp_err("transfer not completed, status = %d", transfer->status);
|
fp_err("transfer not completed, status = %d", transfer->status);
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ static void async_recv_cb(struct libusb_transfer *transfer)
|
||||||
fp_err("seqnum mismatch, got %04x, expected %04x",
|
fp_err("seqnum mismatch, got %04x, expected %04x",
|
||||||
get_seqnum(vdev->buffer[1], vdev->buffer[0]), vdev->seqnum);
|
get_seqnum(vdev->buffer[1], vdev->buffer[0]), vdev->seqnum);
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ static void async_recv(fpi_ssm *ssm)
|
||||||
/* Allocation transfer failed, return no memory error */
|
/* Allocation transfer failed, return no memory error */
|
||||||
fp_err("allocation of usb transfer failed");
|
fp_err("allocation of usb transfer failed");
|
||||||
fpi_imgdev_session_error(dev, -ENOMEM);
|
fpi_imgdev_session_error(dev, -ENOMEM);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ static void async_recv(fpi_ssm *ssm)
|
||||||
libusb_free_transfer(vdev->transfer);
|
libusb_free_transfer(vdev->transfer);
|
||||||
fp_err("submit of usb transfer failed");
|
fp_err("submit of usb transfer failed");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ static void async_load_cb(struct libusb_transfer *transfer)
|
||||||
/* Transfer not completed */
|
/* Transfer not completed */
|
||||||
fp_err("transfer not completed, status = %d, length = %d", transfer->status, vdev->length);
|
fp_err("transfer not completed, status = %d, length = %d", transfer->status, vdev->length);
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ static void async_load_cb(struct libusb_transfer *transfer)
|
||||||
/* Received incomplete frame, return protocol error */
|
/* Received incomplete frame, return protocol error */
|
||||||
fp_err("received incomplete frame");
|
fp_err("received incomplete frame");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ static void async_load_cb(struct libusb_transfer *transfer)
|
||||||
/* Buffer full, image too large, return no memory error */
|
/* Buffer full, image too large, return no memory error */
|
||||||
fp_err("buffer full, image too large");
|
fp_err("buffer full, image too large");
|
||||||
fpi_imgdev_session_error(dev, -ENOMEM);
|
fpi_imgdev_session_error(dev, -ENOMEM);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -444,7 +444,7 @@ static void async_load(fpi_ssm *ssm)
|
||||||
/* Allocation transfer failed, return no memory error */
|
/* Allocation transfer failed, return no memory error */
|
||||||
fp_err("allocation of usb transfer failed");
|
fp_err("allocation of usb transfer failed");
|
||||||
fpi_imgdev_session_error(dev, -ENOMEM);
|
fpi_imgdev_session_error(dev, -ENOMEM);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ static void async_load(fpi_ssm *ssm)
|
||||||
libusb_free_transfer(vdev->transfer);
|
libusb_free_transfer(vdev->transfer);
|
||||||
fp_err("submit of usb transfer failed");
|
fp_err("submit of usb transfer failed");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ static void async_sleep(unsigned int msec, fpi_ssm *ssm)
|
||||||
/* Failed to add timeout */
|
/* Failed to add timeout */
|
||||||
fp_err("failed to add timeout");
|
fp_err("failed to add timeout");
|
||||||
fpi_imgdev_session_error(dev, -ETIME);
|
fpi_imgdev_session_error(dev, -ETIME);
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIME);
|
fpi_ssm_mark_failed(ssm, -ETIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,7 +961,7 @@ static void m_loop_state(fpi_ssm *ssm)
|
||||||
/* Unknown state */
|
/* Unknown state */
|
||||||
fp_err("unknown device state 0x%02x", vdev->buffer[0x0a]);
|
fp_err("unknown device state 0x%02x", vdev->buffer[0x0a]);
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1018,7 +1018,7 @@ static void m_loop_state(fpi_ssm *ssm)
|
||||||
/* reach max loop counter, return protocol error */
|
/* reach max loop counter, return protocol error */
|
||||||
fp_err("finger not removed from the scanner");
|
fp_err("finger not removed from the scanner");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1108,7 +1108,7 @@ static void m_loop_state(fpi_ssm *ssm)
|
||||||
/* reach max loop counter, return protocol error */
|
/* reach max loop counter, return protocol error */
|
||||||
fp_err("waiting abort reach max loop counter");
|
fp_err("waiting abort reach max loop counter");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1237,7 +1237,7 @@ static void m_init_state(fpi_ssm *ssm)
|
||||||
/* reach max loop counter, return protocol error */
|
/* reach max loop counter, return protocol error */
|
||||||
fp_err("waiting abort reach max loop counter");
|
fp_err("waiting abort reach max loop counter");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1273,7 +1273,7 @@ static void m_init_state(fpi_ssm *ssm)
|
||||||
/* reach max loop counter, return protocol error */
|
/* reach max loop counter, return protocol error */
|
||||||
fp_err("finger not removed from the scanner");
|
fp_err("finger not removed from the scanner");
|
||||||
fpi_imgdev_session_error(dev, -EIO);
|
fpi_imgdev_session_error(dev, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void async_sleep(unsigned int msec, fpi_ssm *ssm)
|
||||||
/* Failed to add timeout */
|
/* Failed to add timeout */
|
||||||
fp_err("failed to add timeout");
|
fp_err("failed to add timeout");
|
||||||
fpi_imgdev_session_error(dev, -ETIME);
|
fpi_imgdev_session_error(dev, -ETIME);
|
||||||
fpi_ssm_mark_aborted(ssm, -ETIME);
|
fpi_ssm_mark_failed(ssm, -ETIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
|
||||||
if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
|
if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
|
||||||
fp_err("Radiation detected!");
|
fp_err("Radiation detected!");
|
||||||
fpi_imgdev_session_error(data->device, -EINVAL);
|
fpi_imgdev_session_error(data->device, -EINVAL);
|
||||||
fpi_ssm_mark_aborted(ssm, -EINVAL);
|
fpi_ssm_mark_failed(ssm, -EINVAL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
|
||||||
if (action->type != ACTION_SEND) {
|
if (action->type != ACTION_SEND) {
|
||||||
fp_err("Radiation detected!");
|
fp_err("Radiation detected!");
|
||||||
fpi_imgdev_session_error(data->device, -EINVAL);
|
fpi_imgdev_session_error(data->device, -EINVAL);
|
||||||
fpi_ssm_mark_aborted(ssm, -EINVAL);
|
fpi_ssm_mark_failed(ssm, -EINVAL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
|
||||||
/* Transfer not completed, return IO error */
|
/* Transfer not completed, return IO error */
|
||||||
fp_err("transfer not completed, status = %d", transfer->status);
|
fp_err("transfer not completed, status = %d", transfer->status);
|
||||||
fpi_imgdev_session_error(data->device, -EIO);
|
fpi_imgdev_session_error(data->device, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (transfer->length != transfer->actual_length) {
|
if (transfer->length != transfer->actual_length) {
|
||||||
|
@ -106,7 +106,7 @@ static void async_send_cb(struct libusb_transfer *transfer)
|
||||||
fp_err("length mismatch, got %d, expected %d",
|
fp_err("length mismatch, got %d, expected %d",
|
||||||
transfer->actual_length, transfer->length);
|
transfer->actual_length, transfer->length);
|
||||||
fpi_imgdev_session_error(data->device, -EIO);
|
fpi_imgdev_session_error(data->device, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,14 +127,14 @@ static void async_recv_cb(struct libusb_transfer *transfer)
|
||||||
/* Transfer not completed, return IO error */
|
/* Transfer not completed, return IO error */
|
||||||
fp_err("transfer not completed, status = %d", transfer->status);
|
fp_err("transfer not completed, status = %d", transfer->status);
|
||||||
fpi_imgdev_session_error(data->device, -EIO);
|
fpi_imgdev_session_error(data->device, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
|
if (fpi_ssm_get_cur_state(ssm) >= data->stepcount) {
|
||||||
fp_err("Radiation detected!");
|
fp_err("Radiation detected!");
|
||||||
fpi_imgdev_session_error(data->device, -EINVAL);
|
fpi_imgdev_session_error(data->device, -EINVAL);
|
||||||
fpi_ssm_mark_aborted(ssm, -EINVAL);
|
fpi_ssm_mark_failed(ssm, -EINVAL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ static void async_recv_cb(struct libusb_transfer *transfer)
|
||||||
if (action->type != ACTION_RECEIVE) {
|
if (action->type != ACTION_RECEIVE) {
|
||||||
fp_err("Radiation detected!");
|
fp_err("Radiation detected!");
|
||||||
fpi_imgdev_session_error(data->device, -EINVAL);
|
fpi_imgdev_session_error(data->device, -EINVAL);
|
||||||
fpi_ssm_mark_aborted(ssm, -EINVAL);
|
fpi_ssm_mark_failed(ssm, -EINVAL);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,14 +152,14 @@ static void async_recv_cb(struct libusb_transfer *transfer)
|
||||||
transfer->actual_length,
|
transfer->actual_length,
|
||||||
action->correct_reply_size);
|
action->correct_reply_size);
|
||||||
fpi_imgdev_session_error(data->device, -EIO);
|
fpi_imgdev_session_error(data->device, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (memcmp(transfer->buffer, action->data,
|
if (memcmp(transfer->buffer, action->data,
|
||||||
action->correct_reply_size) != 0) {
|
action->correct_reply_size) != 0) {
|
||||||
fp_dbg("Wrong reply:");
|
fp_dbg("Wrong reply:");
|
||||||
fpi_imgdev_session_error(data->device, -EIO);
|
fpi_imgdev_session_error(data->device, -EIO);
|
||||||
fpi_ssm_mark_aborted(ssm, -EIO);
|
fpi_ssm_mark_failed(ssm, -EIO);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -178,7 +178,7 @@ static void usbexchange_loop(fpi_ssm *ssm)
|
||||||
fp_err("Bug detected: state %d out of range, only %d steps",
|
fp_err("Bug detected: state %d out of range, only %d steps",
|
||||||
fpi_ssm_get_cur_state(ssm), data->stepcount);
|
fpi_ssm_get_cur_state(ssm), data->stepcount);
|
||||||
fpi_imgdev_session_error(data->device, -EINVAL);
|
fpi_imgdev_session_error(data->device, -EINVAL);
|
||||||
fpi_ssm_mark_aborted(ssm, -EINVAL);
|
fpi_ssm_mark_failed(ssm, -EINVAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ static void usbexchange_loop(fpi_ssm *ssm)
|
||||||
if (transfer == NULL) {
|
if (transfer == NULL) {
|
||||||
fp_err("Failed to allocate transfer");
|
fp_err("Failed to allocate transfer");
|
||||||
fpi_imgdev_session_error(data->device, -ENOMEM);
|
fpi_imgdev_session_error(data->device, -ENOMEM);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(data->device),
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(data->device),
|
||||||
|
@ -209,7 +209,7 @@ static void usbexchange_loop(fpi_ssm *ssm)
|
||||||
if (transfer == NULL) {
|
if (transfer == NULL) {
|
||||||
fp_err("Failed to allocate transfer");
|
fp_err("Failed to allocate transfer");
|
||||||
fpi_imgdev_session_error(data->device, -ENOMEM);
|
fpi_imgdev_session_error(data->device, -ENOMEM);
|
||||||
fpi_ssm_mark_aborted(ssm, -ENOMEM);
|
fpi_ssm_mark_failed(ssm, -ENOMEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(data->device),
|
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(data->device),
|
||||||
|
@ -222,14 +222,14 @@ static void usbexchange_loop(fpi_ssm *ssm)
|
||||||
default:
|
default:
|
||||||
fp_err("Bug detected: invalid action %d", action->type);
|
fp_err("Bug detected: invalid action %d", action->type);
|
||||||
fpi_imgdev_session_error(data->device, -EINVAL);
|
fpi_imgdev_session_error(data->device, -EINVAL);
|
||||||
fpi_ssm_mark_aborted(ssm, -EINVAL);
|
fpi_ssm_mark_failed(ssm, -EINVAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
fp_err("USB transfer error: %s", strerror(ret));
|
fp_err("USB transfer error: %s", strerror(ret));
|
||||||
fpi_imgdev_session_error(data->device, ret);
|
fpi_imgdev_session_error(data->device, ret);
|
||||||
fpi_ssm_mark_aborted(ssm, ret);
|
fpi_ssm_mark_failed(ssm, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ static void chunk_capture_callback(struct libusb_transfer *transfer)
|
||||||
} else {
|
} else {
|
||||||
if (!data->deactivating) {
|
if (!data->deactivating) {
|
||||||
fp_err("Failed to capture data");
|
fp_err("Failed to capture data");
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(ssm);
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ static void activate_loop(fpi_ssm *ssm)
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
fp_err("Failed to capture data");
|
fp_err("Failed to capture data");
|
||||||
fpi_imgdev_session_error(dev, r);
|
fpi_imgdev_session_error(dev, r);
|
||||||
fpi_ssm_mark_aborted(ssm, r);
|
fpi_ssm_mark_failed(ssm, r);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ static void activate_loop(fpi_ssm *ssm)
|
||||||
/* Failed to add timeout */
|
/* Failed to add timeout */
|
||||||
fp_err("failed to add timeout");
|
fp_err("failed to add timeout");
|
||||||
fpi_imgdev_session_error(dev, -1);
|
fpi_imgdev_session_error(dev, -1);
|
||||||
fpi_ssm_mark_aborted(ssm, -1);
|
fpi_ssm_mark_failed(ssm, -1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
* To mark successful completion of a SSM, either iterate beyond the final
|
* To mark successful completion of a SSM, either iterate beyond the final
|
||||||
* state or call fpi_ssm_mark_completed() from any state.
|
* state or call fpi_ssm_mark_completed() from any state.
|
||||||
*
|
*
|
||||||
* To mark failed completion of a SSM, call fpi_ssm_mark_aborted() from any
|
* To mark failed completion of a SSM, call fpi_ssm_mark_failed() from any
|
||||||
* state. You must pass a non-zero error code.
|
* state. You must pass a non-zero error code.
|
||||||
*
|
*
|
||||||
* Your state handling function looks at the return value of
|
* Your state handling function looks at the return value of
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
* Typically, the state handling function fires off an asynchronous
|
* Typically, the state handling function fires off an asynchronous
|
||||||
* communication with the device (such as a libsub transfer), and the
|
* communication with the device (such as a libsub transfer), and the
|
||||||
* callback function iterates the machine to the next state
|
* callback function iterates the machine to the next state
|
||||||
* upon success (or aborts the machine on failure).
|
* upon success (or fails).
|
||||||
*
|
*
|
||||||
* Your completion callback should examine the return value of
|
* Your completion callback should examine the return value of
|
||||||
* fpi_ssm_get_error() in order to determine whether the #fpi_ssm completed or
|
* fpi_ssm_get_error() in order to determine whether the #fpi_ssm completed or
|
||||||
|
@ -184,7 +184,7 @@ static void __ssm_call_handler(fpi_ssm *machine)
|
||||||
* @callback: the #ssm_completed_fn callback to call on completion
|
* @callback: the #ssm_completed_fn callback to call on completion
|
||||||
*
|
*
|
||||||
* Starts a state machine. You can also use this function to restart
|
* Starts a state machine. You can also use this function to restart
|
||||||
* a completed or aborted state machine. The @callback will be called
|
* a completed or failed state machine. The @callback will be called
|
||||||
* on completion.
|
* on completion.
|
||||||
*/
|
*/
|
||||||
void fpi_ssm_start(fpi_ssm *ssm, ssm_completed_fn callback)
|
void fpi_ssm_start(fpi_ssm *ssm, ssm_completed_fn callback)
|
||||||
|
@ -202,7 +202,7 @@ static void __subsm_complete(fpi_ssm *ssm)
|
||||||
fpi_ssm *parent = ssm->parentsm;
|
fpi_ssm *parent = ssm->parentsm;
|
||||||
BUG_ON(!parent);
|
BUG_ON(!parent);
|
||||||
if (ssm->error)
|
if (ssm->error)
|
||||||
fpi_ssm_mark_aborted(parent, ssm->error);
|
fpi_ssm_mark_failed(parent, ssm->error);
|
||||||
else
|
else
|
||||||
fpi_ssm_next_state(parent);
|
fpi_ssm_next_state(parent);
|
||||||
fpi_ssm_free(ssm);
|
fpi_ssm_free(ssm);
|
||||||
|
@ -215,9 +215,9 @@ static void __subsm_complete(fpi_ssm *ssm)
|
||||||
*
|
*
|
||||||
* Starts a state machine as a child of another. if the child completes
|
* Starts a state machine as a child of another. if the child completes
|
||||||
* successfully, the parent will be advanced to the next state. if the
|
* successfully, the parent will be advanced to the next state. if the
|
||||||
* child aborts, the parent will be aborted with the same error code.
|
* child fails, the parent will be marked as failed with the same error code.
|
||||||
*
|
*
|
||||||
* The child will be automatically freed upon completion or abortion.
|
* The child will be automatically freed upon completion or failure.
|
||||||
*/
|
*/
|
||||||
void fpi_ssm_start_subsm(fpi_ssm *parent, fpi_ssm *child)
|
void fpi_ssm_start_subsm(fpi_ssm *parent, fpi_ssm *child)
|
||||||
{
|
{
|
||||||
|
@ -242,13 +242,13 @@ void fpi_ssm_mark_completed(fpi_ssm *machine)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fpi_ssm_mark_aborted:
|
* fpi_ssm_mark_failed:
|
||||||
* @machine: an #fpi_ssm state machine
|
* @machine: an #fpi_ssm state machine
|
||||||
* @error: the error code
|
* @error: the error code
|
||||||
*
|
*
|
||||||
* Mark a state machine as aborted with error.
|
* Mark a state machine as failed with @error as the error code.
|
||||||
*/
|
*/
|
||||||
void fpi_ssm_mark_aborted(fpi_ssm *machine, int error)
|
void fpi_ssm_mark_failed(fpi_ssm *machine, int error)
|
||||||
{
|
{
|
||||||
fp_dbg("error %d from state %d", error, machine->cur_state);
|
fp_dbg("error %d from state %d", error, machine->cur_state);
|
||||||
BUG_ON(error == 0);
|
BUG_ON(error == 0);
|
||||||
|
@ -307,7 +307,7 @@ int fpi_ssm_get_cur_state(fpi_ssm *machine)
|
||||||
* fpi_ssm_get_error:
|
* fpi_ssm_get_error:
|
||||||
* @machine: an #fpi_ssm state machine
|
* @machine: an #fpi_ssm state machine
|
||||||
*
|
*
|
||||||
* Returns the error code set by fpi_ssm_mark_aborted().
|
* Returns the error code set by fpi_ssm_mark_failed().
|
||||||
*
|
*
|
||||||
* Returns: a error code
|
* Returns: a error code
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
* fpi_ssm:
|
* fpi_ssm:
|
||||||
*
|
*
|
||||||
* Sequential state machine that iterates sequentially over
|
* Sequential state machine that iterates sequentially over
|
||||||
* a predefined series of states. Can be aborted by either completion or
|
* a predefined series of states. Can be terminated by either completion or
|
||||||
* abortion error conditions.
|
* failure error conditions.
|
||||||
*/
|
*/
|
||||||
typedef struct fpi_ssm fpi_ssm;
|
typedef struct fpi_ssm fpi_ssm;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void fpi_ssm_start_subsm(fpi_ssm *parent, fpi_ssm *child);
|
||||||
void fpi_ssm_next_state(fpi_ssm *machine);
|
void fpi_ssm_next_state(fpi_ssm *machine);
|
||||||
void fpi_ssm_jump_to_state(fpi_ssm *machine, int state);
|
void fpi_ssm_jump_to_state(fpi_ssm *machine, int state);
|
||||||
void fpi_ssm_mark_completed(fpi_ssm *machine);
|
void fpi_ssm_mark_completed(fpi_ssm *machine);
|
||||||
void fpi_ssm_mark_aborted(fpi_ssm *machine, int error);
|
void fpi_ssm_mark_failed(fpi_ssm *machine, int error);
|
||||||
struct fp_dev *fpi_ssm_get_dev(fpi_ssm *machine);
|
struct fp_dev *fpi_ssm_get_dev(fpi_ssm *machine);
|
||||||
void fpi_ssm_set_user_data(fpi_ssm *machine,
|
void fpi_ssm_set_user_data(fpi_ssm *machine,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
Loading…
Reference in a new issue