Index: uspace/drv/usbkbd/main.c
===================================================================
--- uspace/drv/usbkbd/main.c	(revision 11797d59fb7117d55abe84c6c9f11b4687b3e89c)
+++ uspace/drv/usbkbd/main.c	(revision ba544511759db62eded7601782f553315375b049)
@@ -26,4 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+/** @addtogroup drvusbhid
+ * @{
+ */
 #include <usb/usbdrv.h>
 #include <driver.h>
@@ -38,9 +41,6 @@
 #include <usb/devreq.h>
 #include <usb/descriptor.h>
-#include <io/console.h>
 #include "descparser.h"
 #include "descdump.h"
-#include "conv.h"
-#include "layout.h"
 
 #define BUFFER_SIZE 32
@@ -91,149 +91,8 @@
 
 /*
- * TODO: Move somewhere else
- */
-/*
-#define BYTES_PER_LINE 12
-
-static void dump_buffer(const char *msg, const uint8_t *buffer, size_t length)
-{
-	printf("%s\n", msg);
-	
-	size_t i;
-	for (i = 0; i < length; i++) {
-		printf("  0x%02X", buffer[i]);
-		if (((i > 0) && (((i+1) % BYTES_PER_LINE) == 0))
-		    || (i + 1 == length)) {
-			printf("\n");
-		}
-	}
-}
-*/
-/*
- * Copy-paste from srv/hid/kbd/generic/kbd.c
- */
-
-/** Currently active modifiers. 
- *
- * TODO: put to device?
- */
-static unsigned mods = KM_NUM_LOCK;
-
-/** Currently pressed lock keys. We track these to tackle autorepeat.  
- *
- * TODO: put to device? 
- */
-static unsigned lock_keys;
-
-#define NUM_LAYOUTS 3
-
-static layout_op_t *layout[NUM_LAYOUTS] = {
-	&us_qwerty_op,
-	&us_dvorak_op,
-	&cz_op
-};
-
-static int active_layout = 0;
-
-static void kbd_push_ev(int type, unsigned int key)
-{
-	console_event_t ev;
-	unsigned mod_mask;
-
-	// TODO: replace by our own parsing?? or are the key codes identical??
-	switch (key) {
-	case KC_LCTRL: mod_mask = KM_LCTRL; break;
-	case KC_RCTRL: mod_mask = KM_RCTRL; break;
-	case KC_LSHIFT: mod_mask = KM_LSHIFT; break;
-	case KC_RSHIFT: mod_mask = KM_RSHIFT; break;
-	case KC_LALT: mod_mask = KM_LALT; break;
-	case KC_RALT: mod_mask = KM_RALT; break;
-	default: mod_mask = 0; break;
-	}
-
-	if (mod_mask != 0) {
-		if (type == KEY_PRESS)
-			mods = mods | mod_mask;
-		else
-			mods = mods & ~mod_mask;
-	}
-
-	switch (key) {
-	case KC_CAPS_LOCK: mod_mask = KM_CAPS_LOCK; break;
-	case KC_NUM_LOCK: mod_mask = KM_NUM_LOCK; break;
-	case KC_SCROLL_LOCK: mod_mask = KM_SCROLL_LOCK; break;
-	default: mod_mask = 0; break;
-	}
-
-	if (mod_mask != 0) {
-		if (type == KEY_PRESS) {
-			/*
-			 * Only change lock state on transition from released
-			 * to pressed. This prevents autorepeat from messing
-			 * up the lock state.
-			 */
-			mods = mods ^ (mod_mask & ~lock_keys);
-			lock_keys = lock_keys | mod_mask;
-
-			/* Update keyboard lock indicator lights. */
-			// TODO
-			//kbd_ctl_set_ind(mods);
-		} else {
-			lock_keys = lock_keys & ~mod_mask;
-		}
-	}
-/*
-	printf("type: %d\n", type);
-	printf("mods: 0x%x\n", mods);
-	printf("keycode: %u\n", key);
-*/
-	
-	if (type == KEY_PRESS && (mods & KM_LCTRL) &&
-		key == KC_F1) {
-		active_layout = 0;
-		layout[active_layout]->reset();
-		return;
-	}
-
-	if (type == KEY_PRESS && (mods & KM_LCTRL) &&
-		key == KC_F2) {
-		active_layout = 1;
-		layout[active_layout]->reset();
-		return;
-	}
-
-	if (type == KEY_PRESS && (mods & KM_LCTRL) &&
-		key == KC_F3) {
-		active_layout = 2;
-		layout[active_layout]->reset();
-		return;
-	}
-	
-	ev.type = type;
-	ev.key = key;
-	ev.mods = mods;
-
-	ev.c = layout[active_layout]->parse_ev(&ev);
-
-	printf("Sending key %d to the console\n", ev.key);
-	assert(console_callback_phone != -1);
-	async_msg_4(console_callback_phone, KBD_EVENT, ev.type, ev.key, ev.mods, ev.c);
-}
-/*
- * End of copy-paste
- */
-
-	/*
-	 * TODO:
-	 * 1) key press / key release - how does the keyboard notify about release?
-	 * 2) layouts (use the already defined), not important now
-	 * 3) 
-	 */
-
-/*
  * Callbacks for parser
  */
 static void usbkbd_process_keycodes(const uint8_t *key_codes, size_t count,
-    uint8_t modifiers, void *arg)
+                                    uint8_t modifiers, void *arg)
 {
 	printf("Got keys: ");
@@ -241,9 +100,4 @@
 	for (i = 0; i < count; ++i) {
 		printf("%d ", key_codes[i]);
-		// TODO: Key press / release
-
-		// TODO: NOT WORKING
-		unsigned int key = usbkbd_parse_scancode(key_codes[i]);
-		kbd_push_ev(KEY_PRESS, key);
 	}
 	printf("\n");
@@ -413,16 +267,12 @@
 	//usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks, 
 	//    NULL);
-	printf("Calling usb_hid_boot_keyboard_input_report() with size %d\n",
-	    actual_size);
-	//dump_buffer("bufffer: ", buffer, actual_size);
-	int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size, callbacks, 
-	    NULL);
-	if (rc != EOK) {
-		printf("Error in usb_hid_boot_keyboard_input_report(): %d\n", rc);
-	}
+	printf("Calling usb_hid_boot_keyboard_input_report()...\n)");
+	usb_hid_boot_keyboard_input_report(buffer, actual_size, callbacks, NULL);
 }
 
 static void usbkbd_poll_keyboard(usb_hid_dev_kbd_t *kbd_dev)
 {
+	return;
+	
 	int rc;
 	usb_handle_t handle;
@@ -442,13 +292,10 @@
 	};
 
