Index: uspace/lib/usb/Makefile
===================================================================
--- uspace/lib/usb/Makefile	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ uspace/lib/usb/Makefile	(revision 9f554e64df31f9bb0353d424d7c05a9c79624c45)
@@ -38,5 +38,4 @@
 	src/debug.c \
 	src/dp.c \
-	src/drvpsync.c \
 	src/dump.c \
 	src/hidparser.c \
@@ -49,6 +48,4 @@
 	src/usb.c \
 	src/usbdevice.c \
-	src/usbdrvreq.c \
-	src/usbdrv.c \
 	src/usbmem.c
 
Index: uspace/lib/usb/include/usb/devreq.h
===================================================================
--- uspace/lib/usb/include/usb/devreq.h	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief Standard USB device requests.
- */
-#ifndef LIBUSB_DEVREQ_H_
-#define LIBUSB_DEVREQ_H_
-
-#include <async.h>
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-
-/** Standard device request. */
-typedef enum {
-	USB_DEVREQ_GET_STATUS = 0,
-	USB_DEVREQ_CLEAR_FEATURE = 1,
-	USB_DEVREQ_SET_FEATURE = 3,
-	USB_DEVREQ_SET_ADDRESS = 5,
-	USB_DEVREQ_GET_DESCRIPTOR = 6,
-	USB_DEVREQ_SET_DESCRIPTOR = 7,
-	USB_DEVREQ_GET_CONFIGURATION = 8,
-	USB_DEVREQ_SET_CONFIGURATION = 9,
-	USB_DEVREQ_GET_INTERFACE = 10,
-	USB_DEVREQ_SET_INTERFACE = 11,
-	USB_DEVREQ_SYNCH_FRAME = 12,
-	USB_DEVREQ_LAST_STD
-} usb_stddevreq_t;
-
-/** Device request setup packet.
- * The setup packet describes the request.
- */
-typedef struct {
-	/** Request type.
-	 * The type combines transfer direction, request type and
-	 * intended recipient.
-	 */
-	uint8_t request_type;
-	/** Request identification. */
-	uint8_t request;
-	/** Main parameter to the request. */
-	union {
-		uint16_t value;
-		/* FIXME: add #ifdefs according to host endianess */
-		struct {
-			uint8_t value_low;
-			uint8_t value_high;
-		};
-	};
-	/** Auxiliary parameter to the request.
-	 * Typically, it is offset to something.
-	 */
-	uint16_t index;
-	/** Length of extra data. */
-	uint16_t length;
-} __attribute__ ((packed)) usb_device_request_setup_packet_t;
-
-
-int usb_drv_req_get_status(int, usb_address_t, usb_request_recipient_t,
-    uint16_t, uint16_t *);
-int usb_drv_req_clear_feature(int, usb_address_t, usb_request_recipient_t,
-    uint16_t, uint16_t);
-int usb_drv_req_set_feature(int, usb_address_t, usb_request_recipient_t,
-    uint16_t, uint16_t);
-int usb_drv_req_set_address(int, usb_address_t, usb_address_t);
-int usb_drv_req_get_descriptor(int, usb_address_t, usb_request_type_t,
-    uint8_t, uint8_t, uint16_t, void *, size_t, size_t *);
-int usb_drv_req_get_device_descriptor(int, usb_address_t,
-    usb_standard_device_descriptor_t *);
-int usb_drv_req_get_bare_configuration_descriptor(int, usb_address_t, int,
-    usb_standard_configuration_descriptor_t *);
-int usb_drv_req_get_full_configuration_descriptor(int, usb_address_t, int,
-    void *, size_t, size_t *);
-int usb_drv_req_set_descriptor(int, usb_address_t, uint8_t, uint8_t, uint16_t,
-    void *, size_t);
-int usb_drv_req_get_configuration(int, usb_address_t, uint8_t *);
-int usb_drv_req_set_configuration(int, usb_address_t, uint8_t);
-int usb_drv_req_get_interface(int, usb_address_t, uint16_t, uint8_t *);
-int usb_drv_req_set_interface(int, usb_address_t, uint16_t, uint8_t);
-
-#endif
-/**
- * @}
- */
Index: uspace/lib/usb/include/usb/recognise.h
===================================================================
--- uspace/lib/usb/include/usb/recognise.h	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ uspace/lib/usb/include/usb/recognise.h	(revision 9f554e64df31f9bb0353d424d7c05a9c79624c45)
@@ -41,4 +41,7 @@
 #include <ipc/devman.h>
 
