Index: uspace/lib/usb/src/pipes.c
===================================================================
--- uspace/lib/usb/src/pipes.c	(revision 6865243cd55833c9c1472bd831983d5ebe21226e)
+++ uspace/lib/usb/src/pipes.c	(revision 97532207cccbbd72946d811fe8224a29ebdbdb70)
@@ -45,4 +45,12 @@
 #include <usb/pipes.h>
 #include <errno.h>
+#include <assert.h>
+#include <usb/usbdrv.h>
+
+#define _PREPARE_TARGET(varname, pipe) \
+	usb_target_t varname = { \
+		.address = (pipe)->wire->address, \
+		.endpoint = (pipe)->endpoint_no \
+	}
 
 /** Initialize connection to USB device.
@@ -55,5 +63,29 @@
     device_t *device)
 {
-	return ENOTSUP;
+	assert(connection);
+	assert(device);
+
+	int rc;
+	devman_handle_t hc_handle;
+	usb_address_t my_address;
+
+	rc = usb_drv_find_hc(device, &hc_handle);
+	if (rc != EOK) {
+		return rc;
+	}
+
+	int hc_phone = devman_device_connect(hc_handle, 0);
+	if (hc_phone < 0) {
+		return hc_phone;
+	}
+
+	my_address = usb_drv_get_my_address(hc_phone, device);
+	if (my_address < 0) {
+		return my_address;
+	}
+
+	connection->hc_handle = hc_handle;
+	connection->address = my_address;
+	return EOK;
 }
 
@@ -72,5 +104,14 @@
     usb_transfer_type_t transfer_type, usb_direction_t direction)
 {
-	return ENOTSUP;
+	assert(pipe);
+	assert(connection);
+
+	pipe->wire = connection;
+	pipe->hc_phone = -1;
+	pipe->endpoint_no = endpoint_no;
+	pipe->transfer_type = transfer_type;
+	pipe->direction = direction;
+
+	return EOK;
 }
 
@@ -85,5 +126,11 @@
     usb_device_connection_t *connection)
 {
-	return ENOTSUP;
+	assert(pipe);
+	assert(connection);
+
+	int rc = usb_endpoint_pipe_initialize(pipe, connection,
+	    0, USB_TRANSFER_CONTROL, USB_DIRECTION_BOTH);
+
+	return rc;
 }
 
@@ -106,5 +153,18 @@
 int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *pipe)
 {
-	return ENOTSUP;
+	assert(pipe);
+
+	if (pipe->hc_phone >= 0) {
+		return EBUSY;
+	}
+
+	int phone = devman_device_connect(pipe->wire->hc_handle, 0);
+	if (phone < 0) {
+		return phone;
+	}
+
+	pipe->hc_phone = phone;
+
+	return EOK;
 }
 
@@ -119,5 +179,18 @@
 int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *pipe)
 {
-	return ENOTSUP;
+	assert(pipe);
+
+	if (pipe->hc_phone < 0) {
+		return ENOENT;
+	}
+
+	int rc = ipc_hangup(pipe->hc_phone);
+	if (rc != EOK) {
+		return rc;
+	}
+
+	pipe->hc_phone = -1;
+
+	return EOK;
 }
 
@@ -134,5 +207,17 @@
     void *buffer, size_t size, size_t *size_transfered)
 {
-	return ENOTSUP;
+	assert(pipe);
+
+	int rc;
+	usb_handle_t handle;
+
+	rc = usb_endpoint_pipe_async_read(pipe, buffer, size, size_transfered,
+	    &handle);
+	if (rc != EOK) {
+		return rc;
+	}
+
+	rc = usb_endpoint_pipe_wait_for(pipe, handle);
+	return rc;
 }
 
@@ -147,5 +232,16 @@
     void *buffer, size_t size)
 {
-	return ENOTSUP;
+	assert(pipe);
+
+	int rc;
+	usb_handle_t handle;
+
+	rc = usb_endpoint_pipe_async_write(pipe, buffer, size, &handle);
+	if (rc != EOK) {
+		return rc;
+	}
+
+	rc = usb_endpoint_pipe_wait_for(pipe, handle);
+	return rc;
 }
 
@@ -204,5 +300,31 @@
     usb_handle_t *handle)
 {
-	return ENOTSUP;
+	assert(pipe);
+
+	if (pipe->hc_phone < 0) {
+		return EBADF;
+	}
+
+	if (pipe->direction != USB_DIRECTION_IN) {
+		return EBADF;
+	}
+
+	int rc;
+	_PREPARE_TARGET(target, pipe);
+
+	switch (pipe->transfer_type) {
+		case USB_TRANSFER_INTERRUPT:
+			rc = usb_drv_async_interrupt_in(pipe->hc_phone, target,
+			    buffer, size, size_transfered, handle);
+			break;
+		case USB_TRANSFER_CONTROL:
+			rc = EBADF;
+			break;
+		default:
+			rc = ENOTSUP;
+			break;
+	}
+
+	return rc;
 }
 
@@ -220,5 +342,31 @@
     usb_handle_t *handle)
 {
-	return ENOTSUP;
+	assert(pipe);
+
+	if (pipe->hc_phone < 0) {
+		return EBADF;
+	}
+
+	if (pipe->direction != USB_DIRECTION_OUT) {
+		return EBADF;
+	}
+
+	int rc;
+	_PREPARE_TARGET(target, pipe);
+
+	switch (pipe->transfer_type) {
+		case USB_TRANSFER_INTERRUPT:
+			rc = usb_drv_async_interrupt_out(pipe->hc_phone, target,
+			    buffer, size, handle);
+			break;
+		case USB_TRANSFER_CONTROL:
+			rc = EBADF;
+			break;
+		default:
+			rc = ENOTSUP;
+			break;
+	}
+
+	return rc;
 }
 
@@ -278,5 +426,5 @@
 int usb_endpoint_pipe_wait_for(usb_endpoint_pipe_t *pipe, usb_handle_t handle)
 {
-	return ENOTSUP;
+	return usb_drv_async_wait_for(handle);
 }
 
