 +			return;
 +		}
 +		libusb_fill_bulk_transfer(transfer, data->device->udev, action->endpoint, action->data,
-+		                          action->size, async_send_cb, ssm, BULK_TIMEOUT);
++		                          action->size, async_send_cb, ssm, data->timeout);
 +		ret = libusb_submit_transfer(transfer);
 +		break;
 +		

+		}
+		break;
+	
+	case M_PREPARE_NEXT_CAPTURE:
+		data->init_sequence.stepcount = array_n_elements(vfs5011_initiate_capture);
+		data->init_sequence.actions = vfs5011_initiate_capture;
+		data->init_sequence.device = dev;
+		data->init_sequence.receive_buf = malloc(VFS5011_RECEIVE_BUF_SIZE);
+		usb_exchange_async(ssm, &data->init_sequence);
+		break;
+	
+	case M_FINISHED:
+		fp_dbg("finishing");
+		free(data->init_sequence.receive_buf);
+		data->init_sequence.receive_buf = NULL;
+		submit_image(ssm, data);
+		fpi_imgdev_report_finger_status(dev, FALSE);
+		fpi_ssm_mark_completed(ssm);
+		break;
+	}
+}
+
+static void main_loop_complete(struct fpi_ssm *ssm)
+{
+	fpi_ssm_free(ssm);
+}
+

+	libusb_free_transfer(transfer);
+}
+
+static void async_recv_cb(struct libusb_transfer *transfer)
+{
+	struct fpi_ssm *ssm = transfer->user_data;
