Index: uspace/drv/bus/usb/usbmouse/Makefile
===================================================================
--- uspace/drv/bus/usb/usbmouse/Makefile	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
+++ 	(revision )
@@ -1,50 +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.
-#
-
-USPACE_PREFIX = ../../../..
-
-LIBS = \
-	$(LIBUSBHID_PREFIX)/libusbhid.a \
-	$(LIBUSBDEV_PREFIX)/libusbdev.a \
-	$(LIBUSB_PREFIX)/libusb.a \
-	$(LIBDRV_PREFIX)/libdrv.a
-
-EXTRA_CFLAGS += \
-	-I$(LIBUSB_PREFIX)/include \
-	-I$(LIBUSBDEV_PREFIX)/include \
-	-I$(LIBUSBHID_PREFIX)/include \
-	-I$(LIBDRV_PREFIX)/include
-
-BINARY = usbmouse
-
-SOURCES = \
-	init.c \
-	main.c \
-	mouse.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/bus/usb/usbmouse/init.c
===================================================================
--- uspace/drv/bus/usb/usbmouse/init.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
+++ 	(revision )
@@ -1,141 +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 drvusbmouse
- * @{
- */
-/**
- * @file
- * Initialization routines for USB mouse driver.
- */
-
-#include "mouse.h"
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/hid/hid.h>
-#include <usb/dev/request.h>
-#include <usb/hid/request.h>
-#include <errno.h>
-
-/** Mouse polling endpoint description for boot protocol subclass. */
-const usb_endpoint_description_t poll_endpoint_description = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_HID,
-	.interface_subclass = USB_HID_SUBCLASS_BOOT,
-	.interface_protocol = USB_HID_PROTOCOL_MOUSE,
-	.flags = 0
-};
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun     Device function handling the call.
- * @param icallid Call ID.
- * @param icall   Call data.
- *
- */
-static void default_connection_handler(ddf_fun_t *fun, ipc_callid_t icallid,
-    ipc_call_t *icall)
-{
-	usb_mouse_t *mouse = (usb_mouse_t *) fun->driver_data;
-	assert(mouse != NULL);
-	
-	async_sess_t *callback =
-	    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-	
-	if (callback) {
-		if (mouse->console_sess == NULL) {
-			mouse->console_sess = callback;
-			async_answer_0(icallid, EOK);
-		} else
-			async_answer_0(icallid, ELIMIT);
-	} else
-		async_answer_0(icallid, EINVAL);
-}
-
-/** Device ops for USB mouse. */
-static ddf_dev_ops_t mouse_ops = {
-	.default_handler = default_connection_handler
-};
-
-/** Create USB mouse device.
- *
- * The mouse device is stored into <code>dev-&gt;driver_data</code>.
- *
- * @param dev Generic device.
- * @return Error code.
- */
-int usb_mouse_create(usb_device_t *dev)
-{
-	usb_mouse_t *mouse = malloc(sizeof(usb_mouse_t));
-	if (mouse == NULL)
-		return ENOMEM;
-	
-	mouse->dev = dev;
-	mouse->console_sess = NULL;
-	
-	int rc;
-	
-	/* Create DDF function. */
-	mouse->mouse_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "mouse");
-	if (mouse->mouse_fun == NULL) {
-		rc = ENOMEM;
-		goto leave;
-	}
-	
-	mouse->mouse_fun->ops = &mouse_ops;
-	
-	rc = ddf_fun_bind(mouse->mouse_fun);
-	if (rc != EOK)
-		goto leave;
-	
-	/* Add the function to mouse class. */
-	rc = ddf_fun_add_to_category(mouse->mouse_fun, "mouse");
-	if (rc != EOK)
-		goto leave;
-	
-	/* Set the boot protocol. */
-	rc = usbhid_req_set_protocol(&dev->ctrl_pipe, dev->interface_no,
-	    USB_HID_PROTOCOL_BOOT);
-	if (rc != EOK)
-		goto leave;
-	
-	/* Everything allright. */
-	dev->driver_data = mouse;
-	mouse->mouse_fun->driver_data = mouse;
-	
-	return EOK;
-	
-leave:
-	free(mouse);
-	return rc;
-}
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbmouse/main.c
===================================================================
--- uspace/drv/bus/usb/usbmouse/main.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
+++ 	(revision )
@@ -1,105 +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 drvusbmouse
- * @{
- */
-/**
- * @file
- * Main routines of USB boot protocol mouse driver.
- */
-
-#include "mouse.h"
-#include <usb/debug.h>
-#include <usb/dev/poll.h>
-#include <errno.h>
-#include <str_error.h>
-
-#define NAME  "usbmouse"
-
-/** Callback when new mouse device is attached and recognised by DDF.
- *
- * @param dev Representation of a generic DDF device.
- *
- * @return Error code.
- *
- */
-static int usbmouse_device_add(usb_device_t *dev)
-{
-	int rc = usb_mouse_create(dev);
-	if (rc != EOK) {
-		usb_log_error("Failed to initialize device driver: %s.\n",
-		    str_error(rc));
-		return rc;
-	}
-	
-	usb_log_debug("Polling pipe at endpoint %d.\n",
-	    dev->pipes[0].pipe->endpoint_no);
-	
-	rc = usb_device_auto_poll(dev, 0, usb_mouse_polling_callback,
-	    dev->pipes[0].pipe->max_packet_size,
-	    usb_mouse_polling_ended_callback, dev->driver_data);
-	
-	if (rc != EOK) {
-		usb_log_error("Failed to start polling fibril: %s.\n",
-		    str_error(rc));
-		return rc;
-	}
-	
-	usb_log_info("controlling new mouse (handle %" PRIun ").\n",
-	    dev->ddf_dev->handle);
-	
-	return EOK;
-}
-
-/** USB mouse driver ops. */
-static usb_driver_ops_t mouse_driver_ops = {
-	.device_add = usbmouse_device_add,
-};
-
-static const usb_endpoint_description_t *endpoints[] = {
-	&poll_endpoint_description,
-	NULL
-};
-
-/** USB mouse driver. */
-static usb_driver_t mouse_driver = {
-	.name = NAME,
-	.ops = &mouse_driver_ops,
-	.endpoints = endpoints
-};
-
-int main(int argc, char *argv[])
-{
-	usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
-	return usb_driver_main(&mouse_driver);
-}
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbmouse/mouse.c
===================================================================
--- uspace/drv/bus/usb/usbmouse/mouse.c	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
+++ 	(revision )
@@ -1,131 +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 drvusbmouse
- * @{
- */
-/**
- * @file
- * Actual handling of USB mouse protocol.
- */
-
-#include <usb/debug.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ipc/mouseev.h>
-#include <async.h>
-#include "mouse.h"
-
-/** Mouse polling callback.
- *
- * @param dev    Device that is being polled.
- * @param buffer Data buffer.
- * @param size   Buffer size in bytes.
- * @param arg    Pointer to usb_mouse_t.
- *
- * @return Always true.
- *
- */
-bool usb_mouse_polling_callback(usb_device_t *dev, uint8_t *buffer,
-    size_t size, void *arg)
-{
-	usb_mouse_t *mouse = (usb_mouse_t *) arg;
-	
-	usb_log_debug2("got buffer: %s.\n",
-	    usb_debug_str_buffer(buffer, size, 0));
-	
-	uint8_t butt = buffer[0];
-	char str_buttons[4] = {
-		butt & 1 ? '#' : '.',
-		butt & 2 ? '#' : '.',
-		butt & 4 ? '#' : '.',
-		0
-	};
-	
-	int shift_x = ((int) buffer[1]) - 127;
-	int shift_y = ((int) buffer[2]) - 127;
-	int wheel = ((int) buffer[3]) - 127;
-	
-	if (buffer[1] == 0)
-		shift_x = 0;
-	
-	if (buffer[2] == 0)
-		shift_y = 0;
-	
-	if (buffer[3] == 0)
-		wheel = 0;
-	
-	if (mouse->console_sess) {
-		if ((shift_x != 0) || (shift_y != 0)) {
-			// FIXME: guessed for QEMU
-			
-			async_exch_t *exch = async_exchange_begin(mouse->console_sess);
-			async_req_2_0(exch, MOUSEEV_MOVE_EVENT, -shift_x / 10, -shift_y / 10);
-			async_exchange_end(exch);
-		}
-		if (butt) {
-			// FIXME: proper button clicking
-			
-			async_exch_t *exch = async_exchange_begin(mouse->console_sess);
-			async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 1, 1);
-			async_req_2_0(exch, MOUSEEV_BUTTON_EVENT, 1, 0);
-			async_exchange_end(exch);
-		}
-	}
-	
-	usb_log_debug("buttons=%s  dX=%+3d  dY=%+3d  wheel=%+3d\n",
-	    str_buttons, shift_x, shift_y, wheel);
-	
-	/* Guess. */
-	async_usleep(1000);
-	
-	return true;
-}
-
-/** Callback when polling is terminated.
- *
- * @param dev              Device where the polling terminated.
- * @param recurring_errors Whether the polling was terminated due to
- *                         recurring errors.
- * @param arg              Pointer to usb_mouse_t.
- *
- */
-void usb_mouse_polling_ended_callback(usb_device_t *dev, bool recurring_errors,
-    void *arg)
-{
-	usb_mouse_t *mouse = (usb_mouse_t *) arg;
-	
-	async_hangup(mouse->console_sess);
-	mouse->console_sess = NULL;
-	
-	usb_device_deinit(dev);
-}
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbmouse/mouse.h
===================================================================
--- uspace/drv/bus/usb/usbmouse/mouse.h	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
+++ 	(revision )
@@ -1,74 +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 drvusbmouse
- * @{
- */
-/**
- * @file
- * Common definitions for USB mouse driver.
- */
-
-#ifndef USBMOUSE_MOUSE_H_
-#define USBMOUSE_MOUSE_H_
-
-#include <usb/dev/driver.h>
-#include <usb/dev/pipes.h>
-#include <time.h>
-#include <async.h>
-
-#define POLL_PIPE(dev) \
-	((dev)->pipes[0].pipe)
-
-/** Container for USB mouse device. */
-typedef struct {
-	/** Generic device container. */
-	usb_device_t *dev;
-	
-	/** Function representing the device. */
-	ddf_fun_t *mouse_fun;
-	
-	/** Polling interval in microseconds. */
-	suseconds_t poll_interval_us;
-	
-	/** Callback session to console (consumer). */
-	async_sess_t *console_sess;
-} usb_mouse_t;
-
-extern const usb_endpoint_description_t poll_endpoint_description;
-
-extern int usb_mouse_create(usb_device_t *);
-extern bool usb_mouse_polling_callback(usb_device_t *, uint8_t *, size_t,
-    void *);
-extern void usb_mouse_polling_ended_callback(usb_device_t *, bool, void *);
-
-#endif
-
-/**
- * @}
- */
Index: uspace/drv/bus/usb/usbmouse/usbmouse.ma
===================================================================
--- uspace/drv/bus/usb/usbmouse/usbmouse.ma	(revision 1f131fb920d7e3db267b4e541a60b10999e98b0e)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 usb&interface&class=HID&subclass=0x01&protocol=0x02
