Index: uspace/lib/usb/include/usb/classes/hub.h
===================================================================
--- uspace/lib/usb/include/usb/classes/hub.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ uspace/lib/usb/include/usb/classes/hub.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -43,8 +43,8 @@
  */
 typedef enum {
+	USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
+	USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
 	USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
 	USB_HUB_FEATURE_HUB_OVER_CURRENT = 1,
-	USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
-	USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
 	USB_HUB_FEATURE_PORT_CONNECTION = 0,
 	USB_HUB_FEATURE_PORT_ENABLE = 1,
@@ -54,4 +54,5 @@
 	USB_HUB_FEATURE_PORT_POWER = 8,
 	USB_HUB_FEATURE_PORT_LOW_SPEED = 9,
+	USB_HUB_FEATURE_PORT_HIGH_SPEED = 10,
 	USB_HUB_FEATURE_C_PORT_CONNECTION = 16,
 	USB_HUB_FEATURE_C_PORT_ENABLE = 17,
@@ -59,4 +60,6 @@
 	USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
 	USB_HUB_FEATURE_C_PORT_RESET = 20,
+	USB_HUB_FEATURE_PORT_TEST = 21,
+	USB_HUB_FEATURE_PORT_INDICATOR = 22
 	/* USB_HUB_FEATURE_ = , */
 } usb_hub_class_feature_t;
@@ -67,108 +70,75 @@
 	/** Descriptor length. */
 	uint8_t length;
+
 	/** Descriptor type (0x29). */
 	uint8_t descriptor_type;
+
 	/** Number of downstream ports. */
 	uint8_t port_count;
-	/** Characteristics bitmask. */
+
+	/** Characteristics bitmask.
+	 *
+	 *  D1..D0: Logical Power Switching Mode
+	 *  00: Ganged power switching (all ports power at
+	 *  once)
+	 *  01: Individual port power switching
+	 *  1X: Reserved. Used only on 1.0 compliant hubs
+	 *  that implement no power switching.
+	 *  D2: Identifies a Compound Device
+	 *  0: Hub is not part of a compound device
+	 *  1: Hub is part of a compound device
+	 *  D4..D3: Over-current Protection Mode
+	 *  00: Global Over-current Protection. The hub
+	 *  reports over-current as a summation of all
+	 *  ports current draw, without a breakdown of
+	 *  individual port over-current status.
+	 *  01: Individual Port Over-current Protection. The
+	 *  hub reports over-current on a per-port basis.
+	 *  Each port has an over-current indicator.
+	 *  1X: No Over-current Protection. This option is
+	 *  allowed only for bus-powered hubs that do not
+	 *  implement over-current protection.
+	 *  D6..D5: TT think time
+	 *  00: At most 8 FS bit times
+	 *  01: At most 16 FS bit times
+	 *  10: At most 24 FS bit times
+	 *  11: At most 32 FS bit times
+	 *  D7: Port indicators
+	 *  0: Not supported
+	 *  1: Supported
+	 *  D15...D8: Reserved
+	 */
 	uint8_t characteristics;
-#define HUB_CHAR_POWER_PER_PORT_FLAG  (1 << 0)
-#define HUB_CHAR_NO_POWER_SWITCH_FLAG (1 << 1)
-	/* Unused part of characteristics field */
+#define HUB_CHAR_POWER_PER_PORT_FLAG    (1 << 0)
+#define HUB_CHAR_NO_POWER_SWITCH_FLAG   (1 << 1)
+#define HUB_CHAR_COMPOUND_DEVICE        (1 << 2)
+#define HUB_CHAR_OC_PER_PORT_FLAG       (1 << 3)
+#define HUB_CHAR_NO_OC_FLAG             (1 << 4)
+#define HUB_CHAR_TT_THINK_16            (1 << 5)
+#define HUB_CHAR_TT_THINK_8             (1 << 6)
+#define HUB_CHAR_INDICATORS_FLAG        (1 << 7)
+
+	/** Unused part of characteristics field */
 	uint8_t characteristics_reserved;
