Index: uspace/lib/c/include/ipc/input.h
===================================================================
--- uspace/lib/c/include/ipc/input.h	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/lib/c/include/ipc/input.h	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -44,5 +44,7 @@
 
 typedef enum {
-	INPUT_EVENT = IPC_FIRST_USER_METHOD
+	INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD,
+	INPUT_EVENT_MOVE,
+	INPUT_EVENT_BUTTON
 } input_notif_t;
 
Index: uspace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/console/console.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2006 Josef Cejka
+ * Copyright (c) 2011 Jiri Svoboda
  * All rights reserved.
  *
@@ -36,5 +37,4 @@
 #include <ipc/input.h>
 #include <io/keycode.h>
-#include <ipc/mouse.h>
 #include <ipc/fb.h>
 #include <ipc/services.h>
@@ -60,5 +60,4 @@
 #include <io/style.h>
 #include <io/screenbuffer.h>
-#include <inttypes.h>
 
 #include "console.h"
@@ -66,24 +65,9 @@
 #include "keybuffer.h"
 
-// FIXME: remove this header
-#include <kernel/ipc/ipc_methods.h>
-
 #define NAME       "console"
 #define NAMESPACE  "term"
 
-/** Interval for checking for new keyboard (1/4s). */
-#define HOTPLUG_WATCH_INTERVAL (1000 * 250)
-
-/* Kernel defines 32 but does not export it. */
-#define MAX_IPC_OUTGOING_PHONES 128
-
-/** To allow proper phone closing. */
-static ipc_callid_t driver_phones[MAX_IPC_OUTGOING_PHONES] = { 0 };
-
-/** Phone to the keyboard driver. */
-static int kbd_phone;
-
-/** Phone to the mouse driver. */
-static int mouse_phone;
+/** Phone to the input server. */
+static int input_phone;
 
 /** Information about framebuffer */
@@ -155,12 +139,12 @@
 }
 
-static void kbd_yield(void)
-{
-	async_obsolete_req_0_0(kbd_phone, INPUT_YIELD);
-}
-
-static void kbd_reclaim(void)
-{
-	async_obsolete_req_0_0(kbd_phone, INPUT_RECLAIM);
+static void input_yield(void)
+{
+	async_obsolete_req_0_0(input_phone, INPUT_YIELD);
+}
+
+static void input_reclaim(void)
+{
+	async_obsolete_req_0_0(input_phone, INPUT_RECLAIM);
 }
 
@@ -343,5 +327,5 @@
 		gcons_in_kernel();
 		screen_yield();
-		kbd_yield();
+		input_yield();
 		async_obsolete_serialize_end();
 		
@@ -358,5 +342,5 @@
 		if (active_console == kernel_console) {
 			screen_reclaim();
-			kbd_reclaim();
+			input_reclaim();
 			gcons_redraw_console();
 		}
@@ -413,19 +397,6 @@
 }
 
