Index: uspace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision 1d6dd2a62370f8442aef510558ad86b6439e6653)
+++ uspace/srv/hid/console/console.c	(revision f1380b76772fb5d1aa03637b5e57bd9b929fea61)
@@ -62,5 +62,5 @@
 	atomic_t refcnt;      /**< Connection reference count */
 	prodcons_t input_pc;  /**< Incoming keyboard events */
-	
+
 	/**
 	 * Not yet sent bytes of last char event.
@@ -68,14 +68,14 @@
 	char char_remains[UTF8_CHAR_BUFFER_SIZE];
 	size_t char_remains_len;  /**< Number of not yet sent bytes. */
-	
+
 	fibril_mutex_t mtx;  /**< Lock protecting mutable fields */
-	
+
 	size_t index;           /**< Console index */
 	service_id_t dsid;      /**< Service handle */
-	
+
 	sysarg_t cols;         /**< Number of columns */
 	sysarg_t rows;         /**< Number of rows */
 	console_caps_t ccaps;  /**< Console capabilities */
-	
+
 	chargrid_t *frontbuf;    /**< Front buffer */
 	frontbuf_handle_t fbid;  /**< Front buffer handle */
@@ -162,10 +162,10 @@
 	fibril_mutex_lock(&switch_mtx);
 	fibril_mutex_lock(&cons->mtx);
-	
+
 	if ((active) && (cons == active_console)) {
 		output_update(output_sess, cons->fbid);
 		output_cursor_update(output_sess, cons->fbid);
 	}
-	
+
 	fibril_mutex_unlock(&cons->mtx);
 	fibril_mutex_unlock(&switch_mtx);
@@ -176,8 +176,8 @@
 	fibril_mutex_lock(&switch_mtx);
 	fibril_mutex_lock(&cons->mtx);
-	
+
 	if ((active) && (cons == active_console))
 		output_cursor_update(output_sess, cons->fbid);
-	
+
 	fibril_mutex_unlock(&cons->mtx);
 	fibril_mutex_unlock(&switch_mtx);
@@ -188,5 +188,5 @@
 	fibril_mutex_lock(&switch_mtx);
 	fibril_mutex_lock(&cons->mtx);
-	
+
 	if ((active) && (cons == active_console)) {
 		output_damage(output_sess, cons->fbid, 0, 0, cons->cols,
@@ -194,5 +194,5 @@
 		output_cursor_update(output_sess, cons->fbid);
 	}
-	
+
 	fibril_mutex_unlock(&cons->mtx);
 	fibril_mutex_unlock(&switch_mtx);
@@ -208,24 +208,24 @@
 		if (console_kcon())
 			active = false;
-		
+
 		return;
 	}
-	
+
 	if (index > CONSOLE_COUNT)
 		return;
-	
+
 	console_t *cons = &consoles[index];
-	
+
 	fibril_mutex_lock(&switch_mtx);
-	
+
 	if (cons == active_console) {
 		fibril_mutex_unlock(&switch_mtx);
 		return;
 	}
-	
+
 	active_console = cons;
-	
+
 	fibril_mutex_unlock(&switch_mtx);
-	
+
 	cons_damage(cons);
 }
@@ -236,5 +236,5 @@
 	output_claim(output_sess);
 	cons_damage(active_console);
-	
+
 	return EOK;
 }
@@ -244,5 +244,5 @@
 	active = false;
 	output_yield(output_sess);
-	
+
 	return EOK;
 }
@@ -261,5 +261,5 @@
 			return ENOMEM;
 		}
-		
+
 		link_initialize(&event->link);
 		event->type = type;
@@ -267,9 +267,9 @@
 		event->mods = mods;
 		event->c = c;
-		
+
 		prodcons_produce(&active_console->input_pc,
 		    &event->link);
 	}
-	
+
 	return EOK;
 }
