lib: Remove fpi_ssm_get_dev()
Usually by passing the dev it from an fpi_ssm callback, or simply using that callback argument.
This commit is contained in:
parent
e397571f83
commit
7dfc8f3364
7 changed files with 88 additions and 102 deletions
|
@ -126,11 +126,10 @@ static void generic_write_regv_cb(struct fp_img_dev *dev, int 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(fpi_ssm *ssm, size_t bytes)
|
||||
static void generic_read_ignore_data(fpi_ssm *ssm, struct fp_dev *dev, size_t bytes)
|
||||
{
|
||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||
unsigned char *data;
|
||||
struct fp_dev *dev;
|
||||
int r;
|
||||
|
||||
if (!transfer) {
|
||||
|
@ -139,7 +138,6 @@ static void generic_read_ignore_data(fpi_ssm *ssm, size_t bytes)
|
|||
}
|
||||
|
||||
data = g_malloc(bytes);
|
||||
dev = fpi_ssm_get_dev(ssm);
|
||||
libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(dev), EP_IN, data, bytes,
|
||||
generic_ignore_data_cb, ssm, BULK_TIMEOUT);
|
||||
|
||||
|
@ -657,7 +655,7 @@ static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data
|
|||
break;
|
||||
case CAPTURE_READ_DATA:
|
||||
fp_dbg("read data");
|
||||
generic_read_ignore_data(ssm, 665);
|
||||
generic_read_ignore_data(ssm, _dev, 665);
|
||||
break;
|
||||
case CAPTURE_REQUEST_STRIP:
|
||||
fp_dbg("request strip");
|
||||
|
|
|
@ -205,11 +205,10 @@ 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(fpi_ssm *ssm, size_t bytes)
|
||||
static void generic_read_ignore_data(fpi_ssm *ssm, struct fp_dev *dev, size_t bytes)
|
||||
{
|
||||
struct libusb_transfer *transfer = libusb_alloc_transfer(0);
|
||||
unsigned char *data;
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
int r;
|
||||
|
||||
if (!transfer) {
|
||||
|
@ -532,14 +531,14 @@ static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data
|
|||
generic_write_regv_cb, ssm);
|
||||
break;
|
||||
case CAPTURE_READ_DATA_1:
|
||||
generic_read_ignore_data(ssm, 159);
|
||||
generic_read_ignore_data(ssm, _dev, 159);
|
||||
break;
|
||||
case CAPTURE_WRITE_REQS_2:
|
||||
aes_write_regv(dev, capture_reqs_2, G_N_ELEMENTS(capture_reqs_2),
|
||||
generic_write_regv_cb, ssm);
|
||||
break;
|
||||
case CAPTURE_READ_DATA_2:
|
||||
generic_read_ignore_data(ssm, 159);
|
||||
generic_read_ignore_data(ssm, _dev, 159);
|
||||
break;
|
||||
case CAPTURE_REQUEST_STRIP:
|
||||
if (aesdev->deactivating)
|
||||
|
@ -766,7 +765,7 @@ static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_dat
|
|||
break;
|
||||
case READ_DATA_1:
|
||||
fp_dbg("read data 1");
|
||||
generic_read_ignore_data(ssm, 20);
|
||||
generic_read_ignore_data(ssm, _dev, 20);
|
||||
break;
|
||||
case WRITE_INIT_2:
|
||||
aes_write_regv(dev, init_2, G_N_ELEMENTS(init_2),
|
||||
|
|
|
@ -574,12 +574,14 @@ static void write_regs_cb(struct libusb_transfer *transfer)
|
|||
write_regs_iterate(wrdata);
|
||||
}
|
||||
|
||||
static void sm_write_regs(fpi_ssm *ssm,
|
||||
const struct sonly_regwrite *regs, size_t num_regs)
|
||||
static void
|
||||
sm_write_regs(fpi_ssm *ssm,
|
||||
struct fp_dev *dev,
|
||||
const struct sonly_regwrite *regs,
|
||||
size_t num_regs)
|
||||
{
|
||||
struct write_regs_data *wrdata = g_malloc(sizeof(*wrdata));
|
||||
unsigned char *data;
|
||||
struct fp_dev *dev;
|
||||
|
||||
wrdata->transfer = libusb_alloc_transfer(0);
|
||||
if (!wrdata->transfer) {
|
||||
|
@ -590,7 +592,6 @@ static void sm_write_regs(fpi_ssm *ssm,
|
|||
|
||||
data = g_malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
||||
libusb_fill_control_setup(data, 0x40, 0x0c, 0, 0, 1);
|
||||
dev = fpi_ssm_get_dev(ssm);
|
||||
libusb_fill_control_transfer(wrdata->transfer,
|
||||
fpi_dev_get_usb_dev(dev), data,
|
||||
write_regs_cb, wrdata, CTRL_TIMEOUT);
|
||||
|
@ -770,7 +771,7 @@ static void awfsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case AWFSM_2016_WRITEV_1:
|
||||
sm_write_regs(ssm, awfsm_2016_writev_1, G_N_ELEMENTS(awfsm_2016_writev_1));
|
||||
sm_write_regs(ssm, _dev, awfsm_2016_writev_1, G_N_ELEMENTS(awfsm_2016_writev_1));
|
||||
break;
|
||||
case AWFSM_2016_READ_01:
|
||||
sm_read_reg(ssm, 0x01);
|
||||
|
@ -782,7 +783,7 @@ static void awfsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
sm_write_reg(ssm, 0x01, 0xc6);
|
||||
break;
|
||||
case AWFSM_2016_WRITEV_2:
|
||||
sm_write_regs(ssm, awfsm_2016_writev_2, G_N_ELEMENTS(awfsm_2016_writev_2));
|
||||
sm_write_regs(ssm, _dev, awfsm_2016_writev_2, G_N_ELEMENTS(awfsm_2016_writev_2));
|
||||
break;
|
||||
case AWFSM_2016_READ_13:
|
||||
sm_read_reg(ssm, 0x13);
|
||||
|
@ -794,7 +795,7 @@ static void awfsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
sm_write_reg(ssm, 0x13, 0x45);
|
||||
break;
|
||||
case AWFSM_2016_WRITEV_3:
|
||||
sm_write_regs(ssm, awfsm_2016_writev_3, G_N_ELEMENTS(awfsm_2016_writev_3));
|
||||
sm_write_regs(ssm, _dev, awfsm_2016_writev_3, G_N_ELEMENTS(awfsm_2016_writev_3));
|
||||
break;
|
||||
case AWFSM_2016_READ_07:
|
||||
sm_read_reg(ssm, 0x07);
|
||||
|
@ -805,7 +806,7 @@ static void awfsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
sm_write_reg(ssm, 0x07, sdev->read_reg_result);
|
||||
break;
|
||||
case AWFSM_2016_WRITEV_4:
|
||||
sm_write_regs(ssm, awfsm_2016_writev_4, G_N_ELEMENTS(awfsm_2016_writev_4));
|
||||
sm_write_regs(ssm, _dev, awfsm_2016_writev_4, G_N_ELEMENTS(awfsm_2016_writev_4));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -814,10 +815,10 @@ static void awfsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
{
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case AWFSM_1000_WRITEV_1:
|
||||
sm_write_regs(ssm, awfsm_1000_writev_1, G_N_ELEMENTS(awfsm_1000_writev_1));
|
||||
sm_write_regs(ssm, _dev, awfsm_1000_writev_1, G_N_ELEMENTS(awfsm_1000_writev_1));
|
||||
break;
|
||||
case AWFSM_1000_WRITEV_2:
|
||||
sm_write_regs(ssm, awfsm_1000_writev_2, G_N_ELEMENTS(awfsm_1000_writev_2));
|
||||
sm_write_regs(ssm, _dev, awfsm_1000_writev_2, G_N_ELEMENTS(awfsm_1000_writev_2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -908,7 +909,7 @@ static void capsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
capsm_fire_bulk (ssm);
|
||||
break;
|
||||
case CAPSM_2016_WRITEV:
|
||||
sm_write_regs(ssm, capsm_2016_writev, G_N_ELEMENTS(capsm_2016_writev));
|
||||
sm_write_regs(ssm, _dev, capsm_2016_writev, G_N_ELEMENTS(capsm_2016_writev));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -934,7 +935,7 @@ static void capsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
capsm_fire_bulk (ssm);
|
||||
break;
|
||||
case CAPSM_1000_WRITEV:
|
||||
sm_write_regs(ssm, capsm_1000_writev, G_N_ELEMENTS(capsm_1000_writev));
|
||||
sm_write_regs(ssm, _dev, capsm_1000_writev, G_N_ELEMENTS(capsm_1000_writev));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -960,19 +961,19 @@ static void capsm_1001_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
|||
capsm_fire_bulk (ssm);
|
||||
break;
|
||||
case CAPSM_1001_WRITEV_1:
|
||||
sm_write_regs(ssm, capsm_1001_writev_1, G_N_ELEMENTS(capsm_1001_writev_1));
|
||||
sm_write_regs(ssm, _dev, capsm_1001_writev_1, G_N_ELEMENTS(capsm_1001_writev_1));
|
||||
break;
|
||||
case CAPSM_1001_WRITEV_2:
|
||||
sm_write_regs(ssm, capsm_1001_writev_2, G_N_ELEMENTS(capsm_1001_writev_2));
|
||||
sm_write_regs(ssm, _dev, capsm_1001_writev_2, G_N_ELEMENTS(capsm_1001_writev_2));
|
||||
break;
|
||||
case CAPSM_1001_WRITEV_3:
|
||||
sm_write_regs(ssm, capsm_1001_writev_3, G_N_ELEMENTS(capsm_1001_writev_3));
|
||||
sm_write_regs(ssm, _dev, capsm_1001_writev_3, G_N_ELEMENTS(capsm_1001_writev_3));
|
||||
break;
|
||||
case CAPSM_1001_WRITEV_4:
|
||||
sm_write_regs(ssm, capsm_1001_writev_4, G_N_ELEMENTS(capsm_1001_writev_4));
|
||||
sm_write_regs(ssm, _dev, capsm_1001_writev_4, G_N_ELEMENTS(capsm_1001_writev_4));
|
||||
break;
|
||||
case CAPSM_1001_WRITEV_5:
|
||||
sm_write_regs(ssm, capsm_1001_writev_5, G_N_ELEMENTS(capsm_1001_writev_5));
|
||||
sm_write_regs(ssm, _dev, capsm_1001_writev_5, G_N_ELEMENTS(capsm_1001_writev_5));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -998,7 +999,7 @@ static void deinitsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *use
|
|||
{
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case DEINITSM_2016_WRITEV:
|
||||
sm_write_regs(ssm, deinitsm_2016_writev, G_N_ELEMENTS(deinitsm_2016_writev));
|
||||
sm_write_regs(ssm, _dev, deinitsm_2016_writev, G_N_ELEMENTS(deinitsm_2016_writev));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1007,7 +1008,7 @@ static void deinitsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *use
|
|||
{
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case DEINITSM_1000_WRITEV:
|
||||
sm_write_regs(ssm, deinitsm_1000_writev, G_N_ELEMENTS(deinitsm_1000_writev));
|
||||
sm_write_regs(ssm, _dev, deinitsm_1000_writev, G_N_ELEMENTS(deinitsm_1000_writev));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1016,7 +1017,7 @@ static void deinitsm_1001_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *use
|
|||
{
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case DEINITSM_1001_WRITEV:
|
||||
sm_write_regs(ssm, deinitsm_1001_writev, G_N_ELEMENTS(deinitsm_1001_writev));
|
||||
sm_write_regs(ssm, _dev, deinitsm_1001_writev, G_N_ELEMENTS(deinitsm_1001_writev));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1055,7 +1056,7 @@ static void initsm_2016_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_
|
|||
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case INITSM_2016_WRITEV_1:
|
||||
sm_write_regs(ssm, initsm_2016_writev_1, G_N_ELEMENTS(initsm_2016_writev_1));
|
||||
sm_write_regs(ssm, _dev, initsm_2016_writev_1, G_N_ELEMENTS(initsm_2016_writev_1));
|
||||
break;
|
||||
case INITSM_2016_READ_09:
|
||||
sm_read_reg(ssm, 0x09);
|
||||
|
@ -1082,7 +1083,7 @@ static void initsm_1000_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_
|
|||
{
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case INITSM_1000_WRITEV_1:
|
||||
sm_write_regs(ssm, initsm_1000_writev_1, G_N_ELEMENTS(initsm_1000_writev_1));
|
||||
sm_write_regs(ssm, _dev, initsm_1000_writev_1, G_N_ELEMENTS(initsm_1000_writev_1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1091,19 +1092,19 @@ static void initsm_1001_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_
|
|||
{
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
case INITSM_1001_WRITEV_1:
|
||||
sm_write_regs(ssm, initsm_1001_writev_1, G_N_ELEMENTS(initsm_1001_writev_1));
|
||||
sm_write_regs(ssm, _dev, initsm_1001_writev_1, G_N_ELEMENTS(initsm_1001_writev_1));
|
||||
break;
|
||||
case INITSM_1001_WRITEV_2:
|
||||
sm_write_regs(ssm, initsm_1001_writev_2, G_N_ELEMENTS(initsm_1001_writev_2));
|
||||
sm_write_regs(ssm, _dev, initsm_1001_writev_2, G_N_ELEMENTS(initsm_1001_writev_2));
|
||||
break;
|
||||
case INITSM_1001_WRITEV_3:
|
||||
sm_write_regs(ssm, initsm_1001_writev_3, G_N_ELEMENTS(initsm_1001_writev_3));
|
||||
sm_write_regs(ssm, _dev, initsm_1001_writev_3, G_N_ELEMENTS(initsm_1001_writev_3));
|
||||
break;
|
||||
case INITSM_1001_WRITEV_4:
|
||||
sm_write_regs(ssm, initsm_1001_writev_4, G_N_ELEMENTS(initsm_1001_writev_4));
|
||||
sm_write_regs(ssm, _dev, initsm_1001_writev_4, G_N_ELEMENTS(initsm_1001_writev_4));
|
||||
break;
|
||||
case INITSM_1001_WRITEV_5:
|
||||
sm_write_regs(ssm, initsm_1001_writev_5, G_N_ELEMENTS(initsm_1001_writev_5));
|
||||
sm_write_regs(ssm, _dev, initsm_1001_writev_5, G_N_ELEMENTS(initsm_1001_writev_5));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,12 +498,11 @@ static void init_read_data_cb(struct libusb_transfer *transfer)
|
|||
}
|
||||
}
|
||||
|
||||
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct libusb_transfer *transfer;
|
||||
struct fp_img_dev *idev = fpi_ssm_get_user_data(ssm);
|
||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(idev));
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
int r;
|
||||
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
|
|
|
@ -484,11 +484,14 @@ enum initsm_states {
|
|||
INITSM_NUM_STATES,
|
||||
};
|
||||
|
||||
static void initsm_read_msg_response_cb(fpi_ssm *ssm,
|
||||
enum read_msg_status status, uint8_t seq,
|
||||
unsigned char expect_subcmd, unsigned char subcmd)
|
||||
static void
|
||||
initsm_read_msg_response_cb(fpi_ssm *ssm,
|
||||
struct fp_dev *dev,
|
||||
enum read_msg_status status,
|
||||
uint8_t seq,
|
||||
unsigned char expect_subcmd,
|
||||
unsigned char subcmd)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
struct upekts_dev *upekdev = FP_INSTANCE_DATA(dev);
|
||||
|
||||
if (status != READ_MSG_RESPONSE) {
|
||||
|
@ -513,7 +516,7 @@ static void read28_0b_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, status, seq,
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, dev, status, seq,
|
||||
0x0b, subcmd);
|
||||
}
|
||||
|
||||
|
@ -521,7 +524,7 @@ static void read28_0c_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, status, seq,
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, dev, status, seq,
|
||||
0x0c, subcmd);
|
||||
}
|
||||
|
||||
|
@ -529,7 +532,7 @@ static void read28_08_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, status, seq,
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, dev, status, seq,
|
||||
0x08, subcmd);
|
||||
}
|
||||
|
||||
|
@ -537,7 +540,7 @@ static void read28_07_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, status, seq,
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, dev, status, seq,
|
||||
0x07, subcmd);
|
||||
}
|
||||
|
||||
|
@ -545,14 +548,17 @@ static void read28_06_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, status, seq,
|
||||
initsm_read_msg_response_cb((fpi_ssm *) user_data, dev, status, seq,
|
||||
0x06, subcmd);
|
||||
}
|
||||
|
||||
static void initsm_read_msg_cmd_cb(fpi_ssm *ssm,
|
||||
enum read_msg_status status, uint8_t expect_seq, uint8_t seq)
|
||||
static void
|
||||
initsm_read_msg_cmd_cb(fpi_ssm *ssm,
|
||||
struct fp_dev *dev,
|
||||
enum read_msg_status status,
|
||||
uint8_t expect_seq,
|
||||
uint8_t seq)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
struct upekts_dev *upekdev = FP_INSTANCE_DATA(dev);
|
||||
|
||||
if (status == READ_MSG_ERROR) {
|
||||
|
@ -579,14 +585,14 @@ static void read_msg05_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_cmd_cb((fpi_ssm *) user_data, status, 5, seq);
|
||||
initsm_read_msg_cmd_cb((fpi_ssm *) user_data, dev, status, 5, seq);
|
||||
}
|
||||
|
||||
static void read_msg03_cb(struct fp_dev *dev, enum read_msg_status status,
|
||||
uint8_t seq, unsigned char subcmd, unsigned char *data, size_t data_len,
|
||||
void *user_data)
|
||||
{
|
||||
initsm_read_msg_cmd_cb((fpi_ssm *) user_data, status, 3, seq);
|
||||
initsm_read_msg_cmd_cb((fpi_ssm *) user_data, dev, status, 3, seq);
|
||||
}
|
||||
|
||||
static void ctrl400_cb(struct libusb_transfer *transfer)
|
||||
|
@ -601,10 +607,12 @@ static void ctrl400_cb(struct libusb_transfer *transfer)
|
|||
libusb_free_transfer(transfer);
|
||||
}
|
||||
|
||||
static void initsm_read_msg_handler(fpi_ssm *ssm,
|
||||
read_msg_cb_fn callback)
|
||||
static void
|
||||
initsm_read_msg_handler(fpi_ssm *ssm,
|
||||
struct fp_dev *dev,
|
||||
read_msg_cb_fn callback)
|
||||
{
|
||||
int r = read_msg_async(fpi_ssm_get_dev(ssm), callback, ssm);
|
||||
int r = read_msg_async(dev, callback, ssm);
|
||||
if (r < 0) {
|
||||
fp_err("async read msg failed in state %d", fpi_ssm_get_cur_state(ssm));
|
||||
fpi_ssm_mark_failed(ssm, r);
|
||||
|
@ -626,10 +634,13 @@ static void initsm_send_msg_cb(struct libusb_transfer *transfer)
|
|||
libusb_free_transfer(transfer);
|
||||
}
|
||||
|
||||
static void initsm_send_msg28_handler(fpi_ssm *ssm,
|
||||
unsigned char subcmd, const unsigned char *data, uint16_t innerlen)
|
||||
static void
|
||||
initsm_send_msg28_handler(fpi_ssm *ssm,
|
||||
struct fp_dev *dev,
|
||||
unsigned char subcmd,
|
||||
const unsigned char *data,
|
||||
uint16_t innerlen)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
struct libusb_transfer *transfer;
|
||||
int r;
|
||||
|
||||
|
@ -649,9 +660,8 @@ static void initsm_send_msg28_handler(fpi_ssm *ssm,
|
|||
}
|
||||
}
|
||||
|
||||
static void initsm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void initsm_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
struct upekts_dev *upekdev = FP_INSTANCE_DATA(dev);
|
||||
struct libusb_transfer *transfer;
|
||||
int r;
|
||||
|
@ -680,7 +690,7 @@ static void initsm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
}
|
||||
break;
|
||||
case READ_MSG03:
|
||||
initsm_read_msg_handler(ssm, read_msg03_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read_msg03_cb);
|
||||
break;
|
||||
case SEND_RESP03: ;
|
||||
transfer = alloc_send_cmdresponse_transfer(dev, ++upekdev->seq,
|
||||
|
@ -698,40 +708,40 @@ static void initsm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
|||
}
|
||||
break;
|
||||
case READ_MSG05:
|
||||
initsm_read_msg_handler(ssm, read_msg05_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read_msg05_cb);
|
||||
break;
|
||||
case SEND28_06: ;
|
||||
unsigned char dummy28_06 = 0x04;
|
||||
upekdev->seq = 0xf0;
|
||||
initsm_send_msg28_handler(ssm, 0x06, &dummy28_06, 1);
|
||||
initsm_send_msg28_handler(ssm, dev, 0x06, &dummy28_06, 1);
|
||||
break;
|
||||
case READ28_06:
|
||||
initsm_read_msg_handler(ssm, read28_06_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read28_06_cb);
|
||||
break;
|
||||
case SEND28_07: ;
|
||||
unsigned char dummy28_07 = 0x04;
|
||||
initsm_send_msg28_handler(ssm, 0x07, &dummy28_07, 1);
|
||||
initsm_send_msg28_handler(ssm, dev, 0x07, &dummy28_07, 1);
|
||||
break;
|
||||
case READ28_07:
|
||||
initsm_read_msg_handler(ssm, read28_07_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read28_07_cb);
|
||||
break;
|
||||
case SEND28_08:
|
||||
initsm_send_msg28_handler(ssm, 0x08, init28_08, sizeof(init28_08));
|
||||
initsm_send_msg28_handler(ssm, dev, 0x08, init28_08, sizeof(init28_08));
|
||||
break;
|
||||
case READ28_08:
|
||||
initsm_read_msg_handler(ssm, read28_08_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read28_08_cb);
|
||||
break;
|
||||
case SEND28_0C:
|
||||
initsm_send_msg28_handler(ssm, 0x0c, init28_0c, sizeof(init28_0c));
|
||||
initsm_send_msg28_handler(ssm, dev, 0x0c, init28_0c, sizeof(init28_0c));
|
||||
break;
|
||||
case READ28_0C:
|
||||
initsm_read_msg_handler(ssm, read28_0c_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read28_0c_cb);
|
||||
break;
|
||||
case SEND28_0B:
|
||||
initsm_send_msg28_handler(ssm, 0x0b, init28_0b, sizeof(init28_0b));
|
||||
initsm_send_msg28_handler(ssm, dev, 0x0b, init28_0b, sizeof(init28_0b));
|
||||
break;
|
||||
case READ28_0B:
|
||||
initsm_read_msg_handler(ssm, read28_0b_cb);
|
||||
initsm_read_msg_handler(ssm, dev, read28_0b_cb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -785,9 +795,8 @@ static void read_msg01_cb(struct fp_dev *dev, enum read_msg_status status,
|
|||
fpi_ssm_next_state(ssm);
|
||||
}
|
||||
|
||||
static void deinitsm_state_handler(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void deinitsm_state_handler(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
int r;
|
||||
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
|
@ -917,9 +926,8 @@ static void enroll_start_sm_cb_msg28(struct fp_dev *dev,
|
|||
}
|
||||
}
|
||||
|
||||
static void enroll_start_sm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void enroll_start_sm_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
int r;
|
||||
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
|
@ -1112,9 +1120,8 @@ static void enroll_iterate(struct fp_dev *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void enroll_started(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void enroll_started(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
fpi_drvcb_enroll_started(dev, fpi_ssm_get_error(ssm));
|
||||
|
||||
if (!fpi_ssm_get_error(ssm))
|
||||
|
@ -1136,10 +1143,10 @@ static int enroll_start(struct fp_dev *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void enroll_stop_deinit_cb(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void enroll_stop_deinit_cb(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
/* don't really care about errors */
|
||||
fpi_drvcb_enroll_stopped(fpi_ssm_get_dev(ssm));
|
||||
fpi_drvcb_enroll_stopped(dev);
|
||||
fpi_ssm_free(ssm);
|
||||
}
|
||||
|
||||
|
@ -1150,10 +1157,10 @@ static int enroll_stop(struct fp_dev *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void verify_stop_deinit_cb(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void verify_stop_deinit_cb(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
/* don't really care about errors */
|
||||
fpi_drvcb_verify_stopped(fpi_ssm_get_dev(ssm));
|
||||
fpi_drvcb_verify_stopped(dev);
|
||||
fpi_ssm_free(ssm);
|
||||
}
|
||||
|
||||
|
@ -1201,9 +1208,8 @@ static void verify_init_2803_cb(struct libusb_transfer *transfer)
|
|||
libusb_free_transfer(transfer);
|
||||
}
|
||||
|
||||
static void verify_start_sm_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void verify_start_sm_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
int r;
|
||||
|
||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||
|
@ -1390,9 +1396,8 @@ static void verify_iterate(struct fp_dev *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void verify_started(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
||||
static void verify_started(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
||||
{
|
||||
struct fp_dev *dev = fpi_ssm_get_dev(ssm);
|
||||
struct upekts_dev *upekdev = FP_INSTANCE_DATA(dev);
|
||||
|
||||
fpi_drvcb_verify_started(dev, fpi_ssm_get_error(ssm));
|
||||
|
|
|
@ -116,21 +116,6 @@ fpi_ssm *fpi_ssm_new(struct fp_dev *dev,
|
|||
return machine;
|
||||
}
|
||||
|
||||
/**
|
||||
* fpi_ssm_get_dev:
|
||||
* @machine: an #fpi_ssm state machine
|
||||
*
|
||||
* Returns the #fp_dev attached to the #fpi_ssm as passed
|
||||
* in fpi_ssm_new().
|
||||
*
|
||||
* Returns: a struct #fp_dev
|
||||
*/
|
||||
struct fp_dev *
|
||||
fpi_ssm_get_dev(fpi_ssm *machine)
|
||||
{
|
||||
return machine->dev;
|
||||
}
|
||||
|
||||
/**
|
||||
* fpi_ssm_get_user_data:
|
||||
* @machine: an #fpi_ssm state machine
|
||||
|
|
|
@ -79,7 +79,6 @@ void fpi_ssm_next_state(fpi_ssm *machine);
|
|||
void fpi_ssm_jump_to_state(fpi_ssm *machine, int state);
|
||||
void fpi_ssm_mark_completed(fpi_ssm *machine);
|
||||
void fpi_ssm_mark_failed(fpi_ssm *machine, int error);
|
||||
struct fp_dev *fpi_ssm_get_dev(fpi_ssm *machine);
|
||||
void *fpi_ssm_get_user_data(fpi_ssm *machine);
|
||||
int fpi_ssm_get_error(fpi_ssm *machine);
|
||||
int fpi_ssm_get_cur_state(fpi_ssm *machine);
|
||||
|
|
Loading…
Reference in a new issue