Index: uspace/app/sportdmp/sportdmp.c
===================================================================
--- uspace/app/sportdmp/sportdmp.c	(revision afec1bef8f4826913c0eed1b68d07a9698ebdf75)
+++ uspace/app/sportdmp/sportdmp.c	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -29,5 +29,5 @@
 #include <char_dev_iface.h>
 #include <errno.h>
-#include <ipc/serial_ctl.h>
+#include <io/serial.h>
 #include <loc.h>
 #include <stdio.h>
@@ -44,4 +44,5 @@
 	sysarg_t baud = 9600;
 	service_id_t svc_id;
+	serial_t *serial;
 
 	int arg = 1;
@@ -113,13 +114,16 @@
 	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF,
 	    IPC_FLAG_BLOCKING);
-	if (!sess) {
+	if (sess == NULL) {
 		fprintf(stderr, "Failed connecting to service\n");
+		return 2;
 	}
 
-	async_exch_t *exch = async_exchange_begin(sess);
-	rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, baud,
-	    SERIAL_NO_PARITY, 8, 1);
-	async_exchange_end(exch);
+	rc = serial_open(sess, &serial);
+	if (rc != EOK) {
+		fprintf(stderr, "Failed opening serial port\n");
+		return 2;
+	}
 
+	rc = serial_set_comm_props(serial, baud, SERIAL_NO_PARITY, 8, 1);
 	if (rc != EOK) {
 		fprintf(stderr, "Failed setting serial properties\n");
@@ -147,4 +151,6 @@
 
 	free(buf);
+	serial_close(serial);
+	async_hangup(sess);
 	return 0;
 }
Index: uspace/app/tester/hw/serial/serial1.c
===================================================================
--- uspace/app/tester/hw/serial/serial1.c	(revision afec1bef8f4826913c0eed1b68d07a9698ebdf75)
+++ uspace/app/tester/hw/serial/serial1.c	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -46,5 +46,5 @@
 #include <char_dev_iface.h>
 #include <str.h>
-#include <ipc/serial_ctl.h>
+#include <io/serial.h>
 #include "../../tester.h"
 
@@ -56,4 +56,5 @@
 {
 	size_t cnt;
+	serial_t *serial;
 	
 	if (test_argc < 1)
@@ -79,36 +80,36 @@
 	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF,
 	    IPC_FLAG_BLOCKING);
-	if (!sess)
+	if (sess == NULL)
 		return "Failed connecting to serial device";
+	
+	res = serial_open(sess, &serial);
+	if (res != EOK)
+		return "Failed opening serial port";
 	
 	char *buf = (char *) malloc(cnt + 1);
 	if (buf == NULL) {
+		serial_close(serial);
 		async_hangup(sess);
 		return "Failed allocating input buffer";
 	}
 	
-	sysarg_t old_baud;
-	sysarg_t old_par;
-	sysarg_t old_stop;
-	sysarg_t old_word_size;
-	
-	async_exch_t *exch = async_exchange_begin(sess);
-	res = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &old_baud,
-	    &old_par, &old_word_size, &old_stop);
-	async_exchange_end(exch);
-	
+	unsigned old_baud;
+	serial_parity_t old_par;
+	unsigned old_stop;
+	unsigned old_word_size;
+	
+	res = serial_get_comm_props(serial, &old_baud, &old_par,
+	    &old_word_size, &old_stop);
 	if (res != EOK) {
 		free(buf);
+		serial_close(serial);
 		async_hangup(sess);
 		return "Failed to get old serial communication parameters";
 	}
 	