@@ -295,7 +295,7 @@
 {
 	sysarg_t updated = 0;
-	
-	fibril_mutex_lock(&cons->mtx);
-	
+
+	fibril_mutex_lock(&cons->mtx);
+
 	switch (ch) {
 	case '\n':
@@ -313,7 +313,7 @@
 		updated = chargrid_putchar(cons->frontbuf, ch, true);
 	}
-	
-	fibril_mutex_unlock(&cons->mtx);
-	
+
+	fibril_mutex_unlock(&cons->mtx);
+
 	if (updated > 1)
 		cons_update(cons);
@@ -325,5 +325,5 @@
 	chargrid_set_cursor_visibility(cons->frontbuf, visible);
 	fibril_mutex_unlock(&cons->mtx);
-	
+
 	cons_update_cursor(cons);
 }
@@ -344,5 +344,5 @@
 	console_t *cons = srv_to_console(srv);
 	size_t pos = 0;
-	
+
 	/*
 	 * Read input from keyboard and copy it to the buffer.
@@ -355,17 +355,17 @@
 			bbuf[pos] = cons->char_remains[0];
 			pos++;
-			
+
 			/* Unshift the array. */
 			for (size_t i = 1; i < cons->char_remains_len; i++)
 				cons->char_remains[i - 1] = cons->char_remains[i];
-			
+
 			cons->char_remains_len--;
 		}
-		
+
 		/* Still not enough? Then get another key from the queue. */
 		if (pos < size) {
 			link_t *link = prodcons_consume(&cons->input_pc);
 			kbd_event_t *event = list_get_instance(link, kbd_event_t, link);
-			
+
 			/* Accept key presses of printable chars only. */
 			if ((event->type == KEY_PRESS) && (event->c != 0)) {
@@ -374,9 +374,9 @@
 				cons->char_remains_len = str_size(cons->char_remains);
 			}
-			
+
 			free(event);
 		}
 	}
-	
+
 	*nread = size;
 	return EOK;
@@ -390,5 +390,5 @@
 	while (off < size)
 		cons_write_char(cons, str_decode(data, &off, size));
-	
+
 	*nwritten = size;
 	return EOK;
@@ -398,5 +398,5 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	cons_update(cons);
 }
@@ -405,9 +405,9 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	chargrid_clear(cons->frontbuf);
 	fibril_mutex_unlock(&cons->mtx);
-	
+
 	cons_update(cons);
 }
@@ -416,9 +416,9 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	chargrid_set_cursor(cons->frontbuf, col, row);
 	fibril_mutex_unlock(&cons->mtx);
-	
+
 	cons_update_cursor(cons);
 }
@@ -427,9 +427,9 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	chargrid_get_cursor(cons->frontbuf, col, row);
 	fibril_mutex_unlock(&cons->mtx);
-	
+
 	return EOK;
 }
@@ -438,10 +438,10 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	*cols = cons->cols;
 	*rows = cons->rows;
 	fibril_mutex_unlock(&cons->mtx);
-	
+
 	return EOK;
 }
@@ -450,9 +450,9 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	*ccaps = cons->ccaps;
 	fibril_mutex_unlock(&cons->mtx);
-	
+
 	return EOK;
 }
@@ -461,5 +461,5 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	chargrid_set_style(cons->frontbuf, style);
@@ -471,5 +471,5 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	chargrid_set_color(cons->frontbuf, bgcolor, fgcolor, attr);
@@ -481,5 +481,5 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	fibril_mutex_lock(&cons->mtx);
 	chargrid_set_rgb_color(cons->frontbuf, bgcolor, fgcolor);
@@ -490,5 +490,5 @@
 {
 	console_t *cons = srv_to_console(srv);
-	
+
 	cons_set_cursor_vis(cons, visible);
 }
@@ -499,8 +499,8 @@
 	link_t *link = prodcons_consume(&cons->input_pc);
 	kbd_event_t *kevent = list_get_instance(link, kbd_event_t, link);
-	
+
 	event->type = CEV_KEY;
 	event->ev.key = *kevent;
-	
+
 	free(kevent);
 	return EOK;
