Index: uspace/app/usbinfo/Makefile
===================================================================
--- uspace/app/usbinfo/Makefile	(revision 21809796396120c73188ecd3650d25471b0f13aa)
+++ uspace/app/usbinfo/Makefile	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
@@ -34,4 +34,5 @@
 
 SOURCES = \
+	dev.c \
 	dump.c \
 	info.c \
Index: uspace/app/usbinfo/dev.c
===================================================================
--- uspace/app/usbinfo/dev.c	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
+++ uspace/app/usbinfo/dev.c	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
@@ -0,0 +1,115 @@
+/*
+ * 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 usbinfo
+ * @{
+ */
+/**
+ * @file
+ * Representation of queried device.
+ */
+#include <usb/pipes.h>
+#include <errno.h>
+#include <str_error.h>
+#include <usb/request.h>
+#include "usbinfo.h"
+
+usbinfo_device_t *prepare_device(devman_handle_t hc_handle,
+    usb_address_t dev_addr)
+{
+	usbinfo_device_t *dev = malloc(sizeof(usbinfo_device_t));
+	if (dev == NULL) {
+		fprintf(stderr, NAME ": memory allocation failed.\n");
+		return NULL;
+	}
+
+	int rc;
+
+	rc = usb_device_connection_initialize(&dev->wire, hc_handle, dev_addr);
+	if (rc != EOK) {
+		fprintf(stderr,
+		    NAME ": failed to create connection to the device: %s.\n",
+		    str_error(rc));
+		goto leave;
+	}
+
+	rc = usb_endpoint_pipe_initialize_default_control(&dev->ctrl_pipe,
+	    &dev->wire);
+	if (rc != EOK) {
+		fprintf(stderr,
+		    NAME ": failed to create default control pipe: %s.\n",
+		    str_error(rc));
+		goto leave;
+	}
+
+	rc = usb_endpoint_pipe_probe_default_control(&dev->ctrl_pipe);
+	if (rc != EOK) {
+		fprintf(stderr,
+		    NAME ": probing default control pipe failed: %s.\n",
+		    str_error(rc));
+		goto leave;
+	}
+
+	rc = usb_endpoint_pipe_start_session(&dev->ctrl_pipe);
+	if (rc != EOK) {
+		fprintf(stderr,
+		    NAME ": failed to start session on control pipe: %s.\n",
+		    str_error(rc));
+		goto leave;
+	}
+
+	rc = usb_request_get_device_descriptor(&dev->ctrl_pipe,
+	    &dev->device_descriptor);
+	if (rc != EOK) {
+		fprintf(stderr,
+		    NAME ": failed to retrieve device descriptor: %s.\n",
+		    str_error(rc));
+		goto leave;
+	}
+
+	return dev;
+
+
+leave:
+	if (usb_endpoint_pipe_is_session_started(&dev->ctrl_pipe)) {
+		usb_endpoint_pipe_end_session(&dev->ctrl_pipe);
+	}
+
+	free(dev);
+
+	return NULL;
+}
+
+void destroy_device(usbinfo_device_t *dev)
+{
+	usb_endpoint_pipe_end_session(&dev->ctrl_pipe);
+	free(dev);
+}
+
+/** @}
+ */
Index: uspace/app/usbinfo/dump.c
===================================================================
--- uspace/app/usbinfo/dump.c	(revision 21809796396120c73188ecd3650d25471b0f13aa)
+++ uspace/app/usbinfo/dump.c	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
@@ -101,7 +101,6 @@
 }
 
-void dump_match_ids(match_id_list_t *matches)
+void dump_match_ids(match_id_list_t *matches, const char *line_prefix)
 {
-	printf("Match ids:\n");
 	link_t *link;
 	for (link = matches->ids.next;
@@ -110,5 +109,5 @@
 		match_id_t *match = list_get_instance(link, match_id_t, link);
 
-		printf(INDENT "%d %s\n", match->score, match->id);
+		printf("%s%d %s\n", line_prefix, match->score, match->id);
 	}
 }
Index: uspace/app/usbinfo/info.c
===================================================================
--- uspace/app/usbinfo/info.c	(revision 21809796396120c73188ecd3650d25471b0f13aa)
+++ uspace/app/usbinfo/info.c	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
@@ -42,4 +42,20 @@
 #include "usbinfo.h"
 
+void dump_short_device_identification(usbinfo_device_t *dev)
+{
+	printf("%sDevice 0x%04x by vendor 0x%04x\n", get_indent(0),
+	    (int) dev->device_descriptor.product_id,
+	    (int) dev->device_descriptor.vendor_id);
+}
+
+void dump_device_match_ids(usbinfo_device_t *dev)
+{
+	match_id_list_t matches;
+	init_match_ids(&matches);
+	usb_device_create_match_ids_from_device_descriptor(
+	    &dev->device_descriptor, &matches);
+	dump_match_ids(&matches, get_indent(0));
+}
+
 int dump_device(devman_handle_t hc_handle, usb_address_t address)
 {
@@ -92,5 +108,5 @@
 		goto leave;
 	}
-	dump_match_ids(&match_id_list);
+	dump_match_ids(&match_id_list, get_indent(0));
 
 	/*
Index: uspace/app/usbinfo/main.c
===================================================================
--- uspace/app/usbinfo/main.c	(revision 21809796396120c73188ecd3650d25471b0f13aa)
+++ uspace/app/usbinfo/main.c	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
@@ -164,6 +164,19 @@
 		}
 
-		printf("Device `%s':\n------------\n", devpath);
-		dump_device(hc_handle, dev_addr);
+		usbinfo_device_t *dev = prepare_device(hc_handle, dev_addr);
+		if (dev == NULL) {
+			continue;
+		}
+
+		/* Run actions the user specified. */
+		/* TODO */
+
+
+		printf("%s\n", devpath);
+		dump_short_device_identification(dev);
+		dump_device_match_ids(dev);
+
+		/* Destroy the control pipe (close the session etc.). */
+		destroy_device(dev);
 	}
 
Index: uspace/app/usbinfo/usbinfo.h
===================================================================
--- uspace/app/usbinfo/usbinfo.h	(revision 21809796396120c73188ecd3650d25471b0f13aa)
+++ uspace/app/usbinfo/usbinfo.h	(revision 3100ebe441ce5d61eca2e0863425293b7564eb1e)
@@ -38,7 +38,13 @@
 #include <usb/usb.h>
 #include <usb/descriptor.h>
+#include <usb/pipes.h>
 #include <usb/debug.h>
 #include <ipc/devman.h>
 
+typedef struct {
+	usb_endpoint_pipe_t ctrl_pipe;
+	usb_device_connection_t wire;
+	usb_standard_device_descriptor_t device_descriptor;
+} usbinfo_device_t;
 
 #define NAME "usbinfo"
@@ -46,5 +52,5 @@
 void dump_buffer(const char *, size_t, const uint8_t *, size_t);
 const char *get_indent(size_t);
-void dump_match_ids(match_id_list_t *matches);
+void dump_match_ids(match_id_list_t *, const char *);
 void dump_usb_descriptor(uint8_t *, size_t);
 int dump_device(devman_handle_t, usb_address_t);
@@ -56,4 +62,11 @@
 }
 
+usbinfo_device_t *prepare_device(devman_handle_t, usb_address_t);
+void destroy_device(usbinfo_device_t *);
+
+
+void dump_short_device_identification(usbinfo_device_t *);
+void dump_device_match_ids(usbinfo_device_t *);
+
 #endif
 /**
