Index: uspace/drv/usbkbd/main.c
===================================================================
--- uspace/drv/usbkbd/main.c	(revision 101ef25c4b30388a9bb0c6cbf006cdbac2e5b1c1)
+++ uspace/drv/usbkbd/main.c	(revision 0e126be78770a2c37ac932b2e25dd35bdc34e12e)
@@ -28,60 +28,10 @@
 #include <usb/usbdrv.h>
 #include <driver.h>
-#include <ipc/driver.h>
 #include <errno.h>
-#include <fibril.h>
-#include <usb/classes/hid.h>
 
 #define BUFFER_SIZE 32
-#define NAME "usbkbd"
 
-static const usb_endpoint_t CONTROL_EP = 0;
-
-static usb_hid_dev_kbd_t *usbkbd_init_device(device_t *dev)
-{
-	usb_hid_dev_kbd_t *kbd_dev = (usb_hid_dev_kbd_t *)malloc(
-			sizeof(usb_hid_dev_kbd_t));
-
-	if (kbd_dev == NULL) {
-		fprintf(stderr, NAME ": No memory!\n");
-		return NULL;
-	}
-
-	kbd_dev->device = dev;
-
-	// get phone to my HC and save it as my parent's phone
-	// TODO: maybe not a good idea if DDF will use parent_phone
-	kbd_dev->device->parent_phone = usb_drv_hc_connect(dev, 0);
-
-	kbd_dev->address = usb_drv_get_my_address(dev->parent_phone,
-	    dev);
-
-	// doesn't matter now that we have no address
-//	if (kbd_dev->address < 0) {
-//		fprintf(stderr, NAME ": No device address!\n");
-//		free(kbd_dev);
-//		return NULL;
-//	}
-
-	// default endpoint
-	kbd_dev->default_ep = CONTROL_EP;
-
-	// TODO: get descriptors
-
-	// TODO: parse descriptors and save endpoints
-
-	return kbd_dev;
-}
-
-static void usbkbd_process_interrupt_in(usb_hid_dev_kbd_t *kbd_dev,
-					char *buffer, size_t actual_size)
-{
-	/*
-	 * here, the parser will be called, probably with some callbacks
-	 * now only take last 6 bytes and process, i.e. send to kbd
-	 */
-}
-
-static void usbkbd_poll_keyboard(usb_hid_dev_kbd_t *kbd_dev)
+/* Call this periodically to check keyboard status changes. */
+static void poll_keyboard(device_t *dev)
 {
 	int rc;
@@ -89,97 +39,64 @@
 	char buffer[BUFFER_SIZE];
 	size_t actual_size;
-	//usb_endpoint_t poll_endpoint = 1;
+	usb_endpoint_t poll_endpoint = 1;
 
-//	usb_address_t my_address = usb_drv_get_my_address(dev->parent_phone,
-//	    dev);
-//	if (my_address < 0) {
-//		return;
-//	}
+	usb_address_t my_address = usb_drv_get_my_address(dev->parent_phone,
+	    dev);
+	if (my_address < 0) {
+		return;
+	}
 
 	usb_target_t poll_target = {
-		.address = kbd_dev->address,
-		.endpoint = kbd_dev->default_ep
+		.address = my_address,
+		.endpoint = poll_endpoint
 	};
 
-	while (true) {
-		rc = usb_drv_async_interrupt_in(kbd_dev->device->parent_phone,
-		    poll_target, buffer, BUFFER_SIZE, &actual_size, &handle);
-
-		if (rc != EOK) {
-			continue;
-		}
-
-		rc = usb_drv_async_wait_for(handle);
-		if (rc != EOK) {
-			continue;
-		}
-
-		/*
-		 * If the keyboard answered with NAK, it returned no data.
-		 * This implies that no change happened since last query.
-		 */
-		if (actual_size == 0) {
-			continue;
-		}
-
-		/*
-		 * TODO: Process pressed keys.
-		 */
-		usbkbd_process_interrupt_in(kbd_dev, buffer, actual_size);
+	rc = usb_drv_async_interrupt_in(dev->parent_phone, poll_target,
+	    buffer, BUFFER_SIZE, &actual_size, &handle);
+	if (rc != EOK) {
+		return;
 	}
 
-	// not reached
-	assert(0);
+	rc = usb_drv_async_wait_for(handle);
+	if (rc != EOK) {
+		return;
+	}
+
+	/*
+	 * If the keyboard answered with NAK, it returned no data.
+	 * This implies that no change happened since last query.
+	 */
+	if (actual_size == 0) {
+		return;
+	}
+
+	/*
+	 * Process pressed keys.
+	 */
 }
 
-static int usbkbd_fibril_device(void *arg)
-{
-	printf("!!! USB device fibril\n");
-
-	if (arg == NULL) {
-		printf("No device!\n");
-		return -1;
-	}
-
-	device_t *dev = (device_t *)arg;
-
-	// initialize device (get and process descriptors, get address, etc.)
-	usb_hid_dev_kbd_t *kbd_dev = usbkbd_init_device(dev);
-
-	usbkbd_poll_keyboard(kbd_dev);
-
-	return EOK;
-}
-
-static int usbkbd_add_device(device_t *dev)
+static int add_kbd_device(device_t *dev)
 {
 	/* For now, fail immediately. */
-	//return ENOTSUP;
+	return ENOTSUP;
 
 	/*
 	 * When everything is okay, connect to "our" HC.
-	 *
-	 * Not supported yet, skip..
 	 */
-//	int phone = usb_drv_hc_connect(dev, 0);
-//	if (phone < 0) {
-//		/*
-//		 * Connecting to HC failed, roll-back and announce
-//		 * failure.
-//		 */
-//		return phone;
-//	}
+	int phone = usb_drv_hc_connect(dev, 0);
+	if (phone < 0) {
+		/*
+		 * Connecting to HC failed, roll-back and announce
+		 * failure.
+		 */
+		return phone;
+	}
 
-//	dev->parent_phone = phone;
+	dev->parent_phone = phone;
 
 	/*
-	 * Create new fibril for handling this keyboard
+	 * Just for fun ;-).
 	 */
-	fid_t fid = fibril_create(usbkbd_fibril_device, dev);
-	if (fid == 0) {
-		printf("%s: failed to start fibril for HID device\n", NAME);
-		return ENOMEM;
-	}
-	fibril_add_ready(fid);
+	poll_keyboard(dev);
 
 	/*
@@ -190,9 +107,9 @@
 
 static driver_ops_t kbd_driver_ops = {
-	.add_device = usbkbd_add_device,
+	.add_device = add_kbd_device,
 };
 
 static driver_t kbd_driver = {
-	.name = NAME,
+	.name = "usbkbd",
 	.driver_ops = &kbd_driver_ops
 };