+int usb_device_create_match_ids_from_device_descriptor(
+    const usb_standard_device_descriptor_t *, match_id_list_t *);
+
 int usb_device_create_match_ids_from_interface(
     const usb_standard_device_descriptor_t *,
Index: uspace/lib/usb/include/usb/request.h
===================================================================
--- uspace/lib/usb/include/usb/request.h	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ uspace/lib/usb/include/usb/request.h	(revision 9f554e64df31f9bb0353d424d7c05a9c79624c45)
@@ -41,4 +41,48 @@
 #include <usb/descriptor.h>
 
+/** Standard device request. */
+typedef enum {
+	USB_DEVREQ_GET_STATUS = 0,
+	USB_DEVREQ_CLEAR_FEATURE = 1,
+	USB_DEVREQ_SET_FEATURE = 3,
+	USB_DEVREQ_SET_ADDRESS = 5,
+	USB_DEVREQ_GET_DESCRIPTOR = 6,
+	USB_DEVREQ_SET_DESCRIPTOR = 7,
+	USB_DEVREQ_GET_CONFIGURATION = 8,
+	USB_DEVREQ_SET_CONFIGURATION = 9,
+	USB_DEVREQ_GET_INTERFACE = 10,
+	USB_DEVREQ_SET_INTERFACE = 11,
+	USB_DEVREQ_SYNCH_FRAME = 12,
+	USB_DEVREQ_LAST_STD
+} usb_stddevreq_t;
+
+/** Device request setup packet.
+ * The setup packet describes the request.
+ */
+typedef struct {
+	/** Request type.
+	 * The type combines transfer direction, request type and
+	 * intended recipient.
+	 */
+	uint8_t request_type;
+	/** Request identification. */
+	uint8_t request;
+	/** Main parameter to the request. */
+	union {
+		uint16_t value;
+		/* FIXME: add #ifdefs according to host endianess */
+		struct {
+			uint8_t value_low;
+			uint8_t value_high;
+		};
+	};
+	/** Auxiliary parameter to the request.
+	 * Typically, it is offset to something.
+	 */
+	uint16_t index;
+	/** Length of extra data. */
+	uint16_t length;
+} __attribute__ ((packed)) usb_device_request_setup_packet_t;
+
 int usb_control_request_set(usb_endpoint_pipe_t *,
     usb_request_type_t, usb_request_recipient_t, uint8_t,
Index: uspace/lib/usb/include/usb/usbdrv.h
===================================================================
--- uspace/lib/usb/include/usb/usbdrv.h	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief USB driver.
- */
-#ifndef LIBUSB_USBDRV_H_
-#define LIBUSB_USBDRV_H_
-
-#include <usb/usb.h>
-#include <driver.h>
-#include <usb/devreq.h>
-#include <usb/descriptor.h>
-
-int usb_drv_find_hc(device_t *, devman_handle_t *);
-int usb_drv_hc_connect(device_t *, devman_handle_t, unsigned int);
-int usb_drv_hc_connect_auto(device_t *, unsigned int);
-
-int usb_drv_reserve_default_address(int);
-int usb_drv_release_default_address(int);
-usb_address_t usb_drv_request_address(int);
-int usb_drv_bind_address(int, usb_address_t, devman_handle_t);
-int usb_drv_release_address(int, usb_address_t);
-
-usb_address_t usb_drv_get_my_address(int, device_t *);
-
-int usb_drv_async_interrupt_out(int, usb_target_t,
-    void *, size_t, usb_handle_t *);
-int usb_drv_async_interrupt_in(int, usb_target_t,
-    void *, size_t, size_t *, usb_handle_t *);
-
-int usb_drv_psync_interrupt_out(int, usb_target_t, void *, size_t);
-int usb_drv_psync_interrupt_in(int, usb_target_t, void *, size_t, size_t *);
-
-
-
-int usb_drv_async_control_write_setup(int, usb_target_t,
-    void *, size_t, usb_handle_t *);
-int usb_drv_async_control_write_data(int, usb_target_t,
-    void *, size_t, usb_handle_t *);
-int usb_drv_async_control_write_status(int, usb_target_t,
-    usb_handle_t *);
-
-int usb_drv_async_control_write(int, usb_target_t,
-    void *, size_t, void *, size_t, usb_handle_t *);
-
-int usb_drv_psync_control_write_setup(int, usb_target_t, void *, size_t);
-int usb_drv_psync_control_write_data(int, usb_target_t, void *, size_t);
-int usb_drv_psync_control_write_status(int, usb_target_t);
-
-int usb_drv_psync_control_write(int, usb_target_t,
-    void *, size_t, void *, size_t);
-
-int usb_drv_async_control_read_setup(int, usb_target_t,
-    void *, size_t, usb_handle_t *);
-int usb_drv_async_control_read_data(int, usb_target_t,
-    void *, size_t, size_t *, usb_handle_t *);
-int usb_drv_async_control_read_status(int, usb_target_t,
-    usb_handle_t *);
-
-int usb_drv_async_control_read(int, usb_target_t,
-    void *, size_t, void *, size_t, size_t *, usb_handle_t *);
-
-int usb_drv_psync_control_read_setup(int, usb_target_t, void *, size_t);
-int usb_drv_psync_control_read_data(int, usb_target_t, void *, size_t, size_t *);
-int usb_drv_psync_control_read_status(int, usb_target_t);
-
-int usb_drv_psync_control_read(int, usb_target_t,
-    void *, size_t, void *, size_t, size_t *);
-
-
-
-int usb_drv_async_wait_for(usb_handle_t);
-
-int usb_drv_create_match_ids_from_device_descriptor(match_id_list_t *,
-    const usb_standard_device_descriptor_t *);
-
-#endif
-/**
- * @}
- */
Index: uspace/lib/usb/src/dp.c
===================================================================
--- uspace/lib/usb/src/dp.c	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ uspace/lib/usb/src/dp.c	(revision 9f554e64df31f9bb0353d424d7c05a9c79624c45)
@@ -37,5 +37,5 @@
 #include <str_error.h>
 #include <errno.h>
-#include <usb/usbdrv.h>
+#include <assert.h>
 #include <bool.h>
 #include <usb/dp.h>
Index: uspace/lib/usb/src/drvpsync.c
===================================================================
--- uspace/lib/usb/src/drvpsync.c	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ 	(revision )
@@ -1,218 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief Implementation of pseudo-synchronous transfers.
- */
-#include <usb/usbdrv.h>
-#include <usbhc_iface.h>
-#include <errno.h>
-
-int usb_drv_psync_interrupt_out(int phone, usb_target_t target,
-    void *buffer, size_t size)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_interrupt_out(phone, target, buffer, size, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-int usb_drv_psync_interrupt_in(int phone, usb_target_t target,
-    void *buffer, size_t size, size_t *actual_size)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_interrupt_in(phone, target, buffer, size,
-	    actual_size, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-
-
-int usb_drv_psync_control_write_setup(int phone, usb_target_t target,
-    void *buffer, size_t size)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_control_write_setup(phone, target, buffer, size, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-int usb_drv_psync_control_write_data(int phone, usb_target_t target,
-    void *buffer, size_t size)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_control_write_data(phone, target, buffer, size, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-int usb_drv_psync_control_write_status(int phone, usb_target_t target)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_control_write_status(phone, target, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-
-/** Perform complete control write transaction over USB.
- *
- * The DATA stage is performed only when @p data is not NULL and
- * @p data_size is greater than zero.
- *
- * @param phone Open phone to host controller.
- * @param target Target device and endpoint.
- * @param setup_packet Setup packet data.
- * @param setup_packet_size Size of the setup packet.
- * @param data Data to be sent.
- * @param data_size Size of the @p data buffer.
- * @return Error code.
- */
-int usb_drv_psync_control_write(int phone, usb_target_t target,
-    void *setup_packet, size_t setup_packet_size,
-    void *data, size_t data_size)
-{
-	int rc;
-	
-	rc = usb_drv_psync_control_write_setup(phone, target,
-	    setup_packet, setup_packet_size);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	if ((data != NULL) && (data_size > 0)) {
-		rc = usb_drv_psync_control_write_data(phone, target,
-		    data, data_size);
-		if (rc != EOK) {
-			return rc;
-		}
-	}
-
-	rc = usb_drv_psync_control_write_status(phone, target);
-
-	return rc;
-}
-
-
-int usb_drv_psync_control_read_setup(int phone, usb_target_t target,
-    void *buffer, size_t size)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_control_read_setup(phone, target, buffer, size, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-int usb_drv_psync_control_read_data(int phone, usb_target_t target,
-    void *buffer, size_t size, size_t *actual_size)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_control_read_data(phone, target, buffer, size,
-	    actual_size, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-int usb_drv_psync_control_read_status(int phone, usb_target_t target)
-{
-	usb_handle_t h;
-	int rc;
-	rc = usb_drv_async_control_read_status(phone, target, &h);
-	if (rc != EOK) {
-		return rc;
-	}
-	return usb_drv_async_wait_for(h);
-}
-
-
-/** Perform complete control read transaction over USB.
- *
- * @param phone Open phone to host controller.
- * @param target Target device and endpoint.
- * @param setup_packet Setup packet data.
- * @param setup_packet_size Size of the setup packet.
- * @param data Storage for read data.
- * @param data_size Size of the @p data buffer.
- * @param actual_data_size Storage for number of actually transferred data from
- *        device.
- * @return Error code.
- */
-int usb_drv_psync_control_read(int phone, usb_target_t target,
-    void *setup_packet, size_t setup_packet_size,
-    void *data, size_t data_size, size_t *actual_data_size)
-{
-	int rc;
-	
-	rc = usb_drv_psync_control_read_setup(phone, target,
-	    setup_packet, setup_packet_size);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	rc = usb_drv_psync_control_read_data(phone, target,
-	    data, data_size, actual_data_size);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	rc = usb_drv_psync_control_read_status(phone, target);
-
-	return rc;
-}
-
-
-
-
-/**
- * @}
- */
Index: uspace/lib/usb/src/recognise.c
===================================================================
--- uspace/lib/usb/src/recognise.c	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ uspace/lib/usb/src/recognise.c	(revision 9f554e64df31f9bb0353d424d7c05a9c79624c45)
@@ -34,5 +34,4 @@
  */
 #include <sys/types.h>
-#include <usb/usbdrv.h>
 #include <usb/pipes.h>
 #include <usb/recognise.h>
@@ -241,7 +240,7 @@
  * @return Error code.
  */
-int usb_drv_create_match_ids_from_device_descriptor(
-    match_id_list_t *matches,
-    const usb_standard_device_descriptor_t *device_descriptor)
+int usb_device_create_match_ids_from_device_descriptor(
+    const usb_standard_device_descriptor_t *device_descriptor,
+    match_id_list_t *matches)
 {
 	/*
@@ -303,6 +302,6 @@
 	}
 
-	rc = usb_drv_create_match_ids_from_device_descriptor(matches,
-	    &device_descriptor);
+	rc = usb_device_create_match_ids_from_device_descriptor(
+	    &device_descriptor, matches);
 	if (rc != EOK) {
 		return rc;
Index: uspace/lib/usb/src/request.c
===================================================================
--- uspace/lib/usb/src/request.c	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ uspace/lib/usb/src/request.c	(revision 9f554e64df31f9bb0353d424d7c05a9c79624c45)
@@ -34,5 +34,4 @@
  */
 #include <usb/request.h>
-#include <usb/devreq.h>
 #include <errno.h>
 
Index: uspace/lib/usb/src/usbdrv.c
===================================================================
--- uspace/lib/usb/src/usbdrv.c	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ 	(revision )
@@ -1,236 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief USB driver (implementation).
- */
-#include <usb/usbdrv.h>
-#include <errno.h>
-
-
-/** Find handle of host controller the device is physically attached to.
- *
- * @param[in] dev Device looking for its host controller.
- * @param[out] handle Host controller devman handle.
- * @return Error code.
- */
-int usb_drv_find_hc(device_t *dev, devman_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Connect to host controller the device is physically attached to.
- *
- * @param dev Device asking for connection.
- * @param hc_handle Devman handle of the host controller.
- * @param flags Connection flags (blocking connection).
- * @return Phone to the HC or error code.
- */
-int usb_drv_hc_connect(device_t *dev, devman_handle_t hc_handle,
-    unsigned int flags)
-{
-	return ENOTSUP;
-}
-
-/** Connect to host controller the device is physically attached to.
- *
- * @param dev Device asking for connection.
- * @param flags Connection flags (blocking connection).
- * @return Phone to corresponding HC or error code.
- */
-int usb_drv_hc_connect_auto(device_t *dev, unsigned int flags)
-{
-	return ENOTSUP;
-}
-
-/** Tell USB address assigned to given device.
- *
- * @param phone Phone to my HC.
- * @param dev Device in question.
- * @return USB address or error code.
- */
-usb_address_t usb_drv_get_my_address(int phone, device_t *dev)
-{
-	return ENOTSUP;
-}
-
-/** Tell HC to reserve default address.
- *
- * @param phone Open phone to host controller driver.
- * @return Error code.
- */
-int usb_drv_reserve_default_address(int phone)
-{
-	return ENOTSUP;
-}
-
-/** Tell HC to release default address.
- *
- * @param phone Open phone to host controller driver.
- * @return Error code.
- */
-int usb_drv_release_default_address(int phone)
-{
-	return ENOTSUP;
-}
-
-/** Ask HC for free address assignment.
- *
- * @param phone Open phone to host controller driver.
- * @return Assigned USB address or negative error code.
- */
-usb_address_t usb_drv_request_address(int phone)
-{
-	return ENOTSUP;
-}
-
-/** Inform HC about binding address with devman handle.
- *
- * @param phone Open phone to host controller driver.
- * @param address Address to be binded.
- * @param handle Devman handle of the device.
- * @return Error code.
- */
-int usb_drv_bind_address(int phone, usb_address_t address,
-    devman_handle_t handle)
-{
-	return ENOTSUP;
-}
-
-/** Inform HC about address release.
- *
- * @param phone Open phone to host controller driver.
- * @param address Address to be released.
- * @return Error code.
- */
-int usb_drv_release_address(int phone, usb_address_t address)
-{
-	return ENOTSUP;
-}
-
-/** Blocks caller until given USB transaction is finished.
- * After the transaction is finished, the user can access all output data
- * given to initial call function.
- *
- * @param handle Transaction handle.
- * @return Error status.
- * @retval EOK No error.
- * @retval EBADMEM Invalid handle.
- * @retval ENOENT Data buffer associated with transaction does not exist.
- */
-int usb_drv_async_wait_for(usb_handle_t handle)
-{
-	return ENOTSUP;
-}
-
-/** Send interrupt data to device. */
-int usb_drv_async_interrupt_out(int phone, usb_target_t target,
-    void *buffer, size_t size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Request interrupt data from device. */
-int usb_drv_async_interrupt_in(int phone, usb_target_t target,
-    void *buffer, size_t size, size_t *actual_size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Start control write transfer. */
-int usb_drv_async_control_write_setup(int phone, usb_target_t target,
-    void *buffer, size_t size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Send data during control write transfer. */
-int usb_drv_async_control_write_data(int phone, usb_target_t target,
-    void *buffer, size_t size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Finalize control write transfer. */
-int usb_drv_async_control_write_status(int phone, usb_target_t target,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Issue whole control write transfer. */
-int usb_drv_async_control_write(int phone, usb_target_t target,
-    void *setup_packet, size_t setup_packet_size,
-    void *buffer, size_t buffer_size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Start control read transfer. */
-int usb_drv_async_control_read_setup(int phone, usb_target_t target,
-    void *buffer, size_t size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Read data during control read transfer. */
-int usb_drv_async_control_read_data(int phone, usb_target_t target,
-    void *buffer, size_t size, size_t *actual_size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Finalize control read transfer. */
-int usb_drv_async_control_read_status(int phone, usb_target_t target,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/** Issue whole control read transfer. */
-int usb_drv_async_control_read(int phone, usb_target_t target,
-    void *setup_packet, size_t setup_packet_size,
-    void *buffer, size_t buffer_size, size_t *actual_size,
-    usb_handle_t *handle)
-{
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: uspace/lib/usb/src/usbdrvreq.c
===================================================================
--- uspace/lib/usb/src/usbdrvreq.c	(revision 070f11ed65fc67c7ab58ee2c666e3180c4dbe713)
+++ 	(revision )
@@ -1,523 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief USB driver - standard USB requests (implementation).
- */
-#include <usb/usbdrv.h>
-#include <errno.h>
-
-/**  Prepare USB target for control endpoint.
- *
- * @param name Variable name with the USB target.
- * @param target_address Target USB address.
- */
-#define PREPARE_TARGET(name, target_address) \
-	usb_target_t name = { \
-		.address = target_address, \
-		.endpoint = 0 \
-	}
-
-/** Prepare setup packet.
- *
- * @param name Variable name with the setup packet.
- * @param p_direction Data transfer direction.
- * @param p_type Request type (standard/class/vendor)
- * @param p_recipient Recipient of the request.
- * @param p_request Request.
- * @param p_value wValue field of setup packet.
- * @param p_index wIndex field of setup packet.
- * @param p_length Length of extra data.
- */
-#define PREPARE_SETUP_PACKET(name, p_direction, p_type, p_recipient, \
-    p_request, p_value, p_index, p_length) \
-	usb_device_request_setup_packet_t name = { \
-		.request_type = \
-			((p_direction) == USB_DIRECTION_IN ? 128 : 0) \
-			| ((p_type) << 5) \
-			| (p_recipient), \
-		.request = (p_request), \
-		{ .value = (p_value) }, \
-		.index = (p_index), \
-		.length = (p_length) \
-	}
-
-/** Prepare setup packet.
- *
- * @param name Variable name with the setup packet.
- * @param p_direction Data transfer direction.
- * @param p_type Request type (standard/class/vendor)
- * @param p_recipient Recipient of the request.
- * @param p_request Request.
- * @param p_value_low wValue field of setup packet (low byte).
- * @param p_value_high wValue field of setup packet (high byte).
- * @param p_index wIndex field of setup packet.
- * @param p_length Length of extra data.
- */
-#define PREPARE_SETUP_PACKET_LOHI(name, p_direction, p_type, p_recipient, \
-    p_request, p_value_low, p_value_high, p_index, p_length) \
-	PREPARE_SETUP_PACKET(name, p_direction, p_type, p_recipient, \
-	    p_request, (p_value_low) | ((p_value_high) << 8), \
-	    p_index, p_length)
-
-/** Retrieve status of a USB device.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] recipient Recipient of the request.
- * @param[in] recipient_index Index of @p recipient.
- * @param[out] status Status (see figure 9-4 in USB 1.1 specification).
- * @return Error code.
- */
-int usb_drv_req_get_status(int hc_phone, usb_address_t address,
-    usb_request_recipient_t recipient, uint16_t recipient_index,
-    uint16_t *status)
-{
-	if (status == NULL) {
-		return EBADMEM;
-	}
-
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET(setup_packet,
-	    USB_DIRECTION_IN, USB_REQUEST_TYPE_STANDARD,
-	    recipient, USB_DEVREQ_GET_STATUS, 0, recipient_index, 2);
-
-	size_t transfered;
-	uint16_t tmp_status;
-	int rc = usb_drv_psync_control_read(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), &tmp_status, 2, &transfered);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (transfered != 2) {
-		return ERANGE;
-	}
-
-	*status = tmp_status;
-
-	return EOK;
-}
-
-/** Clear or disable USB device feature.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] recipient Recipient of the request.
- * @param[in] selector Feature selector.
- * @param[in] index Index of @p recipient.
- * @return Error code.
- */
-int usb_drv_req_clear_feature(int hc_phone, usb_address_t address,
-    usb_request_recipient_t recipient,
-    uint16_t selector, uint16_t index)
-{
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET(setup_packet,
-	    USB_DIRECTION_OUT, USB_REQUEST_TYPE_STANDARD,
-	    recipient, USB_DEVREQ_CLEAR_FEATURE, selector, index, 0);
-
-	int rc = usb_drv_psync_control_write(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), NULL, 0);
-
-	return rc;
-}
-
-/** Set or enable USB device feature.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] recipient Recipient of the request.
- * @param[in] selector Feature selector.
- * @param[in] index Index of @p recipient.
- * @return Error code.
- */
-int usb_drv_req_set_feature(int hc_phone, usb_address_t address,
-    usb_request_recipient_t recipient,
-    uint16_t selector, uint16_t index)
-{
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET(setup_packet,
-	    USB_DIRECTION_OUT, USB_REQUEST_TYPE_STANDARD,
-	    recipient, USB_DEVREQ_SET_FEATURE, selector, index, 0);
-
-	int rc = usb_drv_psync_control_write(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), NULL, 0);
-
-	return rc;
-}
-
-/** Change address of connected device.
- *
- * @see usb_drv_reserve_default_address
- * @see usb_drv_release_default_address
- * @see usb_drv_request_address
- * @see usb_drv_release_address
- * @see usb_drv_bind_address
- *
- * @param[in] phone Open phone to HC driver.
- * @param[in] old_address Current address.
- * @param[in] new_address Address to be set.
- * @return Error code.
- */
-int usb_drv_req_set_address(int phone, usb_address_t old_address,
-    usb_address_t new_address)
-{
-	PREPARE_TARGET(target, old_address);
-
-	PREPARE_SETUP_PACKET(setup_packet, USB_DIRECTION_OUT,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_SET_ADDRESS, new_address, 0, 0);
-
-	int rc = usb_drv_psync_control_write(phone, target,
-	    &setup_packet, sizeof(setup_packet), NULL, 0);
-
-	return rc;
-}
-
-/** Retrieve USB descriptor of connected USB device.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] request_type Request type (standard/class/vendor).
- * @param[in] descriptor_type Descriptor type (device/configuration/HID/...).
- * @param[in] descriptor_index Descriptor index.
- * @param[in] language Language index.
- * @param[out] buffer Buffer where to store the retrieved descriptor.
- * @param[in] size Size of the @p buffer.
- * @param[out] actual_size Number of bytes actually transferred.
- * @return Error code.
- */
-int usb_drv_req_get_descriptor(int hc_phone, usb_address_t address,
-    usb_request_type_t request_type,
-    uint8_t descriptor_type, uint8_t descriptor_index,
-    uint16_t language,
-    void *buffer, size_t size, size_t *actual_size)
-{
-	if (buffer == NULL) {
-		return EBADMEM;
-	}
-	if (size == 0) {
-		return EINVAL;
-	}
-
-	// FIXME: check that size is not too big
-
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET_LOHI(setup_packet, USB_DIRECTION_IN,
-	    request_type, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_GET_DESCRIPTOR, descriptor_index, descriptor_type,
-	    language, size);
-
-	int rc = usb_drv_psync_control_read(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet),
-	    buffer, size, actual_size);
-	
-	return rc;
-}
-
-/** Retrieve device descriptor of connected USB device.
- *
- * @param[in] phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[out] descriptor Storage for the device descriptor.
- * @return Error code.
- * @retval EBADMEM @p descriptor is NULL.
- */
-int usb_drv_req_get_device_descriptor(int phone, usb_address_t address,
-    usb_standard_device_descriptor_t *descriptor)
-{
-	if (descriptor == NULL) {
-		return EBADMEM;
-	}
-	
-	size_t actually_transferred = 0;
-	usb_standard_device_descriptor_t descriptor_tmp;
-	int rc = usb_drv_req_get_descriptor(phone, address,
-	    USB_REQUEST_TYPE_STANDARD,
-	    USB_DESCTYPE_DEVICE, 0,
-	    0,
-	    &descriptor_tmp, sizeof(descriptor_tmp),
-	    &actually_transferred);
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Verify that all data has been transferred. */
-	if (actually_transferred < sizeof(descriptor_tmp)) {
-		return ELIMIT;
-	}
-
-	/* Everything is okay, copy the descriptor. */
-	memcpy(descriptor, &descriptor_tmp,
-	    sizeof(descriptor_tmp));
-
-	return EOK;
-}
-
-
-/** Retrieve configuration descriptor of connected USB device.
- *
- * The function does not retrieve additional data binded with configuration
- * descriptor (such as its interface and endpoint descriptors) - use
- * usb_drv_req_get_full_configuration_descriptor() instead.
- *
- * @param[in] phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] index Configuration descriptor index.
- * @param[out] descriptor Storage for the configuration descriptor.
- * @return Error code.
- * @retval EBADMEM @p descriptor is NULL.
- */
-int usb_drv_req_get_bare_configuration_descriptor(int phone,
-    usb_address_t address, int index,
-    usb_standard_configuration_descriptor_t *descriptor)
-{
-	if (descriptor == NULL) {
-		return EBADMEM;
-	}
-	
-	size_t actually_transferred = 0;
-	usb_standard_configuration_descriptor_t descriptor_tmp;
-	int rc = usb_drv_req_get_descriptor(phone, address,
-	    USB_REQUEST_TYPE_STANDARD,
-	    USB_DESCTYPE_CONFIGURATION, 0,
-	    0,
-	    &descriptor_tmp, sizeof(descriptor_tmp),
-	    &actually_transferred);
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Verify that all data has been transferred. */
-	if (actually_transferred < sizeof(descriptor_tmp)) {
-		return ELIMIT;
-	}
-
-	/* Everything is okay, copy the descriptor. */
-	memcpy(descriptor, &descriptor_tmp,
-	    sizeof(descriptor_tmp));
-
-	return EOK;
-}
-
-/** Retrieve full configuration descriptor of connected USB device.
- *
- * @warning The @p buffer might be touched (i.e. its contents changed)
- * even when error occurs.
- *
- * @param[in] phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] index Configuration descriptor index.
- * @param[out] buffer Buffer for the whole configuration descriptor.
- * @param[in] buffer_size Size of the prepared @p buffer.
- * @param[out] actual_buffer_size Bytes actually transfered.
- * @return Error code.
- * @retval EBADMEM @p descriptor is NULL.
- */
-int usb_drv_req_get_full_configuration_descriptor(int phone,
-    usb_address_t address, int index,
-    void *buffer, size_t buffer_size, size_t *actual_buffer_size)
-{
-	int rc = usb_drv_req_get_descriptor(phone, address,
-	    USB_REQUEST_TYPE_STANDARD,
-	    USB_DESCTYPE_CONFIGURATION, 0,
-	    0,
-	    buffer, buffer_size,
-	    actual_buffer_size);
-
-	return rc;
-}
-
-/** Update existing descriptor of a USB device.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] descriptor_type Descriptor type (device/configuration/...).
- * @param[in] descriptor_index Descriptor index.
- * @param[in] language Language index.
- * @param[in] descriptor Actual descriptor data.
- * @param[in] descriptor_size Descriptor size.
- * @return Error code.
- */
-int usb_drv_req_set_descriptor(int hc_phone, usb_address_t address,
-    uint8_t descriptor_type, uint8_t descriptor_index,
-    uint16_t language,
-    void *descriptor, size_t descriptor_size)
-{
-	// FIXME: check that descriptor is not too big
-
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET_LOHI(setup_packet, USB_DIRECTION_OUT,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_SET_DESCRIPTOR, descriptor_index, descriptor_type,
-	    language, descriptor_size);
-
-	int rc = usb_drv_psync_control_write(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet),
-	    descriptor, descriptor_size);
-
-	return rc;
-}
-
-/** Determine current configuration value of USB device.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[out] configuration_value Current configuration value.
- * @return Error code.
- */
-int usb_drv_req_get_configuration(int hc_phone, usb_address_t address,
-    uint8_t *configuration_value)
-{
-	if (configuration_value == NULL) {
-		return EBADMEM;
-	}
-
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET(setup_packet, USB_DIRECTION_IN,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_GET_CONFIGURATION, 0, 0, 1);
-
-	uint8_t value;
-	size_t transfered;
-	int rc = usb_drv_psync_control_read(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), &value, 1, &transfered);
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	if (transfered != 1) {
-		return ERANGE;
-	}
-
-	*configuration_value = value;
-
-	return EOK;
-}
-
-/** Set configuration of USB device.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] configuration_value New configuration value.
- * @return Error code.
- */
-int usb_drv_req_set_configuration(int hc_phone, usb_address_t address,
-    uint8_t configuration_value)
-{
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET_LOHI(setup_packet, USB_DIRECTION_OUT,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_SET_CONFIGURATION, configuration_value, 0,
-	    0, 0);
-
-	int rc = usb_drv_psync_control_write(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), NULL, 0);
-
-	return rc;
-}
-
-/** Determine alternate setting of USB device interface.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] interface_index Interface index.
- * @param[out] alternate_setting Value of alternate setting.
- * @return Error code.
- */
-int usb_drv_req_get_interface(int hc_phone, usb_address_t address,
-    uint16_t interface_index, uint8_t *alternate_setting)
-{
-	if (alternate_setting == NULL) {
-		return EBADMEM;
-	}
-
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET(setup_packet, USB_DIRECTION_IN,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_DEVREQ_GET_INTERFACE, 0, interface_index, 1);
-
-	uint8_t alternate;
-	size_t transfered;
-	int rc = usb_drv_psync_control_read(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), &alternate, 1, &transfered);
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	if (transfered != 1) {
-		return ERANGE;
-	}
-
-	*alternate_setting = alternate;
-
-	return EOK;
-}
-
-/** Select an alternate setting of USB device interface.
- *
- * @param[in] hc_phone Open phone to HC driver.
- * @param[in] address Device address.
- * @param[in] interface_index Interface index.
- * @param[in] alternate_setting Value of alternate setting.
- * @return Error code.
- */
-int usb_drv_req_set_interface(int hc_phone, usb_address_t address,
-    uint16_t interface_index, uint8_t alternate_setting)
-{
-	PREPARE_TARGET(target, address);
-
-	PREPARE_SETUP_PACKET_LOHI(setup_packet, USB_DIRECTION_OUT,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_DEVREQ_SET_INTERFACE, alternate_setting, 0,
-	    0, 0);
-
-	int rc = usb_drv_psync_control_write(hc_phone, target,
-	    &setup_packet, sizeof(setup_packet), NULL, 0);
-
-	return rc;
-}
-
-/**
- * @}
- */