@@ -510,5 +510,5 @@
 {
 	console_t *cons = NULL;
-	
+
 	for (size_t i = 0; i < CONSOLE_COUNT; i++) {
 		if (consoles[i].dsid == (service_id_t) IPC_GET_ARG2(*icall)) {
@@ -517,13 +517,13 @@
 		}
 	}
-	
+
 	if (cons == NULL) {
 		async_answer_0(iid, ENOENT);
 		return;
 	}
-	
+
 	if (atomic_postinc(&cons->refcnt) == 0)
 		cons_set_cursor_vis(cons, true);
-	
+
 	con_conn(iid, icall, &cons->srvs);
 }
@@ -533,5 +533,5 @@
 	async_sess_t *sess;
 	service_id_t dsid;
-	
+
 	errno_t rc = loc_service_get_id(svc, &dsid, 0);
 	if (rc != EOK) {
@@ -546,5 +546,5 @@
 		return EIO;
 	}
-	
+
 	rc = input_open(sess, &input_ev_ops, NULL, &input);
 	if (rc != EOK) {
@@ -554,5 +554,5 @@
 		return rc;
 	}
-	
+
 	return EOK;
 }
@@ -562,5 +562,5 @@
 	async_sess_t *sess;
 	service_id_t dsid;
-	
+
 	errno_t rc = loc_service_get_id(svc, &dsid, 0);
 	if (rc == EOK) {
@@ -573,5 +573,5 @@
 	} else
 		return NULL;
-	
+
 	return sess;
 }
@@ -583,10 +583,10 @@
 	if (rc != EOK)
 		return false;
-	
+
 	/* Connect to output service */
 	output_sess = output_connect(output_svc);
 	if (output_sess == NULL)
 		return false;
-	
+
 	/* Register server */
 	async_set_fallback_port_handler(client_connection, NULL);
@@ -597,11 +597,11 @@
 		return false;
 	}
-	
+
 	output_get_dimensions(output_sess, &cols, &rows);
 	output_set_style(output_sess, STYLE_NORMAL);
-	
+
 	console_caps_t ccaps;
 	output_get_caps(output_sess, &ccaps);
-	
+
 	/*
 	 * Inititalize consoles only if there are
@@ -615,5 +615,5 @@
 			prodcons_initialize(&consoles[i].input_pc);
 			consoles[i].char_remains_len = 0;
-			
+
 			consoles[i].cols = cols;
 			consoles[i].rows = rows;
@@ -621,10 +621,10 @@
 			consoles[i].frontbuf =
 			    chargrid_create(cols, rows, CHARGRID_FLAG_SHARED);
-			
+
 			if (consoles[i].frontbuf == NULL) {
 				printf("%s: Unable to allocate frontbuffer %zu\n", NAME, i);
 				return false;
 			}
-			
+
 			consoles[i].fbid = output_frontbuf_create(output_sess,
 			    consoles[i].frontbuf);
@@ -633,12 +633,12 @@
 				return false;
 			}
-			
+
 			con_srvs_init(&consoles[i].srvs);
 			consoles[i].srvs.ops = &con_ops;
 			consoles[i].srvs.sarg = &consoles[i];
-			
+
 			char vc[LOC_NAME_MAXLEN + 1];
 			snprintf(vc, LOC_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i);
-			
+
 			if (loc_service_register(vc, &consoles[i].dsid) != EOK) {
 				printf("%s: Unable to register device %s\n", NAME, vc);
@@ -646,8 +646,8 @@
 			}
 		}
-		
+
 		input_activate(input);
 	}
-	
+
 	return true;
 }
@@ -664,14 +664,14 @@
 		return -1;
 	}
-	
+
 	printf("%s: HelenOS Console service\n", NAME);
-	
+
 	if (!console_srv_init(argv[1], argv[2]))
 		return -1;
-	
+
 	printf("%s: Accepting connections\n", NAME);
 	task_retval(0);
 	async_manager();
-	
+
 	/* Never reached */
 	return 0;