-	/** Time from power-on to stabilization of current on the port. */
+
+	/** Time from power-on to stabilization of current on the port.
+	 *
+	 *  Time (in 2ms intervals) from the time the power-on
+	 *  sequence begins on a port until power is good on that
+	 *  port. The USB System Software uses this value to
+	 *  determine how long to wait before accessing a
+	 *  powered-on port.
+	 */
 	uint8_t power_good_time;
-	/** Maximum current requirements in mA. */
+	/** Maximum current requirements in mA.
+	 *
+	 *  Maximum current requirements of the Hub Controller
+	 *  electronics in mA.
+	 */
 	uint8_t max_current;
 } __attribute__ ((packed)) usb_hub_descriptor_header_t;
 
-/**
- * @brief usb hub descriptor
- *
- * For more information see Universal Serial Bus Specification Revision 1.1
- * chapter 11.16.2
- */
-typedef struct usb_hub_descriptor_type {
-    /** Number of bytes in this descriptor, including this byte */
-    //uint8_t bDescLength;
-
-    /** Descriptor Type, value: 29H for hub descriptor */
-    //uint8_t bDescriptorType;
-
-    /** Number of downstream ports that this hub supports */
-    uint8_t port_count;
-
-    /**
-            D1...D0: Logical Power Switching Mode
-            00: Ganged power switching (all ports power at
-            once)
-            01: Individual port power switching
-            1X: Reserved. Used only on 1.0 compliant hubs
-            that implement no power switching.
-            D2: Identifies a Compound Device
-            0: Hub is not part of a compound device
-            1: Hub is part of a compound device
-            D4...D3: Over-current Protection Mode
-            00: Global Over-current Protection. The hub
-            reports over-current as a summation of all
-            ports current draw, without a breakdown of
-            individual port over-current status.
-            01: Individual Port Over-current Protection. The
-            hub reports over-current on a per-port basis.
-            Each port has an over-current indicator.
-            1X: No Over-current Protection. This option is
-            allowed only for bus-powered hubs that do not
-            implement over-current protection.
-            D15...D5:
-            Reserved
-     */
-    uint16_t hub_characteristics;
-
-    /**
-            Time (in 2ms intervals) from the time the power-on
-            sequence begins on a port until power is good on that
-            port. The USB System Software uses this value to
-            determine how long to wait before accessing a
-            powered-on port.
-     */
-    uint8_t pwr_on_2_good_time;
-
-    /**
-            Maximum current requirements of the Hub Controller
-            electronics in mA.
-     */
-    uint8_t current_requirement;
-
-    /**
-            Indicates if a port has a removable device attached.
-            This field is reported on byte-granularity. Within a
-            byte, if no port exists for a given location, the field
-            representing the port characteristics returns 0.
-            Bit value definition:
-            0B - Device is removable
-            1B - Device is non-removable
-            This is a bitmap corresponding to the individual ports
-            on the hub:
-            Bit 0: Reserved for future use
-            Bit 1: Port 1
-            Bit 2: Port 2
-            ....
-            Bit n: Port n (implementation-dependent, up to a
-            maximum of 255 ports).
-     */
-    uint8_t devices_removable[32];
-
-    /**
-            This field exists for reasons of compatibility with
-            software written for 1.0 compliant devices. All bits in
-            this field should be set to 1B. This field has one bit for
-            each port on the hub with additional pad bits, if
-            necessary, to make the number of bits in the field an
-            integer multiple of 8.
-     */
-    //uint8_t * port_pwr_ctrl_mask;
-} usb_hub_descriptor_t;
-
-
+/** One bit for the device and one bit for every port */
+#define STATUS_BYTES(ports) ((1 + ports + 7) / 8)
 
 /**	@brief usb hub specific request types.
@@ -204,5 +174,5 @@
     /** */
     USB_HUB_REQUEST_CLEAR_FEATURE = 1,