-static void close_driver_phone(ipc_callid_t hash)
-{
-	int i;
-	for (i = 0; i < MAX_IPC_OUTGOING_PHONES; i++) {
-		if (driver_phones[i] == hash) {
-			printf("Device %" PRIxn " gone.\n", hash);
-			driver_phones[i] = 0;
-			async_obsolete_hangup(i);
-			return;
-		}
-	}
-}
-
-/** Handler for keyboard */
-static void keyboard_events(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+/** Handler for input events */
+static void input_events(ipc_callid_t iid, ipc_call_t *icall, void *arg)
 {
 	/* Ignore parameters, the connection is already opened */
@@ -439,11 +410,11 @@
 		if (!IPC_GET_IMETHOD(call)) {
 			/* TODO: Handle hangup */
-			close_driver_phone(iid);
+			async_obsolete_hangup(input_phone);
 			return;
 		}
 		
 		switch (IPC_GET_IMETHOD(call)) {
-		case INPUT_EVENT:
-			/* Got event from keyboard driver. */
+		case INPUT_EVENT_KEY:
+			/* Got key press/release event */
 			retval = 0;
 			ev.type = IPC_GET_ARG1(call);
@@ -466,29 +437,12 @@
 			fibril_mutex_unlock(&input_mutex);
 			break;
-		default:
-			retval = ENOENT;
-		}
-		async_answer_0(callid, retval);
-	}
-}
-
-/** Handler for mouse events */
-static void mouse_events(ipc_callid_t iid, ipc_call_t *icall, void *arg)
-{
-	/* Ignore parameters, the connection is already opened */
-	while (true) {
-		ipc_call_t call;
-		ipc_callid_t callid = async_get_call(&call);
-		
-		int retval;
-		
-		if (!IPC_GET_IMETHOD(call)) {
-			/* TODO: Handle hangup */
-			close_driver_phone(iid);
-			return;
-		}
-		
-		switch (IPC_GET_IMETHOD(call)) {
-		case MEVENT_BUTTON:
+		case INPUT_EVENT_MOVE:
+			/* Got pointer move event */
+			gcons_mouse_move((int) IPC_GET_ARG1(call),
+			    (int) IPC_GET_ARG2(call));
+			retval = 0;
+			break;
+		case INPUT_EVENT_BUTTON:
+			/* Got pointer button press/release event */
 			if (IPC_GET_ARG1(call) == 1) {
 				int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call));
@@ -498,13 +452,7 @@
 			retval = 0;
 			break;
-		case MEVENT_MOVE:
-			gcons_mouse_move((int) IPC_GET_ARG1(call),
-			    (int) IPC_GET_ARG2(call));
-			retval = 0;
-			break;
 		default:
 			retval = ENOENT;
 		}
-
 		async_answer_0(callid, retval);
 	}
@@ -747,31 +695,10 @@
 }
 
-static int async_connect_to_me_hack(int phone, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3, async_client_conn_t client_receiver, ipc_callid_t *hash)
-{
-	sysarg_t task_hash;
-	sysarg_t phone_hash;
-	int rc = async_obsolete_req_3_5(phone, IPC_M_CONNECT_TO_ME, arg1, arg2, arg3,
-	    NULL, NULL, NULL, &task_hash, &phone_hash);
-	if (rc != EOK)
-		return rc;
-	
-	if (client_receiver != NULL)
-		async_new_connection(task_hash, phone_hash, phone_hash, NULL,
-		    client_receiver, NULL);
-	
-	if (hash != NULL)
-		*hash = phone_hash;
-	
-	return EOK;
-}
-
-static int connect_keyboard_or_mouse(const char *devname,
-    async_client_conn_t handler, const char *dev)
+static int connect_input(const char *dev_path)
 {
 	int phone;
 	devmap_handle_t handle;
 	
-	int rc = devmap_device_get_handle(dev, &handle, 0);
+	int rc = devmap_device_get_handle(dev_path, &handle, 0);
 	if (rc == EOK) {
 		phone = devmap_obsolete_device_connect(handle, 0);
@@ -780,11 +707,12 @@
 			return phone;
 		}
-	} else
+	} else {
 		return rc;
+	}
 	
 	/* NB: The callback connection is slotted for removal */
-	ipc_callid_t hash;
-	rc = async_connect_to_me_hack(phone, SERVICE_CONSOLE, 0, phone,
-	    handler, &hash);
+	rc = async_obsolete_connect_to_me(phone, SERVICE_CONSOLE, 0, 0,
+	    input_events, NULL);
+
 	if (rc != EOK) {
 		async_obsolete_hangup(phone);
@@ -794,100 +722,13 @@
 	}
 	
-	driver_phones[phone] = hash;
-	printf("%s: found %s \"%s\" (%" PRIxn ").\n", NAME, devname, dev, hash);
 	return phone;
 }
 
-static int connect_keyboard(const char *dev)
-{
-	return connect_keyboard_or_mouse("keyboard", keyboard_events, dev);
-}
-
-static int connect_mouse(const char *dev)
-{
-	return connect_keyboard_or_mouse("mouse", mouse_events, dev);
-}
-
-struct hid_class_info {
-	char *classname;
-	int (*connection_func)(const char *);
-};
-
-/** Periodically check for new keyboards in /dev/class/.
- *
- * @param arg Class name.
- *
- * @return This function should never exit.
- *
- */
-static int check_new_device_fibril(void *arg)
-{
-	struct hid_class_info *dev_info = (struct hid_class_info *) arg;
-	
-	size_t index = 1;
-	
-	while (true) {
-		async_usleep(HOTPLUG_WATCH_INTERVAL);
-		
-		char *dev;
-		int rc = asprintf(&dev, "class/%s\\%zu",
-		    dev_info->classname, index);
-		if (rc < 0)
-			continue;
-		
-		rc = dev_info->connection_func(dev);
-		if (rc > 0) {
-			/* We do not allow unplug. */
-			index++;
-		}
-		
-		free(dev);
-	}
-	
-	return EOK;
-}
-
-/** Start a fibril monitoring hot-plugged keyboards.
- */
-static void check_new_devices_in_background(int (*connection_func)(const char *),
-    const char *classname)
-{
-	struct hid_class_info *dev_info = malloc(sizeof(struct hid_class_info));
-	if (dev_info == NULL) {
-		printf("%s: Out of memory, no hot-plug support.\n", NAME);
-		return;
-	}
-	
-	int rc = asprintf(&dev_info->classname, "%s", classname);
-	if (rc < 0) {
-		printf("%s: Failed to format classname: %s.\n", NAME,
-		    str_error(rc));
-		return;
-	}
-	
-	dev_info->connection_func = connection_func;
-	
-	fid_t fid = fibril_create(check_new_device_fibril, (void *) dev_info);
-	if (!fid) {
-		printf("%s: Failed to create hot-plug fibril for %s.\n", NAME,
-		    classname);
-		return;
-	}
-	
-	fibril_add_ready(fid);
-}
-
-static bool console_srv_init(char *kdev)
-{
-	/* Connect to input device */
-	kbd_phone = connect_keyboard(kdev);
-	if (kbd_phone < 0)
+static bool console_srv_init(char *input_dev)
+{
+	/* Connect to input server */
+	input_phone = connect_input(input_dev);
+	if (input_phone < 0)
 		return false;
-	
-	mouse_phone = connect_mouse("hid_in/mouse");
-	if (mouse_phone < 0) {
-		printf("%s: Failed to connect to mouse device %s\n", NAME,
-		    str_error(mouse_phone));
-	}
 	
 	/* Connect to framebuffer driver */
@@ -972,7 +813,4 @@
 		printf("%s: Error registering kconsole notifications\n", NAME);
 	
-	/* Start fibril for checking on hot-plugged keyboards. */
-	check_new_devices_in_background(connect_mouse, "mouse");
-	
 	return true;
 }
@@ -980,5 +818,5 @@
 static void usage(void)
 {
-	printf("Usage: console <input>\n");
+	printf("Usage: console <input_dev>\n");
 }
 
Index: uspace/srv/hid/input/Makefile
===================================================================
--- uspace/srv/hid/input/Makefile	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/Makefile	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -36,4 +36,5 @@
 	generic/input.c \
 	generic/layout.c \
+	generic/mouse.c \
 	generic/stroke.c \
 	layout/cz.c \
Index: uspace/srv/hid/input/ctl/kbdev.c
===================================================================
--- uspace/srv/hid/input/ctl/kbdev.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/ctl/kbdev.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -44,4 +44,5 @@
 #include <io/keycode.h>
 #include <ipc/kbdev.h>
+#include <input.h>
 #include <kbd.h>
 #include <kbd_ctl.h>
Index: uspace/srv/hid/input/generic/input.c
===================================================================
--- uspace/srv/hid/input/generic/input.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/generic/input.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -54,8 +54,10 @@
 #include <io/keycode.h>
 #include <devmap.h>
+#include <input.h>
 #include <kbd.h>
 #include <kbd_port.h>
 #include <kbd_ctl.h>
 #include <layout.h>
+#include <mouse.h>
 
 // FIXME: remove this header
@@ -68,8 +70,13 @@
 static void kbd_devs_reclaim(void);
 
+static void input_event_key(int, unsigned int, unsigned, wchar_t);
+
 int client_phone = -1;
 
 /** List of keyboard devices */
 static link_t kbd_devs;
+
+/** List of mouse devices */
+link_t mouse_devs;
 
 bool irc_service = false;
@@ -166,6 +173,25 @@
 
 	ev.c = layout_parse_ev(kdev->active_layout, &ev);
-
-	async_obsolete_msg_4(client_phone, INPUT_EVENT, ev.type, ev.key, ev.mods, ev.c);
+	input_event_key(ev.type, ev.key, ev.mods, ev.c);
+}
+
+/** Key has been pressed or released. */
+static void input_event_key(int type, unsigned int key, unsigned mods,
+    wchar_t c)
+{
+	async_obsolete_msg_4(client_phone, INPUT_EVENT_KEY, type, key,
+	    mods, c);
+}
+
+/** Mouse pointer has moved. */
+void input_event_move(int dx, int dy)
+{
+	async_obsolete_msg_2(client_phone, INPUT_EVENT_MOVE, dx, dy);
+}
+
+/** Mouse button has been pressed. */
+void input_event_button(int bnum, int press)
+{
+	async_obsolete_msg_2(client_phone, INPUT_EVENT_BUTTON, bnum, press);
 }
 
@@ -221,5 +247,6 @@
 	kdev = calloc(1, sizeof(kbd_dev_t));
 	if (kdev == NULL) {
-		printf(NAME ": Allocating keyboard device. Out of memory.\n");
+		printf(NAME ": Error allocating keyboard device. "
+		    "Out of memory.\n");
 		return NULL;
 	}
@@ -374,5 +401,7 @@
 }
 
-/** Periodically check for new kbdev devices in /dev/class/keyboard.
+/** Periodically check for new input devices.
+ *
+ * Looks under /dev/class/keyboard and /dev/class/mouse.
  *
  * @param arg	Ignored
@@ -381,5 +410,6 @@
 {
 	char *dev_path;
-	size_t id = 1;
+	size_t kbd_id = 1;
+	size_t mouse_id = 1;
 	int rc;
 
@@ -387,17 +417,37 @@
 		async_usleep(DISCOVERY_POLL_INTERVAL);
 
-		rc = asprintf(&dev_path, "/dev/class/keyboard\\%zu", id);
+		/*
+		 * Check for new keyboard device
+		 */
+		rc = asprintf(&dev_path, "/dev/class/keyboard\\%zu", kbd_id);
 		if (rc < 0)
 			continue;
 
 		if (kbd_add_kbdev(dev_path) == EOK) {
-			printf(NAME ": Connected kbdev device '%s'\n",
+			printf(NAME ": Connected keyboard device '%s'\n",
 			    dev_path);
 
 			/* XXX Handle device removal */
-			++id;
+			++kbd_id;
 		}
 
 		free(dev_path);
+
+		/*
+		 * Check for new mouse device
+		 */
+		rc = asprintf(&dev_path, "/dev/class/mouse\\%zu", mouse_id);
+		if (rc < 0)
+			continue;
+
+		if (mouse_add_dev(dev_path) == EOK) {
+			printf(NAME ": Connected mouse device '%s'\n",
+			    dev_path);
+
+			/* XXX Handle device removal */
+			++mouse_id;
+		}
+
+		free(dev_path);
 	}
 
@@ -406,5 +456,5 @@
 
 /** Start a fibril for discovering new devices. */
-static void kbd_start_dev_discovery(void)
+static void input_start_dev_discovery(void)
 {
 	fid_t fid;
@@ -427,4 +477,5 @@
 	
 	list_initialize(&kbd_devs);
+	list_initialize(&mouse_devs);
 	
 	if (((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc))
@@ -437,7 +488,9 @@
 	}
 	
-	/* Add legacy devices. */
+	/* Add legacy keyboard devices. */
 	kbd_add_legacy_devs();
 
+	/* Add legacy (devmap-style) mouse device. */
+	(void) mouse_add_dev("/dev/hid_in/mouse");
 	
 	/* Register driver */
@@ -457,6 +510,6 @@
 	}
 
-	/* Start looking for new kbdev devices */
-	kbd_start_dev_discovery();
+	/* Start looking for new input devices */
+	input_start_dev_discovery();
 
 	printf(NAME ": Accepting connections\n");
Index: uspace/srv/hid/input/generic/layout.c
===================================================================
--- uspace/srv/hid/input/generic/layout.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/generic/layout.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -37,5 +37,5 @@
 
 #include <errno.h>
-#include <kbd.h>
+#include <input.h>
 #include <layout.h>
 #include <stdlib.h>
Index: uspace/srv/hid/input/generic/mouse.c
===================================================================
--- uspace/srv/hid/input/generic/mouse.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
+++ uspace/srv/hid/input/generic/mouse.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2011 Jiri Svoboda
+ * 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 inputgen generic
+ * @brief Mouse device handling.
+ * @ingroup input
+ * @{
+ */
+/** @file
+ */
+
+#include <adt/list.h>
+#include <async.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <input.h>
+#include <ipc/mouse.h>
+#include <mouse.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <vfs/vfs_sess.h>
+
+static void mouse_callback_conn(ipc_callid_t, ipc_call_t *, void *);
+
+static mouse_dev_t *mouse_dev_new(void)
+{
+	mouse_dev_t *mdev;
+
+	mdev = calloc(1, sizeof(mouse_dev_t));
+	if (mdev == NULL) {
+		printf(NAME ": Error allocating mouse device. "
+		    "Out of memory.\n");
+		return NULL;
+	}
+
+	link_initialize(&mdev->mouse_devs);
+	return mdev;
+}
+
+static int mouse_dev_connect(mouse_dev_t *mdev, const char *dev_path)
+{
+	async_sess_t *sess;
+	async_exch_t *exch;
+	int fd;
+	int rc;
+
+	fd = open(dev_path, O_RDWR);
+	if (fd < 0) {
+		return -1;
+	}
+
+	sess = fd_session(EXCHANGE_SERIALIZE, fd);
+	if (sess == NULL) {
+		printf(NAME ": Failed starting session with '%s'\n", dev_path);
+		close(fd);
+		return -1;
+	}
+
+	exch = async_exchange_begin(sess);
+	if (exch == NULL) {
+		printf(NAME ": Failed starting exchange with '%s'.\n", dev_path);
+		return -1;
+	}
+
+	rc = async_connect_to_me(exch, 0, 0, 0, mouse_callback_conn, mdev);
+	if (rc != EOK) {
+		printf(NAME ": Failed creating callback connection from '%s'.\n",
+		    dev_path);
+		async_exchange_end(exch);
+		return -1;
+	}
+
+	async_exchange_end(exch);
+
+	mdev->dev_path = dev_path;
+	return 0;
+}
+
+/** Add new mouse device.
+ *
+ * @param dev_path	Filesystem path to the device (/dev/class/...)
+ */
+int mouse_add_dev(const char *dev_path)
+{
+	mouse_dev_t *mdev;
+	int rc;
+
+	mdev = mouse_dev_new();
+	if (mdev == NULL)
+		return -1;
+
+	rc = mouse_dev_connect(mdev, dev_path);
+	if (rc != EOK) {
+		free(mdev);
+		return -1;
+	}
+
+	list_append(&mdev->mouse_devs, &mouse_devs);
+	return EOK;
+}
+
+/** Mouse device callback connection handler. */
+static void mouse_callback_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
+{
+	int retval;
+
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid;
+
+		callid = async_get_call(&call);
+		if (!IPC_GET_IMETHOD(call)) {
+			/* XXX Handle hangup */
+			return;
+		}
+
+		switch (IPC_GET_IMETHOD(call)) {
+		case MEVENT_BUTTON:
+			input_event_button(IPC_GET_ARG1(call),
+			    IPC_GET_ARG2(call));
+			retval = 0;
+			break;
+		case MEVENT_MOVE:
+			input_event_move(IPC_GET_ARG1(call),
+			    IPC_GET_ARG2(call));
+			retval = 0;
+			break;
+		default:
+			retval = ENOTSUP;
+			break;
+		}
+
+		async_answer_0(callid, retval);
+	}
+}
+
+/**
+ * @}
+ */
Index: uspace/srv/hid/input/include/input.h
===================================================================
--- uspace/srv/hid/input/include/input.h	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
+++ uspace/srv/hid/input/include/input.h	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006 Josef Cejka
+ * Copyright (c) 2011 Jiri Svoboda
+ * 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 inputgen generic
+ * @brief HelenOS input server.
+ * @ingroup input
+ * @{
+ */
+/** @file
+ */
+
+#ifndef INPUT_H_
+#define INPUT_H_
+
+#include <bool.h>
+
+#define NAME       "input"
+#define NAMESPACE  "hid_in"
+
+extern bool irc_service;
+extern int irc_phone;
+
+extern link_t mouse_devs;
+
+void input_event_move(int, int);
+void input_event_button(int bnum, int press);
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/srv/hid/input/include/kbd.h
===================================================================
--- uspace/srv/hid/input/include/kbd.h	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/include/kbd.h	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -40,8 +40,4 @@
 
 #include <adt/list.h>
-#include <bool.h>
-
-#define NAME       "input"
-#define NAMESPACE  "hid_in"
 
 struct kbd_port_ops;
@@ -75,7 +71,4 @@
 } kbd_dev_t;
 
-extern bool irc_service;
-extern int irc_phone;
-
 extern void kbd_push_scancode(kbd_dev_t *, int);
 extern void kbd_push_ev(kbd_dev_t *, int, unsigned int);
Index: uspace/srv/hid/input/include/mouse.h
===================================================================
--- uspace/srv/hid/input/include/mouse.h	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
+++ uspace/srv/hid/input/include/mouse.h	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 Jiri Svoboda
+ * 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 inputgen generic
+ * @brief Mouse device handling.
+ * @ingroup input
+ * @{
+ */
+/** @file
+ */
+
+#ifndef MOUSE_H_
+#define MOUSE_H_
+
+#include <adt/list.h>
+
+typedef struct mouse_dev {
+	/** Link to mouse_devs list */
+	link_t mouse_devs;
+
+	/** Path to the device */
+	const char *dev_path;
+} mouse_dev_t;
+
+int mouse_add_dev(const char *dev_path);
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/srv/hid/input/layout/cz.c
===================================================================
--- uspace/srv/hid/input/layout/cz.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/layout/cz.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -33,5 +33,5 @@
 
 #include <errno.h>
-#include <kbd.h>
+#include <input.h>
 #include <io/console.h>
 #include <io/keycode.h>
Index: uspace/srv/hid/input/port/adb.c
===================================================================
--- uspace/srv/hid/input/port/adb.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/port/adb.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -38,4 +38,5 @@
 #include <async.h>
 #include <async_obsolete.h>
+#include <input.h>
 #include <kbd_port.h>
 #include <kbd.h>
Index: uspace/srv/hid/input/port/chardev.c
===================================================================
--- uspace/srv/hid/input/port/chardev.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/port/chardev.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -38,4 +38,5 @@
 #include <async.h>
 #include <async_obsolete.h>
+#include <input.h>
 #include <kbd_port.h>
 #include <kbd.h>
Index: uspace/srv/hid/input/port/ns16550.c
===================================================================
--- uspace/srv/hid/input/port/ns16550.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/port/ns16550.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -40,4 +40,5 @@
 #include <async_obsolete.h>
 #include <sysinfo.h>
+#include <input.h>
 #include <kbd.h>
 #include <kbd_port.h>
Index: uspace/srv/hid/input/port/z8530.c
===================================================================
--- uspace/srv/hid/input/port/z8530.c	(revision ecb692a289b0fbcb7662930ed99c42e844f9e108)
+++ uspace/srv/hid/input/port/z8530.c	(revision 854eddd6711fa7a5783a815c8d140d5414badf49)
@@ -40,4 +40,5 @@
 #include <async_obsolete.h>
 #include <sysinfo.h>
+#include <input.h>
 #include <kbd.h>
 #include <kbd_port.h>
