Commit 1102d6e4 authored by Bastien Nocera's avatar Bastien Nocera

Merge branch 'wip/hadess/fpi-ssm-docs' into 'master'

Add fpi_ssm API docs

See merge request !14
parents 6345835b 603aab0a
Pipeline #4104 passed with stage
in 4 minutes and 35 seconds
......@@ -24,7 +24,7 @@
</part>
<part>
<title>API Documentation</title>
<title>Library API Documentation</title>
<xi:include href="xml/events.xml"/>
<xi:include href="xml/discovery.xml"/>
......@@ -36,11 +36,10 @@
<xi:include href="xml/img.xml"/>
</part>
<!--
<part>
<title>Writing Drivers</title>
<xi:include href="xml/fpi-ssm.xml"/>
</part>
-->
<index id="api-index">
<title>API Index</title>
......
<INCLUDE>fprint.h</INCLUDE>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>events</FILE>
<TITLE>Initialisation and events handling</TITLE>
fp_set_debug
......@@ -17,6 +17,7 @@ fp_set_pollfd_notifiers
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>discovery</FILE>
<TITLE>Device discovery</TITLE>
fp_dscv_dev
......@@ -32,6 +33,7 @@ fp_dscv_dev_for_dscv_print
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>drv</FILE>
fp_driver
fp_driver_get_name
......@@ -41,6 +43,7 @@ fp_driver_get_scan_type
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>dev</FILE>
fp_dev
fp_scan_type
......@@ -91,6 +94,7 @@ fp_async_capture_stop
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>print_data</FILE>
fp_finger
fp_print_data
......@@ -106,6 +110,7 @@ fp_print_data_get_devtype
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>dscv_print</FILE>
fp_dscv_print
fp_discover_prints
......@@ -117,6 +122,7 @@ fp_dscv_print_delete
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>img</FILE>
fp_img
fp_minutia
......@@ -131,5 +137,28 @@ fp_img_get_minutiae
</SECTION>
<SECTION>
<INCLUDE>fprint.h</INCLUDE>
<FILE>poll</FILE>
</SECTION>
<SECTION>
<INCLUDE>fpi-ssm.h</INCLUDE>
<FILE>fpi-ssm</FILE>
fpi_ssm
ssm_completed_fn
ssm_handler_fn
fpi_ssm_new
fpi_ssm_free
fpi_ssm_start
fpi_ssm_start_subsm
fpi_ssm_next_state
fpi_ssm_jump_to_state
fpi_ssm_mark_completed
fpi_ssm_mark_failed
fpi_ssm_set_user_data
fpi_ssm_get_user_data
fpi_ssm_get_error
fpi_ssm_get_cur_state
</SECTION>
......@@ -101,12 +101,12 @@ static void stub_capture_stop_cb(struct fp_img_dev *dev, int result, void *user_
/* check that read succeeded but ignore all data */
static void generic_ignore_data_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
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)
fpi_ssm_mark_aborted(ssm, -EPROTO);
fpi_ssm_mark_failed(ssm, -EPROTO);
else
fpi_ssm_next_state(ssm);
......@@ -117,16 +117,16 @@ static void generic_ignore_data_cb(struct libusb_transfer *transfer)
static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
void *user_data)
{
struct fpi_ssm *ssm = user_data;
fpi_ssm *ssm = user_data;
if (result == 0)
fpi_ssm_next_state(ssm);
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
* away, then increment the SSM */
static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data;
......@@ -134,7 +134,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
int r;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
return;
}
......@@ -147,7 +147,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
}
......@@ -557,17 +557,17 @@ enum capture_states {
static void capture_read_strip_cb(struct libusb_transfer *transfer)
{
unsigned char *stripdata;
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer;
int sum, i;
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
goto out;
} else if (transfer->length != transfer->actual_length) {
fpi_ssm_mark_aborted(ssm, -EPROTO);
fpi_ssm_mark_failed(ssm, -EPROTO);
goto out;
}
......@@ -594,7 +594,7 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
}
if (sum < 0) {
fpi_ssm_mark_aborted(ssm, sum);
fpi_ssm_mark_failed(ssm, sum);
goto out;
}
fp_dbg("sum=%d", sum);
......@@ -643,7 +643,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(struct fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
......@@ -672,7 +672,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
unsigned char *data;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
break;
}
......@@ -684,13 +684,13 @@ static void capture_run_state(struct fpi_ssm *ssm)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
break;
};
}
static void capture_sm_complete(struct fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
......@@ -708,7 +708,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm;
fpi_ssm *ssm;
if (aesdev->deactivating) {
complete_deactivation(dev);
......@@ -738,7 +738,7 @@ enum activate_states {
ACTIVATE_NUM_STATES,
};
static void activate_run_state(struct fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
......@@ -753,7 +753,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
}
/* jump to finger detection */
static void activate_sm_complete(struct fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));
......@@ -767,7 +767,7 @@ static void activate_sm_complete(struct fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct aes1610_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
aesdev->read_regs_retry_count = 0;
......
......@@ -180,22 +180,22 @@ static int regval_from_dump(unsigned char *data, uint8_t target)
static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
void *user_data)
{
struct fpi_ssm *ssm = user_data;
fpi_ssm *ssm = user_data;
if (result == 0)
fpi_ssm_next_state(ssm);
else
fpi_ssm_mark_aborted(ssm, result);
fpi_ssm_mark_failed(ssm, result);
}
/* check that read succeeded but ignore all data */
static void generic_ignore_data_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
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)
fpi_ssm_mark_aborted(ssm, -EPROTO);
fpi_ssm_mark_failed(ssm, -EPROTO);
else
fpi_ssm_next_state(ssm);
......@@ -205,7 +205,7 @@ static void generic_ignore_data_cb(struct libusb_transfer *transfer)
/* read the specified number of bytes from the IN endpoint but throw them
* away, then increment the SSM */
static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
unsigned char *data;
......@@ -213,7 +213,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
int r;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
return;
}
......@@ -225,7 +225,7 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
}
......@@ -436,7 +436,7 @@ enum capture_states {
static void capture_read_strip_cb(struct libusb_transfer *transfer)
{
unsigned char *stripdata;
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer;
......@@ -444,23 +444,23 @@ static void capture_read_strip_cb(struct libusb_transfer *transfer)
int threshold;
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
goto out;
} else if (transfer->length != transfer->actual_length) {
fpi_ssm_mark_aborted(ssm, -EPROTO);
fpi_ssm_mark_failed(ssm, -EPROTO);
goto out;
}
threshold = regval_from_dump(data + 1 + 192*8 + 1 + 16*2 + 1 + 8,
AES2501_REG_DATFMT);
if (threshold < 0) {
fpi_ssm_mark_aborted(ssm, threshold);
fpi_ssm_mark_failed(ssm, threshold);
goto out;
}
sum = sum_histogram_values(data + 1 + 192*8, threshold & 0x0f);
if (sum < 0) {
fpi_ssm_mark_aborted(ssm, sum);
fpi_ssm_mark_failed(ssm, sum);
goto out;
}
fp_dbg("sum=%d", sum);
......@@ -520,7 +520,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(struct fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
......@@ -553,7 +553,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
unsigned char *data;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
break;
}
......@@ -565,13 +565,13 @@ static void capture_run_state(struct fpi_ssm *ssm)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
break;
};
}
static void capture_sm_complete(struct fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
......@@ -589,7 +589,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm;
fpi_ssm *ssm;
if (aesdev->deactivating) {
complete_deactivation(dev);
......@@ -713,11 +713,11 @@ enum activate_states {
void activate_read_regs_cb(struct fp_img_dev *dev, int status,
unsigned char *regs, void *user_data)
{
struct fpi_ssm *ssm = user_data;
fpi_ssm *ssm = user_data;
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
if (status != 0) {
fpi_ssm_mark_aborted(ssm, status);
fpi_ssm_mark_failed(ssm, status);
} else {
fp_dbg("reg 0xaf = %x", regs[0x5f]);
if (regs[0x5f] != 0x6b || ++aesdev->read_regs_retry_count == 13)
......@@ -730,14 +730,14 @@ void activate_read_regs_cb(struct fp_img_dev *dev, int status,
static void activate_init3_cb(struct fp_img_dev *dev, int result,
void *user_data)
{
struct fpi_ssm *ssm = user_data;
fpi_ssm *ssm = user_data;
if (result == 0)
fpi_ssm_jump_to_state(ssm, READ_REGS);
else
fpi_ssm_mark_aborted(ssm, result);
fpi_ssm_mark_failed(ssm, result);
}
static void activate_run_state(struct fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
......@@ -791,7 +791,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
}
}
static void activate_sm_complete(struct fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));
......@@ -805,7 +805,7 @@ static void activate_sm_complete(struct fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct aes2501_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
aesdev->read_regs_retry_count = 0;
......
......@@ -200,7 +200,7 @@ enum capture_states {
};
/* Returns number of processed bytes */
static int process_strip_data(struct fpi_ssm *ssm, unsigned char *data)
static int process_strip_data(fpi_ssm *ssm, unsigned char *data)
{
unsigned char *stripdata;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
......@@ -231,20 +231,20 @@ static int process_strip_data(struct fpi_ssm *ssm, unsigned char *data)
static void capture_reqs_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) {
fpi_ssm_next_state(ssm);
} else {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
}
libusb_free_transfer(transfer);
}
static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
......@@ -265,14 +265,14 @@ static void capture_set_idle_reqs_cb(struct libusb_transfer *transfer)
/* marking machine complete will re-trigger finger detection loop */
fpi_ssm_mark_completed(ssm);
} else {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
}
libusb_free_transfer(transfer);
}
static void capture_read_data_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
unsigned char *data = transfer->buffer;
......@@ -280,7 +280,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
fp_dbg("request is not completed, %d", transfer->status);
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
goto out;
}
......@@ -293,7 +293,7 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
r = process_strip_data(ssm, data);
if (r < 0) {
fp_dbg("Processing strip data failed: %d", r);
fpi_ssm_mark_aborted(ssm, -EPROTO);
fpi_ssm_mark_failed(ssm, -EPROTO);
goto out;
}
aesdev->heartbeat_cnt = 0;
......@@ -323,7 +323,7 @@ out:
libusb_free_transfer(transfer);
}
static void capture_run_state(struct fpi_ssm *ssm)
static void capture_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r;
......@@ -333,7 +333,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
return;
}
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_reqs,
......@@ -341,7 +341,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
r = libusb_submit_transfer(transfer);
if (r < 0) {
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
}
}
break;
......@@ -351,7 +351,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
unsigned char *data;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
break;
}
......@@ -363,7 +363,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
}
break;
......@@ -371,7 +371,7 @@ static void capture_run_state(struct fpi_ssm *ssm)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
return;
}
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, capture_set_idle_reqs,
......@@ -379,14 +379,14 @@ static void capture_run_state(struct fpi_ssm *ssm)
r = libusb_submit_transfer(transfer);
if (r < 0) {
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
}
}
break;
};
}
static void capture_sm_complete(struct fpi_ssm *ssm)
static void capture_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
......@@ -404,7 +404,7 @@ static void capture_sm_complete(struct fpi_ssm *ssm)
static void start_capture(struct fp_img_dev *dev)
{
struct aes2550_dev *aesdev = fpi_imgdev_get_user_data(dev);
struct fpi_ssm *ssm;
fpi_ssm *ssm;
if (aesdev->deactivating) {
complete_deactivation(dev);
......@@ -444,25 +444,25 @@ enum activate_states {
static void init_reqs_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
(transfer->length == transfer->actual_length)) {
fpi_ssm_next_state(ssm);
} else {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
}
libusb_free_transfer(transfer);
}
static void init_read_data_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_next_state(ssm);
} else {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
}
g_free(transfer->buffer);
libusb_free_transfer(transfer);
......@@ -472,18 +472,18 @@ static void init_read_data_cb(struct libusb_transfer *transfer)
* need more info for implementaion */
static void calibrate_read_data_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
fpi_ssm_next_state(ssm);
} else {
fpi_ssm_mark_aborted(ssm, -EIO);
fpi_ssm_mark_failed(ssm, -EIO);
}
g_free(transfer->buffer);
libusb_free_transfer(transfer);
}
static void activate_run_state(struct fpi_ssm *ssm)
static void activate_run_state(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
int r;
......@@ -493,7 +493,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
return;
}
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, init_reqs,
......@@ -501,7 +501,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
r = libusb_submit_transfer(transfer);
if (r < 0) {
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
}
}
break;
......@@ -511,7 +511,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
unsigned char *data;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
break;
}
......@@ -523,7 +523,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
}
break;
......@@ -531,7 +531,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
{
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
return;
}
libusb_fill_bulk_transfer(transfer, fpi_imgdev_get_usb_dev(dev), EP_OUT, calibrate_reqs,
......@@ -539,7 +539,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
r = libusb_submit_transfer(transfer);
if (r < 0) {
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
}
}
break;
......@@ -549,7 +549,7 @@ static void activate_run_state(struct fpi_ssm *ssm)
unsigned char *data;
if (!transfer) {
fpi_ssm_mark_aborted(ssm, -ENOMEM);
fpi_ssm_mark_failed(ssm, -ENOMEM);
break;
}
......@@ -561,14 +561,14 @@ static void activate_run_state(struct fpi_ssm *ssm)
if (r < 0) {
g_free(data);
libusb_free_transfer(transfer);
fpi_ssm_mark_aborted(ssm, r);
fpi_ssm_mark_failed(ssm, r);
}
}
break;
}
}
static void activate_sm_complete(struct fpi_ssm *ssm)
static void activate_sm_complete(fpi_ssm *ssm)
{
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
fp_dbg("status %d", fpi_ssm_get_error(ssm));
......@@ -581,7 +581,7 @@ static void activate_sm_complete(struct fpi_ssm *ssm)
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
struct fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
fpi_ssm *ssm = fpi_ssm_new(fpi_imgdev_get_dev(dev), activate_run_state,
ACTIVATE_NUM_STATES);
fpi_ssm_set_user_data(ssm, dev);
fpi_ssm_start(ssm, activate_sm_complete);
......
This diff is collapsed.
......@@ -313,7 +313,7 @@ static void elan_submit_image(struct fp_img_dev *dev)
fpi_imgdev_image_captured(dev, img);
}
static void elan_cmd_done(struct fpi_ssm *ssm)
static void elan_cmd_done(fpi_ssm *ssm)
{
G_DEBUG_HERE();
fpi_ssm_next_state(ssm);
......@@ -321,7 +321,7 @@ static void elan_cmd_done(struct fpi_ssm *ssm)
static void elan_cmd_cb(struct libusb_transfer *transfer)
{
struct fpi_ssm *ssm = transfer->user_data;
fpi_ssm *ssm = transfer->user_data;
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
struct elan_dev *elandev = fpi_imgdev_get_user_data(dev);
......@@ -335,7 +335,7 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
fp_dbg("transfer length error: expected %d, got %d",
transfer->length, transfer->actual_length);
elan_dev_reset(elandev);
fpi_ssm_mark_aborted(ssm, -EPROTO);
fpi_ssm_mark_failed(ssm, -EPROTO);
} else if (transfer->endpoint & LIBUSB_ENDPOINT_IN) {
/* just finished receiving */
dbg_buf(elandev->last_read, transfer->actual_length);
......@@ -348,21 +348,21 @@ static void elan_cmd_cb(struct libusb_transfer *transfer)
break;
case LIBUSB_TRANSFER_CANCELLED:
fp_dbg("transfer cancelled");
fpi_ssm_mark_aborted(ssm, -ECANCELED);
fpi_ssm_mark_failed(ssm, -ECANCELED);
elan_deactivate(dev);