示例#1
0
static void activate_sm_complete(struct fpi_ssm *ssm)
{
	struct fp_img_dev *dev = ssm->priv;
	fp_dbg("status %d", ssm->error);
	fpi_imgdev_activate_complete(dev, ssm->error);

	if (!ssm->error)
		start_finger_detection(dev);
	fpi_ssm_free(ssm);
}
示例#2
0
static int dev_activate(struct fp_img_dev *dev, enum fp_imgdev_state state)
{
	struct v5s_dev *vdev = dev->priv;
	struct fpi_ssm *ssm = fpi_ssm_new(dev->dev, loop_run_state,
		LOOP_NUM_STATES);
	ssm->priv = dev;
	vdev->deactivating = FALSE;
	fpi_ssm_start(ssm, loopsm_complete);
	vdev->loop_running = TRUE;
	fpi_imgdev_activate_complete(dev, 0);
	return 0;
}
/* jump to finger detection */
static void activate_sm_complete(struct fpi_ssm *ssm)
{
	static struct poll_data adata;
	
	struct fp_img_dev *dev = ssm->priv;
	fp_dbg("status %d", ssm->error);
	fpi_imgdev_activate_complete(dev, ssm->error);

	if (!ssm->error)
		memset(&einit,0,sizeof(struct et_init));
		adata.dev=(struct fpi_img_dev*)dev;
		adata.init=&einit;
		start_finger_detection(dev,&adata);
	fpi_ssm_free(ssm);
}
示例#4
0
文件: vfs301.c 项目: kunalg/libfprint
/* Complete init sequential state machine */
static void m_init_complete(struct fpi_ssm *ssm)
{
	struct fp_img_dev *dev = ssm->priv;
	struct fpi_ssm *ssm_loop;

	if (!ssm->error) {
		/* Notify activate complete */
		fpi_imgdev_activate_complete(dev, 0);

		/* Start loop ssm */
		ssm_loop = fpi_ssm_new(dev->dev, m_loop_state, M_LOOP_NUM_STATES);
		ssm_loop->priv = dev;
		fpi_ssm_start(ssm_loop, m_loop_complete);
	}

	/* Free sequential state machine */
	fpi_ssm_free(ssm);
}
示例#5
0
static void state_activate(struct fpi_ssm *ssm)
{
    struct libusb_transfer *transfer;
    struct fp_img_dev *dev = ssm->priv;
    struct vfs0050_dev *vfs_dev = dev->priv;
    int to_send;
    switch (ssm->cur_state) {
    case M_ACTIVATE_START:
        vfs_dev->activate_offset = 0;
        transfer = libusb_alloc_transfer(0);
        libusb_fill_bulk_transfer(transfer, dev->udev, EP1_OUT, vfs0050_activate1, 64, state_activate_cb, ssm, BULK_TIMEOUT);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_1_STEP2:
        transfer = libusb_alloc_transfer(0);
        libusb_fill_bulk_transfer(transfer, dev->udev, EP1_OUT, vfs0050_activate1 + 64, 61, state_activate_cb, ssm, BULK_TIMEOUT);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_1_SINGLE_READ:
        transfer = libusb_alloc_transfer(0);
        libusb_fill_bulk_transfer(transfer, dev->udev, EP1_IN, vfs_dev->tmpbuf, 64, state_activate_cb, ssm, BULK_TIMEOUT);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_2_SEND:
        to_send = sizeof(vfs0050_activate2) - vfs_dev->activate_offset;
        to_send = to_send >= 64 ? 64 : to_send;
        transfer = libusb_alloc_transfer(0);
        libusb_fill_bulk_transfer(transfer, dev->udev, EP1_OUT, vfs0050_activate2 + vfs_dev->activate_offset, to_send, state_activate_cb, ssm, BULK_TIMEOUT);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_EP1_DRAIN:
        transfer = libusb_alloc_transfer(0);
        libusb_fill_bulk_transfer(transfer, dev->udev, EP1_IN, vfs_dev->tmpbuf, 64, state_activate_cb, ssm, BULK_TIMEOUT);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_EP3_INT1: //first interrupt, should be 5 x 0x00
        transfer = libusb_alloc_transfer(0);
        libusb_fill_interrupt_transfer(transfer, dev->udev, EP3_IN, vfs_dev->tmpbuf, 8, state_activate_cb, ssm, INTERRUPT_TIMEOUT1);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_AWAIT_FINGER:
        //this sets up infinite wait for interrupt.  When the interrupt occurs, we're ready to read data on EP2.
        if (!vfs_dev->is_active) {
            vfs_dev->is_active = 1;
            fpi_imgdev_activate_complete(dev, 0); //notify libfprint activation complete.
        }
        transfer = libusb_alloc_transfer(0);
        libusb_fill_interrupt_transfer(transfer, dev->udev, EP3_IN, vfs_dev->tmpbuf, 8, state_activate_cb, ssm, INTERRUPT_TIMEOUT_NONE);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_RECEIVE_FINGERPRINT:
        if (vfs_dev->scanbuf_idx + 64 >= vfs_dev->scanbuf_sz) {
            vfs_dev->scanbuf_sz <<= 1;
            vfs_dev->scanbuf = g_realloc(vfs_dev->scanbuf, vfs_dev->scanbuf_sz);
        }
        transfer = libusb_alloc_transfer(0);
        libusb_fill_bulk_transfer(transfer, dev->udev, EP2_IN, vfs_dev->scanbuf + vfs_dev->scanbuf_idx, 64, state_activate_cb, ssm, 500);
        libusb_submit_transfer(transfer);
        break;
    case M_ACTIVATE_POST_RECEIVE:
        submit_image(dev);
        fpi_imgdev_report_finger_status(dev, FALSE);
        vfs_dev->activate_offset = 0;
        vfs_dev->scanbuf_idx = 0;
        fpi_timeout_add(300, async_sleep_cb, ssm); //wait a bit and see if we're swiping again.
        break;

    }
}