Index: uspace/app/test_serial/Makefile
===================================================================
--- uspace/app/test_serial/Makefile	(revision 86554e71a1dd77b66b874136837c0b9cd1957907)
+++ uspace/app/test_serial/Makefile	(revision 86554e71a1dd77b66b874136837c0b9cd1957907)
@@ -0,0 +1,39 @@
+LIBC_PREFIX = ../../lib/libc
+SOFTINT_PREFIX = ../../lib/softint
+
+include $(LIBC_PREFIX)/Makefile.toolchain
+
+LIBS = $(LIBC_PREFIX)/libc.a
+
+OUTPUT = test_serial
+SOURCES = test_serial.c
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+.PHONY: all clean depend disasm
+
+all: $(OUTPUT) $(OUTPUT).disasm
+
+-include Makefile.depend
+
+depend:
+	$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
+
+$(OUTPUT): $(OBJECTS) $(LIBS)
+	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
+
+clean:
+	-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend *.o
+
+disasm: $(OUTPUT).disasm
+
+$(OUTPUT).disasm: $(OUTPUT)
+	$(OBJDUMP) -d $< >$@
+
+%.o: %.S
+	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
+
+%.o: %.s
+	$(AS) $(AFLAGS) $< -o $@
+
+%.o: %.c
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
Index: uspace/app/test_serial/test_serial.c
===================================================================
--- uspace/app/test_serial/test_serial.c	(revision 86554e71a1dd77b66b874136837c0b9cd1957907)
+++ uspace/app/test_serial/test_serial.c	(revision 86554e71a1dd77b66b874136837c0b9cd1957907)
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2009 Lenka Trochtova
+ * 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 test_serial
+ * @brief	test the serial port driver 
+ * @{
+ */ 
+/**
+ * @file
+ */
+
+#include <stdio.h>
+#include <ipc/ipc.h>
+#include <sys/types.h>
+#include <atomic.h>
+#include <ipc/devmap.h>
+#include <async.h>
+#include <ipc/services.h>
+#include <ipc/serial.h>
+#include <as.h>
+#include <sysinfo.h>
+#include <errno.h>
+
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <string.h>
+
+#define NAME 		"test serial"
+#define MYROOM 		2
+#define UpSection1 	25
+#define DwnSection1 26
+#define UpSection2 	27
+#define DwnSection2 28
+
+static int device_get_handle(const char *name, dev_handle_t *handle);
+static void print_usage();
+static void move_shutters(const char * serial_dev_name, char room, char cmd);
+static char getcmd(bool wnd, bool up);
+static bool is_com_dev(const char *dev_name);
+
+static int device_get_handle(const char *name, dev_handle_t *handle)
+{
+	int phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0);
+	if (phone < 0)
+		return phone;
+	
+	ipc_call_t answer;
+	aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0, &answer);
+	
+	ipcarg_t retval = ipc_data_write_start(phone, name, str_length(name) + 1); 
+
+	if (retval != EOK) {
+		async_wait_for(req, NULL);
+		ipc_hangup(phone);
+		return retval;
+	}
+
+	async_wait_for(req, &retval);
+
+	if (handle != NULL)
+		*handle = -1;
+	
+	if (retval == EOK) {
+		if (handle != NULL)
+			*handle = (dev_handle_t) IPC_GET_ARG1(answer);
+	}
+	
+	ipc_hangup(phone);
+	return retval;
+}
+
+static void print_usage()
+{
+	printf("Usage: \n test_serial comN count \n where 'comN' is a serial port and count is a number of characters to be read\n");	
+}
+
+
+/*
+ * The name of a serial device must be between 'com0' and 'com9'.
+ */ 
+static bool is_com_dev(const char *dev_name) 
+{
+	if (str_length(dev_name) != 4) {
+		return false;
+	}
+	
+	if (str_cmp("com0", dev_name) > 0) {
+		return false;
+	}
+	
+	if (str_cmp(dev_name, "com9") > 0) {
+		return false;
+	}
+	
+	return true;
+}
+
+
+int main(int argc, char *argv[])
+{
+	if (argc != 3) {
+		printf(NAME ": incorrect number of arguments.\n");
+		print_usage();
+		return 0;		
+	}	
+
+	
+	const char *serial_dev_name = argv[1];
+	long int cnt = strtol(argv[2], NULL, 10);
+	
+	if (!is_com_dev(serial_dev_name)) {
+		printf(NAME ": the first argument is not correct.\n");
+		print_usage();
+		return 0;	
+	}
+	
+	dev_handle_t serial_dev_handle = -1;
+	
+	if (device_get_handle(serial_dev_name, &serial_dev_handle) !=  EOK) {
+		printf(NAME ": could not get the handle of %s.\n", serial_dev_name);
+		return;
+	}
+	
+	printf(NAME ": got the handle of %s.\n", serial_dev_name);
+	
+	int dev_phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CONNECT_TO_DEVICE, serial_dev_handle);
+	if(dev_phone < 0) {
+		printf(NAME ": could not connect to %s device.\n", serial_dev_name);
+		return;
+	}
+	
+	printf("The application will read %d characters from %s: \n", cnt, serial_dev_name);
+	
+	int i, c;
+	for (i = 0; i < cnt; i++) {
+		async_req_0_1(dev_phone, SERIAL_GETCHAR, &c);
+		printf("%c", (char)c);
+	}
+	
+	return 0;
+}
+
+/** @}
+ */