-	printf("Polling keyboard...\n");
-
 	while (true) {
-		async_usleep(1000 * 1000 * 2);
+		async_usleep(1000 * 1000);
 		rc = usb_drv_async_interrupt_in(kbd_dev->device->parent_phone,
 		    poll_target, buffer, BUFFER_SIZE, &actual_size, &handle);
 
 		if (rc != EOK) {
-			printf("Error in usb_drv_async_interrupt_in(): %d\n", rc);
 			continue;
 		}
@@ -456,5 +303,4 @@
 		rc = usb_drv_async_wait_for(handle);
 		if (rc != EOK) {
-			printf("Error in usb_drv_async_wait_for(): %d\n", rc);
 			continue;
 		}
@@ -465,5 +311,4 @@
 		 */
 		if (actual_size == 0) {
-			printf("Keyboard returned NAK\n");
 			continue;
 		}
@@ -472,5 +317,4 @@
 		 * TODO: Process pressed keys.
 		 */
-		printf("Calling usbkbd_process_interrupt_in()\n");
 		usbkbd_process_interrupt_in(kbd_dev, buffer, actual_size);
 	}
@@ -493,8 +337,4 @@
 	// initialize device (get and process descriptors, get address, etc.)
 	usb_hid_dev_kbd_t *kbd_dev = usbkbd_init_device(dev);
-	if (kbd_dev == NULL) {
-		printf("Error while initializing device.\n");
-		return -1;
-	}
 
 	usbkbd_poll_keyboard(kbd_dev);
@@ -557,2 +397,6 @@
 	return driver_main(&kbd_driver);
 }
+
+/**
+ * @}
+ */
