diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c index 28b77b6..3794996 100644 --- a/libfprint/drivers/vfs5011.c +++ b/libfprint/drivers/vfs5011.c @@ -244,61 +244,6 @@ static void usb_exchange_async(struct fpi_ssm *ssm, struct usbexchange_data *dat fpi_ssm_start_subsm(ssm, subsm); } -static int usb_exchange_sync(struct usbexchange_data *data) -{ - for (int i = 0; i < data->stepcount; i++) { - struct usb_action *action = &data->actions[i]; - int ret = -EINVAL; - int transferred = 0; - switch (action->type) { - case ACTION_SEND: - fp_dbg("Sending %s", action->name); - ret = libusb_bulk_transfer(data->device->udev, action->endpoint, action->data, - action->size, &transferred, data->timeout); - if (ret != 0) { - fp_err("USB transfer error: %s", strerror(ret)); - return ret; - } - if (transferred != action->size) { - /* Data sended mismatch with expected, return protocol error */ - fp_err("length mismatch, got %d, expected %d", - transferred, action->size); - return -EIO; - } - break; - - case ACTION_RECEIVE: - fp_dbg("Receiving %d bytes", action->size); - ret = libusb_bulk_transfer(data->device->udev, action->endpoint, data->receive_buf, - action->size, &transferred, data->timeout); - if (ret != 0) { - fp_err("USB transfer error: %s", strerror(ret)); - return ret; - } - if (action->data != NULL) { - if (transferred != action->correct_reply_size) { - fp_err("Got %d bytes instead of %d", transferred, - action->correct_reply_size); - return -EIO; - } - if (memcmp(data->receive_buf, action->data, action->correct_reply_size) != 0) { - fp_dbg("Wrong reply:"); - dump(data->receive_buf, transferred); - return -EIO; - } - } else - fp_dbg("Got %d bytes out of %d", transferred, - action->size); - break; - - default: - fp_err("Bug detected: invalid action %d", action->type); - return -EINVAL; - } - } - return 0; -} - //====================== utils ======================= #if VFS5011_LINE_SIZE > INT_MAX/(256*256) @@ -858,13 +803,7 @@ static void activate_loop(struct fpi_ssm *ssm) data->init_sequence.device = dev; data->init_sequence.receive_buf = malloc(VFS5011_RECEIVE_BUF_SIZE); data->init_sequence.timeout = 1000; - r = usb_exchange_sync(&data->init_sequence); - if (r != 0) { - fp_err("Failed to initiate the capture"); - fpi_imgdev_session_error(dev, r); - fpi_ssm_mark_aborted(ssm, r); - } else - fpi_ssm_next_state(ssm); + usb_exchange_async(ssm, &data->init_sequence); break; case DEV_ACTIVATE_INIT_COMPLETE: