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>