-	exch = async_exchange_begin(sess);
-	res = async_req_4_0(exch, SERIAL_SET_COM_PROPS, 1200,
-	    SERIAL_NO_PARITY, 8, 1);
-	async_exchange_end(exch);
-	
+	res = serial_set_comm_props(serial, 1200, SERIAL_NO_PARITY, 8, 1);
 	if (EOK != res) {
 		free(buf);
+		serial_close(serial);
 		async_hangup(sess);
 		return "Failed setting serial communication parameters";
@@ -123,10 +124,9 @@
 		
 		if (read < 0) {
-			exch = async_exchange_begin(sess);
-			async_req_4_0(exch, SERIAL_SET_COM_PROPS, old_baud,
+			(void) serial_set_comm_props(serial, old_baud,
 			    old_par, old_word_size, old_stop);
-			async_exchange_end(exch);
 			
 			free(buf);
+			serial_close(serial);
 			async_hangup(sess);
 			return "Failed reading from serial device";
@@ -134,10 +134,9 @@
 		
 		if ((size_t) read > cnt - total) {
-			exch = async_exchange_begin(sess);
-			async_req_4_0(exch, SERIAL_SET_COM_PROPS, old_baud,
+			(void) serial_set_comm_props(serial, old_baud,
 			    old_par, old_word_size, old_stop);
-			async_exchange_end(exch);
 			
 			free(buf);
+			serial_close(serial);
 			async_hangup(sess);
 			return "Read more data than expected";
@@ -158,10 +157,9 @@
 			
 			if (written < 0) {
-				exch = async_exchange_begin(sess);
-				async_req_4_0(exch, SERIAL_SET_COM_PROPS, old_baud,
+				(void) serial_set_comm_props(serial, old_baud,
 				    old_par, old_word_size, old_stop);
-				async_exchange_end(exch);
 				
 				free(buf);
+				serial_close(serial);
 				async_hangup(sess);
 				return "Failed writing to serial device";
@@ -169,10 +167,9 @@
 			
 			if (written != read) {
-				exch = async_exchange_begin(sess);
-				async_req_4_0(exch, SERIAL_SET_COM_PROPS, old_baud,
+				(void) serial_set_comm_props(serial, old_baud,
 				    old_par, old_word_size, old_stop);
-				async_exchange_end(exch);
 				
 				free(buf);
+				serial_close(serial);
 				async_hangup(sess);
 				return "Written less data than read from serial device";
@@ -190,10 +187,9 @@
 	ssize_t written = char_dev_write(sess, (void *) EOT, eot_size);
 	
-	exch = async_exchange_begin(sess);
-	async_req_4_0(exch, SERIAL_SET_COM_PROPS, old_baud,
-	    old_par, old_word_size, old_stop);
-	async_exchange_end(exch);
+	(void) serial_set_comm_props(serial, old_baud, old_par, old_word_size,
+	    old_stop);
 	
 	free(buf);
+	serial_close(serial);
 	async_hangup(sess);
 	
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision afec1bef8f4826913c0eed1b68d07a9698ebdf75)
+++ uspace/lib/c/Makefile	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -118,4 +118,5 @@
 	generic/io/kio.c \
 	generic/io/klog.c \
+	generic/io/serial.c \
 	generic/io/snprintf.c \
 	generic/io/vprintf.c \
Index: uspace/lib/c/generic/io/serial.c
===================================================================
--- uspace/lib/c/generic/io/serial.c	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
+++ uspace/lib/c/generic/io/serial.c	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <async.h>
+#include <errno.h>
+#include <io/serial.h>
+#include <ipc/serial_ctl.h>
+#include <ipc/services.h>
+#include <stdlib.h>
+
+/** Open serial port device.
+ *
+ * @param sess Session with the serial port device
+ * @param rchardev Place to store pointer to the new serial port device structure
+ *
+ * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
+ */
+int serial_open(async_sess_t *sess, serial_t **rserial)
+{
+	serial_t *serial;
+
+	serial = calloc(1, sizeof(serial_t));
+	if (serial == NULL)
+		return ENOMEM;
+
+	serial->sess = sess;
+	*rserial = serial;
+
+	return EOK;
+}
+
+/** Close serial port device.
+ *
+ * Frees the serial port device structure. The underlying session is
+ * not affected.
+ *
+ * @param serial Serial port device or @c NULL
+ */
+void serial_close(serial_t *serial)
+{
+	free(serial);
+}
+
+/** Set serial port communication properties. */
+int serial_set_comm_props(serial_t *serial, unsigned rate,
+    serial_parity_t parity, unsigned datab, unsigned stopb)
+{
+	async_exch_t *exch = async_exchange_begin(serial->sess);
+
+	int rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, rate, parity,
+	    datab, stopb);
+
+	async_exchange_end(exch);
+	return rc;
+}
+
+/** Get serial port communication properties. */
+int serial_get_comm_props(serial_t *serial, unsigned *rrate,
+    serial_parity_t *rparity, unsigned *rdatab, unsigned *rstopb)
+{
+	async_exch_t *exch = async_exchange_begin(serial->sess);
+	sysarg_t rate, parity, datab, stopb;
+
+	int rc = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &rate, &parity,
+	    &datab, &stopb);
+
+	async_exchange_end(exch);
+	if (rc != EOK)
+		return rc;
+
+	*rrate = rate;
+	*rparity = parity;
+	*rdatab = datab;
+	*rstopb = stopb;
+
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/c/include/io/serial.h
===================================================================
--- uspace/lib/c/include/io/serial.h	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
+++ uspace/lib/c/include/io/serial.h	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2017 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 libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_IO_SERIAL_H_
+#define LIBC_IO_SERIAL_H_
+
+#include <async.h>
+#include <ipc/serial_ctl.h>
+
+typedef struct {
+	async_sess_t *sess;
+} serial_t;
+
+extern int serial_open(async_sess_t *, serial_t **);
+extern void serial_close(serial_t *);
+extern int serial_set_comm_props(serial_t *, unsigned, serial_parity_t,
+    unsigned, unsigned);
+extern int serial_get_comm_props(serial_t *, unsigned *, serial_parity_t *,
+    unsigned *, unsigned *);
+
+#endif
+
+/** @}
+ */
Index: uspace/srv/hid/isdv4_tablet/isdv4.c
===================================================================
--- uspace/srv/hid/isdv4_tablet/isdv4.c	(revision afec1bef8f4826913c0eed1b68d07a9698ebdf75)
+++ uspace/srv/hid/isdv4_tablet/isdv4.c	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -29,4 +29,6 @@
 #include <char_dev_iface.h>
 #include <errno.h>
+#include <stdbool.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <mem.h>
Index: uspace/srv/hid/isdv4_tablet/isdv4.h
===================================================================
--- uspace/srv/hid/isdv4_tablet/isdv4.h	(revision afec1bef8f4826913c0eed1b68d07a9698ebdf75)
+++ uspace/srv/hid/isdv4_tablet/isdv4.h	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -27,6 +27,8 @@
  */
 
-#ifndef __ISDV4_H__
-#define __ISDV4_H__
+#ifndef ISDV4_H_
+#define ISDV4_H_
+
+#include <async.h>
 
 typedef struct isdv4_event isdv4_event_t;
Index: uspace/srv/hid/isdv4_tablet/main.c
===================================================================
--- uspace/srv/hid/isdv4_tablet/main.c	(revision afec1bef8f4826913c0eed1b68d07a9698ebdf75)
+++ uspace/srv/hid/isdv4_tablet/main.c	(revision d51a0d61e43baaf646db5fd0827b7e8c89b0f4f5)
@@ -27,13 +27,12 @@
  */
 
-#include <char_dev_iface.h>
+#include <async.h>
 #include <errno.h>
-#include <ipc/serial_ctl.h>
+#include <fibril_synch.h>
+#include <io/serial.h>
+#include <ipc/mouseev.h>
 #include <loc.h>
+#include <stddef.h>
 #include <stdio.h>
-#include <fibril_synch.h>
-#include <abi/ipc/methods.h>
-#include <ipc/mouseev.h>
-#include <inttypes.h>
 #include <task.h>
 
@@ -179,4 +178,5 @@
 	sysarg_t baud = 38400;
 	service_id_t svc_id;
+	serial_t *serial;
 	char *serial_port_name = NULL;
 
@@ -268,11 +268,14 @@
 	if (!sess) {
 		fprintf(stderr, "Failed connecting to service\n");
-	}
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, baud,
-	    SERIAL_NO_PARITY, 8, 1);
-	async_exchange_end(exch);
-
+		return 2;
+	}
+
+	rc = serial_open(sess, &serial);
+	if (rc != EOK) {
+		fprintf(stderr, "Failed opening serial port\n");
+		return 2;
+	}
+
+	rc = serial_set_comm_props(serial, baud, SERIAL_NO_PARITY, 8, 1);
 	if (rc != EOK) {
 		fprintf(stderr, "Failed setting serial properties\n");
