Index: uspace/lib/usbvirt/src/ipc_dev.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_dev.c	(revision e25a849b8efb13e779f8c2ac0844acd744764f61)
+++ uspace/lib/usbvirt/src/ipc_dev.c	(revision 1e19a15297126d355926ce3fb61376426ea9ba62)
@@ -43,4 +43,10 @@
 #include <usb/debug.h>
 
+/** Handle VHC request for device name.
+ *
+ * @param dev Target virtual device.
+ * @param iid Caller id.
+ * @param icall The call with the request.
+ */
 static void ipc_get_name(usbvirt_device_t *dev,
     ipc_callid_t iid, ipc_call_t *icall)
@@ -67,9 +73,13 @@
 }
 
+/** Handle VHC request for control read from the device.
+ *
+ * @param dev Target virtual device.
+ * @param iid Caller id.
+ * @param icall The call with the request.
+ */
 static void ipc_control_read(usbvirt_device_t *dev,
     ipc_callid_t iid, ipc_call_t *icall)
 {
-	//usb_endpoint_t endpoint = IPC_GET_ARG1(*icall);
-
 	int rc;
 
@@ -118,8 +128,14 @@
 }
 
+/** Handle VHC request for control write to the device.
+ *
+ * @param dev Target virtual device.
+ * @param iid Caller id.
+ * @param icall The call with the request.
+ */
 static void ipc_control_write(usbvirt_device_t *dev,
     ipc_callid_t iid, ipc_call_t *icall)
 {
-	size_t data_buffer_len = IPC_GET_ARG2(*icall);
+	size_t data_buffer_len = IPC_GET_ARG1(*icall);
 	int rc;
 
@@ -129,5 +145,5 @@
 
 	rc = async_data_write_accept(&setup_packet, false,
-	    1, 1024, 0, &setup_packet_len);
+	    1, 0, 0, &setup_packet_len);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -137,5 +153,5 @@
 	if (data_buffer_len > 0) {
 		rc = async_data_write_accept(&data_buffer, false,
-		    1, 1024, 0, &data_buffer_len);
+		    1, 0, 0, &data_buffer_len);
 		if (rc != EOK) {
 			async_answer_0(iid, rc);
@@ -149,11 +165,22 @@
 
 	async_answer_0(iid, rc);
-}
-
-static void ipc_interrupt_in(usbvirt_device_t *dev,
+
+	free(setup_packet);
+	if (data_buffer != NULL) {
+		free(data_buffer);
+	}
+}
+
+/** Handle VHC request for data read from the device (in transfer).
+ *
+ * @param dev Target virtual device.
+ * @param iid Caller id.
+ * @param icall The call with the request.
+ */
+static void ipc_data_in(usbvirt_device_t *dev,
+    usb_transfer_type_t transfer_type,
     ipc_callid_t iid, ipc_call_t *icall)
 {
 	usb_endpoint_t endpoint = IPC_GET_ARG1(*icall);
-	usb_transfer_type_t transfer_type = IPC_GET_ARG2(*icall);
 
 	int rc;
@@ -189,9 +216,15 @@
 }
 
-static void ipc_interrupt_out(usbvirt_device_t *dev,
+/** Handle VHC request for data write to the device (out transfer).
+ *
+ * @param dev Target virtual device.
+ * @param iid Caller id.
+ * @param icall The call with the request.
+ */
+static void ipc_data_out(usbvirt_device_t *dev,
+    usb_transfer_type_t transfer_type,
     ipc_callid_t iid, ipc_call_t *icall)
 {
 	usb_endpoint_t endpoint = IPC_GET_ARG1(*icall);
-	usb_transfer_type_t transfer_type = IPC_GET_ARG2(*icall);
 
 	void *data_buffer = NULL;
@@ -199,5 +232,5 @@
 
 	int rc = async_data_write_accept(&data_buffer, false,
-	    1, 1024, 0, &data_buffer_size);
+	    1, 0, 0, &data_buffer_size);
 	if (rc != EOK) {
 		async_answer_0(iid, rc);
@@ -213,31 +246,46 @@
 }
 
-
+/** Handle incoming IPC call for virtual USB device.
+ *
+ * @param dev Target USB device.
+ * @param callid Caller id.
+ * @param call Incoming call.
+ * @return Whether the call was handled.
+ */
 bool usbvirt_ipc_handle_call(usbvirt_device_t *dev,
     ipc_callid_t callid, ipc_call_t *call)
 {
 	switch (IPC_GET_IMETHOD(*call)) {
-		case IPC_M_USBVIRT_GET_NAME:
-			ipc_get_name(dev, callid, call);
-			break;
-
-		case IPC_M_USBVIRT_CONTROL_READ:
-			ipc_control_read(dev, callid, call);
-			break;
-
-		case IPC_M_USBVIRT_CONTROL_WRITE:
-			ipc_control_write(dev, callid, call);
-			break;
-
-		case IPC_M_USBVIRT_INTERRUPT_IN:
-			ipc_interrupt_in(dev, callid, call);
-			break;
-
-		case IPC_M_USBVIRT_INTERRUPT_OUT:
-			ipc_interrupt_out(dev, callid, call);
-			break;
-
-		default:
-			return false;
+	case IPC_M_USBVIRT_GET_NAME:
+		ipc_get_name(dev, callid, call);
+		break;
+
+	case IPC_M_USBVIRT_CONTROL_READ:
+		ipc_control_read(dev, callid, call);
+		break;
+
+	case IPC_M_USBVIRT_CONTROL_WRITE:
+		ipc_control_write(dev, callid, call);
+		break;
+
+	case IPC_M_USBVIRT_INTERRUPT_IN:
+		ipc_data_in(dev, USB_TRANSFER_INTERRUPT, callid, call);
+		break;
+
+	case IPC_M_USBVIRT_BULK_IN:
+		ipc_data_in(dev, USB_TRANSFER_BULK, callid, call);
+		break;
+
+	case IPC_M_USBVIRT_INTERRUPT_OUT:
+		ipc_data_out(dev, USB_TRANSFER_INTERRUPT, callid, call);
+		break;
+
+	case IPC_M_USBVIRT_BULK_OUT:
+		ipc_data_out(dev, USB_TRANSFER_BULK, callid, call);
+		break;
+
+
+	default:
+		return false;
 	}
 
