Index: uspace/lib/drv/generic/remote_usbhid.c
===================================================================
--- uspace/lib/drv/generic/remote_usbhid.c	(revision 2df648c21c391c17d1f85e9048df461d4ca35ea4)
+++ uspace/lib/drv/generic/remote_usbhid.c	(revision 63d4d4fd3e88e94da562806fa61e80068520ae4c)
@@ -36,5 +36,4 @@
 #include <errno.h>
 #include <assert.h>
-#include <stdio.h>
 
 #include "usbhid_iface.h"
@@ -43,6 +42,4 @@
 static void remote_usbhid_get_event_length(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
 static void remote_usbhid_get_event(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
-static void remote_usbhid_get_report_descriptor_length(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
-static void remote_usbhid_get_report_descriptor(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
 // static void remote_usbhid_(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
 
@@ -50,7 +47,5 @@
 static remote_iface_func_ptr_t remote_usbhid_iface_ops [] = {
 	remote_usbhid_get_event_length,
-	remote_usbhid_get_event,
-	remote_usbhid_get_report_descriptor_length,
-	remote_usbhid_get_report_descriptor
+	remote_usbhid_get_event
 };
 
@@ -63,5 +58,5 @@
 };
 
-//usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
+usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
 
 
@@ -69,25 +64,20 @@
     ipc_callid_t callid, ipc_call_t *call)
 {
-	printf("remote_usbhid_get_event_length()\n");
-	
 	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
 
 	if (!hid_iface->get_event_length) {
-		printf("Get event length not set!\n");
 		async_answer_0(callid, ENOTSUP);
 		return;
 	}
 
-	size_t len = hid_iface->get_event_length(fun);
-//	if (len == 0) {
-//		len = EEMPTY;
-//	}
-	async_answer_1(callid, EOK, len);
-	
-//	if (len < 0) {
-//		async_answer_0(callid, len);
-//	} else {
-//		async_answer_1(callid, EOK, len);
-//	}
+	int len = hid_iface->get_event_length(fun);
+	if (len == 0) {
+		len = EEMPTY;
+	}
+	if (len < 0) {
+		async_answer_0(callid, len);
+	} else {
+		async_answer_1(callid, EOK, len);
+	}
 }
 
@@ -110,109 +100,43 @@
 		return;
 	}
-//	/* Check that length is even number. Truncate otherwise. */
-//	if ((len % 2) == 1) {
-//		len--;
-//	}
+	/* Check that length is even number. Truncate otherwise. */
+	if ((len % 2) == 1) {
+		len--;
+	}
 	if (len == 0) {
 		async_answer_0(data_callid, EINVAL);
 		async_answer_0(callid, EINVAL);
-		return;
 	}
 
 	int rc;
 
-	uint8_t *data = malloc(len);
-	if (data == NULL) {
+	size_t items = len / 2;
+	uint16_t *usage_pages_and_usages = malloc(sizeof(uint16_t) * len);
+	if (usage_pages_and_usages == NULL) {
 		async_answer_0(data_callid, ENOMEM);
 		async_answer_0(callid, ENOMEM);
-		return;
 	}
 
-	size_t act_length;
-	int event_nr;
-	rc = hid_iface->get_event(fun, data, len, &act_length, &event_nr, flags);
+	size_t act_items;
+	int rc = hid_iface->get_event(fun, usage_pages_and_usages,
+	    usage_pages_and_usages + items, items, &act_items, flags);
 	if (rc != EOK) {
-		free(data);
+		free(usage_pages_and_usages);
 		async_answer_0(data_callid, rc);
 		async_answer_0(callid, rc);
-		return;
 	}
-	if (act_length >= len) {
+	if (act_items >= items) {
 		/* This shall not happen. */
 		// FIXME: how about an assert here?
-		act_length = len;
+		act_items = items;
 	}
 
-	async_data_read_finalize(data_callid, data, act_length);
+	async_data_read_finalize(data_callid, usage_pages_and_usages,
+	    act_items * 2 * sizeof(uint16_t));
 
-	free(data);
+	free(usage_pages_and_usages);
 
-	async_answer_1(callid, EOK, event_nr);
+	async_answer_0(callid, EOK);
 }
-
-void remote_usbhid_get_report_descriptor_length(ddf_fun_t *fun, void *iface,
-    ipc_callid_t callid, ipc_call_t *call)
-{
-	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
-
-	if (!hid_iface->get_report_descriptor_length) {
-		async_answer_0(callid, ENOTSUP);
-		return;
-	}
-
-	size_t len = hid_iface->get_report_descriptor_length(fun);
-	async_answer_1(callid, EOK, (sysarg_t) len);
-}
-
-void remote_usbhid_get_report_descriptor(ddf_fun_t *fun, void *iface,
-    ipc_callid_t callid, ipc_call_t *call)
-{
-	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
-
-	if (!hid_iface->get_report_descriptor) {
-		async_answer_0(callid, ENOTSUP);
-		return;
-	}
-
-	size_t len;
-	ipc_callid_t data_callid;
-	if (!async_data_read_receive(&data_callid, &len)) {
-		async_answer_0(callid, EINVAL);
-		return;
-	}
-
-	if (len == 0) {
-		async_answer_0(data_callid, EINVAL);
-		async_answer_0(callid, EINVAL);
-		return;
-	}
-
-	uint8_t *descriptor = malloc(len);
-	if (descriptor == NULL) {
-		async_answer_0(data_callid, ENOMEM);
-		async_answer_0(callid, ENOMEM);
-		return;
-	}
-
-	size_t act_len = 0;
-	int rc = hid_iface->get_report_descriptor(fun, descriptor, len,
-	    &act_len);
-	if (act_len > len) {
-		rc = ELIMIT;
-	}
-	if (rc != EOK) {
-		free(descriptor);
-		async_answer_0(data_callid, rc);
-		async_answer_0(callid, rc);
-		return;
-	}
-
-	async_data_read_finalize(data_callid, descriptor, act_len);
-	async_answer_0(callid, EOK);
-
-	free(descriptor);
-}
-
-
 
 /**