-    /** */
+    /** USB 1.0 only */
     USB_HUB_REQUEST_GET_STATE = 2,
     /** */
@@ -211,5 +181,13 @@
     USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
     /** */
-    USB_HUB_REQUEST_SET_DESCRIPTOR = 7
+    USB_HUB_REQUEST_SET_DESCRIPTOR = 7,
+    /** */
+    USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8,
+    /** */
+    USB_HUB_REQUEST_RESET_TT = 9,
+    /** */
+    USB_HUB_GET_TT_STATE = 10,
+    /** */
+    USB_HUB_STOP_TT = 11,
 } usb_hub_request_t;
 
@@ -218,5 +196,5 @@
  */
 /* 7 (basic size) + 2*32 (port bitmasks) */
-#define USB_HUB_MAX_DESCRIPTOR_SIZE 71
+#define USB_HUB_MAX_DESCRIPTOR_SIZE (7 + 2 * 32)
 
 #endif
Index: uspace/lib/usb/include/usb/classes/massstor.h
===================================================================
--- uspace/lib/usb/include/usb/classes/massstor.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ uspace/lib/usb/include/usb/classes/massstor.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -36,6 +36,4 @@
 #define LIBUSB_CLASS_MASSSTOR_H_
 
-#include <sys/types.h>
-
 /** USB mass storage subclasses. */
 typedef enum {
Index: uspace/lib/usb/include/usb/ddfiface.h
===================================================================
--- uspace/lib/usb/include/usb/ddfiface.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 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
- * Implementations of DDF interfaces functions.
- */
-
-#ifndef LIBUSB_DDFIFACE_H_
-#define LIBUSB_DDFIFACE_H_
-
-#include <sys/types.h>
-#include <usb_iface.h>
-
-extern int usb_iface_get_hc_handle_device_impl(ddf_fun_t *, devman_handle_t *);
-extern int usb_iface_get_my_address_forward_impl(ddf_fun_t *, usb_address_t *);
-extern usb_iface_t usb_iface_hub_impl;
-
-extern int usb_iface_get_my_address_from_device_data(ddf_fun_t *, usb_address_t *);
-extern usb_iface_t usb_iface_hub_child_impl;
-
-extern int usb_iface_get_hc_handle_hc_impl(ddf_fun_t *, devman_handle_t *);
-
-#endif
-
-/**
- * @}
- */
Index: uspace/lib/usb/include/usb/debug.h
===================================================================
--- uspace/lib/usb/include/usb/debug.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ uspace/lib/usb/include/usb/debug.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -36,8 +36,7 @@
 #define LIBUSB_DEBUG_H_
 #include <stdio.h>
-#include <inttypes.h>
-#include <usb/usb.h>
+#include <sys/types.h>
 #include <io/log.h>
-#include <assert.h>
+
 
 void usb_dump_standard_descriptor(FILE *, const char *, const char *,
Index: uspace/lib/usb/include/usb/descriptor.h
===================================================================
--- uspace/lib/usb/include/usb/descriptor.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ uspace/lib/usb/include/usb/descriptor.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -36,5 +36,5 @@
 #define LIBUSB_DESCRIPTOR_H_
 
-#include <async.h>
+#include <sys/types.h>
 
 /** Descriptor type. */
@@ -45,4 +45,9 @@
 	USB_DESCTYPE_INTERFACE = 4,
 	USB_DESCTYPE_ENDPOINT = 5,
+	/* New in USB2.0 */
+	USB_DESCTYPE_DEVICE_QUALIFIER = 6,
+	USB_DESCTYPE_OTHER_SPEED_CONFIGURATION = 7,
+	USB_DESCTYPE_INTERFACE_POWER = 8,
+	/* Class specific */
 	USB_DESCTYPE_HID = 0x21,
 	USB_DESCTYPE_HID_REPORT = 0x22,
@@ -89,4 +94,32 @@
 } __attribute__ ((packed)) usb_standard_device_descriptor_t;
 
+/** USB device qualifier decriptor is basically a cut down version of the device
+ * descriptor with values that would be valid if the device operated on the
+ * other speed (HIGH vs. FULL)
+ */
+typedef struct {
+	/** Size of this descriptor in bytes */
+	uint8_t length;
+	/** Descriptor type (USB_DESCTYPE_DEVICE_QUALIFIER) */
+	uint8_t descriptor_type;
+	/** USB specification release number.
+	 * The number shall be coded as binary-coded decimal (BCD).
+	 */
+	uint16_t usb_spec_version;
+	/** Device class. */
+	uint8_t device_class;
+	/** Device sub-class. */
+	uint8_t device_subclass;
+	/** Device protocol. */
+	uint8_t device_protocol;
+	/** Maximum packet size for endpoint zero.
+	 * Valid values are only 8, 16, 32, 64).
+	 */
+	uint8_t max_packet_size;
+	/** Number of possible configurations. */
+	uint8_t configuration_count;
+	uint8_t reserved;
+} __attribute__ ((packed)) usb_standard_device_qualifier_descriptor_t;
+
 /** Standard USB configuration descriptor.
  */
@@ -116,4 +149,11 @@
 } __attribute__ ((packed)) usb_standard_configuration_descriptor_t;
 
+/** USB Other Speed Configuration descriptor shows values that would change
+ * in the configuration descriptor if the device operated at its other
+ * possible speed (HIGH vs. FULL)
+ */
+typedef usb_standard_configuration_descriptor_t
+    usb_other_speed_configuration_descriptor_t;
+
 /** Standard USB interface descriptor.
  */
@@ -157,6 +197,14 @@
 	 */
 	uint8_t attributes;
-	/** Maximum packet size. */
+	/** Maximum packet size.
+	 * Lower 10 bits represent the actuall size
+	 * Bits 11,12 specify addtional transfer opportunitities for
+	 * HS INT and ISO transfers. */
 	uint16_t max_packet_size;
+#define ED_MPS_PACKET_SIZE_MASK  0x3ff
+#define ED_MPS_PACKET_SIZE_GET(value) \
+	((value) & ED_MPS_PACKET_SIZE_MASK)
+#define ED_MPS_TRANS_OPPORTUNITIES_GET(value) \
+	((((value) >> 10) & 0x3) + 1)
 	/** Polling interval in milliseconds.
 	 * Ignored for bulk and control endpoints.
Index: uspace/lib/usb/include/usb/dev.h
===================================================================
--- uspace/lib/usb/include/usb/dev.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ uspace/lib/usb/include/usb/dev.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -36,27 +36,6 @@
 
 #include <devman.h>
-#include <usb/usb.h>
 
-int usb_get_info_by_handle(devman_handle_t,
-    devman_handle_t *, usb_address_t *, int *);
-
-static inline int usb_get_hc_by_handle(devman_handle_t dev, devman_handle_t *hc)
-{
-	return usb_get_info_by_handle(dev, hc, NULL, NULL);
-}
-
-static inline int usb_get_address_by_handle(
-    devman_handle_t dev, usb_address_t *address)
-{
-	return usb_get_info_by_handle(dev, NULL, address, NULL);
-}
-
-static inline int usb_get_iface_by_handle(devman_handle_t dev, int *iface)
-{
-	return usb_get_info_by_handle(dev, NULL, NULL, iface);
-}
-
-int usb_resolve_device_handle(const char *, devman_handle_t *, usb_address_t *,
-    devman_handle_t *);
+int usb_resolve_device_handle(const char *, devman_handle_t *);
 #endif
 /**
Index: uspace/lib/usb/include/usb/hc.h
===================================================================
--- uspace/lib/usb/include/usb/hc.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * 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
- * General communication with host controller.
- */
-#ifndef LIBUSB_HC_H_
-#define LIBUSB_HC_H_
-
-#include <async.h>
-#include <devman.h>
-#include <ddf/driver.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <usb/usb.h>
-
-/** Connection to the host controller driver.
- *
- * This is a high level IPC communication wrapper. After the structure has been
- * initialized using devman handle of an USB host controller, it
- * will manage all communication to that host controller, including session
- * creation/destruction and proper IPC protocol.
- */
-typedef struct {
-	/** Devman handle of the host controller. */
-	devman_handle_t hc_handle;
-	/** Session to the host controller. */
-	async_sess_t *hc_sess;
-	/** Session guard. */
-	fibril_mutex_t guard;
-	/** Use counter. */
-	unsigned ref_count;
-} usb_hc_connection_t;
-
-/** Initialize connection to USB host controller.
- *
- * @param connection Connection to be initialized.
- * @param hc_handle Devman handle of the host controller.
- * @return Error code.
- */
-static inline void usb_hc_connection_initialize(usb_hc_connection_t *connection,
-    devman_handle_t hc_handle)
-{
-	assert(connection);
-	connection->hc_handle = hc_handle;
-	connection->hc_sess = NULL;
-	connection->ref_count = 0;
-	fibril_mutex_initialize(&connection->guard);
-}
-
-int usb_hc_connection_initialize_from_device(usb_hc_connection_t *, ddf_dev_t *);
-
-void usb_hc_connection_deinitialize(usb_hc_connection_t *);
-
-int usb_hc_connection_open(usb_hc_connection_t *);
-int usb_hc_connection_close(usb_hc_connection_t *);
-
-usb_address_t usb_hc_request_address(usb_hc_connection_t *, usb_address_t, bool,
-    usb_speed_t);
-int usb_hc_bind_address(usb_hc_connection_t *, usb_address_t, devman_handle_t);
-int usb_hc_get_handle_by_address(usb_hc_connection_t *, usb_address_t,
-    devman_handle_t *);
-int usb_hc_release_address(usb_hc_connection_t *, usb_address_t);
-
-int usb_hc_register_endpoint(usb_hc_connection_t *, usb_address_t,
-    usb_endpoint_t, usb_transfer_type_t, usb_direction_t, size_t, unsigned int);
-int usb_hc_unregister_endpoint(usb_hc_connection_t *, usb_address_t,
-    usb_endpoint_t, usb_direction_t);
-
-int usb_hc_read(usb_hc_connection_t *, usb_address_t, usb_endpoint_t,
-    uint64_t, void *, size_t, size_t *);
-int usb_hc_write(usb_hc_connection_t *, usb_address_t, usb_endpoint_t,
-    uint64_t, const void *, size_t);
-
-/** Get host controller handle by its class index.
- *
- * @param sid Service ID of the HC function.
- * @param hc_handle Where to store the HC handle
- *	(can be NULL for existence test only).
- * @return Error code.
- */
-static inline int usb_ddf_get_hc_handle_by_sid(
-    service_id_t sid, devman_handle_t *handle)
-{
-	devman_handle_t h;
-	return devman_fun_sid_to_handle(sid, handle ? handle : &h);
-}
-
-#endif
-/**
- * @}
- */
Index: uspace/lib/usb/include/usb/request.h
===================================================================
--- uspace/lib/usb/include/usb/request.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
+++ uspace/lib/usb/include/usb/request.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2012 Jan Vesely
+ * 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
+ * Standard USB request format.
+ */
+#ifndef LIBUSB_REQUEST_H_
+#define LIBUSB_REQUEST_H_
+
+#include <sys/types.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;
+
+/** Standard device features */
+typedef enum {
+	USB_FEATURE_ENDPOINT_HALT = 0,
+	USB_FEATURE_DEVICE_REMOTE_WAKEUP = 1,
+	USB_FEATURE_TEST_MODE = 2
+} usb_std_feature_t;
+
+/** USB device status - device is self powered (opposed to bus powered). */
+#define USB_DEVICE_STATUS_SELF_POWERED ((uint16_t)(1 << 0))
+
+/** USB device status - remote wake-up signaling is enabled. */
+#define USB_DEVICE_STATUS_REMOTE_WAKEUP ((uint16_t)(1 << 1))
+
+/** USB endpoint status - endpoint is halted (stalled). */
+#define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0))
+
+/** 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;
+#define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
+#define SETUP_REQUEST_TYPE_HOST_TO_DEVICE (0 << 7)
+#define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3)
+#define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f)
+#define SETUP_REQUEST_TO_HOST(type, recipient) \
+    (uint8_t)((1 << 7) | ((type & 0x3) << 5) | (recipient & 0x1f))
+#define SETUP_REQUEST_TO_DEVICE(type, recipient) \
+    (uint8_t)(((type & 0x3) << 5) | (recipient & 0x1f))
+
+	/** Request identification. */
+	uint8_t request;
+	/** Main parameter to the request. */
+	union __attribute__ ((packed)) {
+		uint16_t value;
+		/* FIXME: add #ifdefs according to host endianness */
+		struct __attribute__ ((packed)) {
+			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 assert[(sizeof(usb_device_request_setup_packet_t) == 8) ? 1: -1];
+
+int usb_request_needs_toggle_reset(
+    const usb_device_request_setup_packet_t *request);
+
+#endif
+/**
+ * @}
+ */
Index: uspace/lib/usb/include/usb/usb.h
===================================================================
--- uspace/lib/usb/include/usb/usb.h	(revision 436300063cf897d3a8d003c018a42e184f48d928)
+++ uspace/lib/usb/include/usb/usb.h	(revision 3f4c537add23029a5ff0978f39e4b08469b25e68)
@@ -84,4 +84,9 @@
 } usb_speed_t;
 
+static inline bool usb_speed_is_11(const usb_speed_t s)
+{
+	return (s == USB_SPEED_FULL) || (s == USB_SPEED_LOW);
+}
+
 const char *usb_str_speed(usb_speed_t);
 
@@ -110,5 +115,16 @@
 #define USB_ADDRESS_DEFAULT 0
 /** Maximum address number in USB 1.1. */
-#define USB11_ADDRESS_MAX 128
+#define USB11_ADDRESS_MAX 127
+#define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1)
+
+/** Check USB address for allowed values.
+ *
+ * @param ep USB address.
+ * @return True, if value is wihtin limits, false otherwise.
+ */
+static inline bool usb_address_is_valid(usb_address_t a)
+{
+	return (a >= USB_ADDRESS_DEFAULT) && (a <= USB11_ADDRESS_MAX);
+}
 
 /** USB endpoint number type.
@@ -117,7 +133,19 @@
 typedef int16_t usb_endpoint_t;
 
-/** Maximum endpoint number in USB 1.1.
- */
+/** Default control endpoint */
+#define USB_ENDPOINT_DEFAULT_CONTROL 0
+/** Maximum endpoint number in USB 1.1. */
 #define USB11_ENDPOINT_MAX 16
+
+/** Check USB endpoint for allowed values.
+ *
+ * @param ep USB endpoint number.
+ * @return True, if value is wihtin limits, false otherwise.
+ */
+static inline bool usb_endpoint_is_valid(usb_endpoint_t ep)
+{
+	return (ep >= USB_ENDPOINT_DEFAULT_CONTROL) &&
+	    (ep < USB11_ENDPOINT_MAX);
+}
 
 
@@ -133,4 +161,5 @@
 } usb_target_t;
 
+
 /** Check USB target for allowed values (address and endpoint).
  *
@@ -140,6 +169,6 @@
 static inline bool usb_target_is_valid(usb_target_t target)
 {
-	return !(target.endpoint > 15 || target.endpoint < 0
-	    || target.address >= USB11_ADDRESS_MAX || target.address < 0);
+	return usb_address_is_valid(target.address) &&
+	    usb_endpoint_is_valid(target.endpoint);
 }
 
