Index: uspace/lib/usbhid/src/hidparser.c
===================================================================
--- uspace/lib/usbhid/src/hidparser.c	(revision e0a5d4cfd543daee5dd5a861793ddd18dcb32c0b)
+++ uspace/lib/usbhid/src/hidparser.c	(revision 3061bc129a855122d429fbba1e623a521aaa164c)
@@ -52,6 +52,6 @@
 int usb_hid_translate_data(usb_hid_report_field_t *item, const uint8_t *data);
 
-uint32_t usb_hid_translate_data_reverse(usb_hid_report_field_t *item, 
-	int32_t value);
+uint32_t usb_hid_translate_data_reverse(usb_hid_report_field_t *item,
+    int32_t value);
 
 
@@ -76,9 +76,9 @@
  *
  * @param parser Opaque report parser structure
- * @param report_id 
+ * @param report_id
  * @param type
  * @return Number of items in specified report
  */
-size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id, 
+size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id,
     usb_hid_report_type_t type)
 {
@@ -100,9 +100,9 @@
  *
  * @param parser Opaque report parser structure
- * @param report_id 
+ * @param report_id
  * @param type
  * @return Number of items in specified report
  */
-size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id, 
+size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id,
     usb_hid_report_type_t type)
 {
@@ -117,5 +117,5 @@
 		return 0;
 	} else {
-		return ((report_des->bit_length + 7) / 8) ;
+		return ((report_des->bit_length + 7) / 8);
 	}
 }
@@ -129,11 +129,11 @@
  * @param data Data for the report.
  * @return Error code.
- */ 
-errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data, 
+ */
+errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,
     size_t size, uint8_t *report_id)
 {
 	usb_hid_report_description_t *report_des;
 	usb_hid_report_type_t type = USB_HID_REPORT_TYPE_INPUT;
-	
+
 	if (report == NULL) {
 		return EINVAL;
@@ -146,5 +146,5 @@
 	}
 
-	report_des = usb_hid_report_find_description(report, *report_id, 
+	report_des = usb_hid_report_find_description(report, *report_id,
 	    type);
 
@@ -158,15 +158,15 @@
 
 		if (USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) {
-			
+
 			if (USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) {
 				/* array */
-				item->value = 
-					usb_hid_translate_data(item, data);
-				
+				item->value =
+				    usb_hid_translate_data(item, data);
+
 				item->usage = USB_HID_EXTENDED_USAGE(
 				    item->usages[item->value -
 				    item->physical_minimum]);
 
-				item->usage_page = 
+				item->usage_page =
 				    USB_HID_EXTENDED_USAGE_PAGE(
 				    item->usages[item->value -
@@ -174,19 +174,19 @@
 
 				usb_hid_report_set_last_item(
-				    item->collection_path, 
-				    USB_HID_TAG_CLASS_GLOBAL, 
+				    item->collection_path,
+				    USB_HID_TAG_CLASS_GLOBAL,
 				    item->usage_page);
 
 				usb_hid_report_set_last_item(
-				    item->collection_path, 
+				    item->collection_path,
 				    USB_HID_TAG_CLASS_LOCAL, item->usage);
 			} else {
 				/* variable item */
-				item->value = usb_hid_translate_data(item, 
+				item->value = usb_hid_translate_data(item,
 				    data);
 			}
 		}
 	}
-	
+
 	return EOK;
 }
@@ -214,9 +214,9 @@
 	int resolution;
 	if (item->physical_maximum == item->physical_minimum) {
-	    resolution = 1;
-	} else {
-	    resolution = (item->logical_maximum - item->logical_minimum) /
-		((item->physical_maximum - item->physical_minimum) *
-		(usb_pow(10, (item->unit_exponent))));
+		resolution = 1;
+	} else {
+		resolution = (item->logical_maximum - item->logical_minimum) /
+		    ((item->physical_maximum - item->physical_minimum) *
+		    (usb_pow(10, (item->unit_exponent))));
 	}
 
@@ -255,5 +255,5 @@
 	}
 
-	return (int) (((value - item->logical_minimum) / resolution) + 
+	return (int) (((value - item->logical_minimum) / resolution) +
 	    item->physical_minimum);
 }
@@ -262,5 +262,5 @@
 /* OUTPUT API */
 
-/** 
+/**
  * Allocates output report buffer for output report
  *
@@ -270,5 +270,5 @@
  * @return Returns allocated output buffer for specified output
  */
-uint8_t *usb_hid_report_output(usb_hid_report_t *report, size_t *size, 
+uint8_t *usb_hid_report_output(usb_hid_report_t *report, size_t *size,
     uint8_t report_id)
 {
@@ -322,5 +322,5 @@
  * @return Error code
  */
-errno_t usb_hid_report_output_translate(usb_hid_report_t *report, 
+errno_t usb_hid_report_output_translate(usb_hid_report_t *report,
     uint8_t report_id, uint8_t *buffer, size_t size)
 {
@@ -329,5 +329,5 @@
 	int length;
 	int32_t tmp_value;
-	
+
 	if (report == NULL) {
 		return EINVAL;
@@ -339,7 +339,7 @@
 
 	usb_hid_report_description_t *report_des;
-	report_des = usb_hid_report_find_description(report, report_id, 
+	report_des = usb_hid_report_find_description(report, report_id,
 	    USB_HID_REPORT_TYPE_OUTPUT);
-	
+
 	if (report_des == NULL) {
 		return EINVAL;
@@ -348,14 +348,14 @@
 	list_foreach(report_des->report_items, ritems_link,
 	    usb_hid_report_field_t, report_item) {
-		value = usb_hid_translate_data_reverse(report_item, 
+		value = usb_hid_translate_data_reverse(report_item,
 		    report_item->value);
 
 		offset = report_des->bit_length - report_item->offset - 1;
 		length = report_item->size;
-		
+
 		usb_log_debug("\ttranslated value: %x", value);
 
 		if ((offset / 8) == ((offset + length - 1) / 8)) {
-			if (((size_t) (offset / 8) >= size) || 
+			if (((size_t) (offset / 8) >= size) ||
 			    ((size_t) (offset + length - 1) / 8) >= size) {
 				break; // TODO ErrorCode
@@ -364,5 +364,5 @@
 			value = value << shift;
 			value = value & (((1 << length) - 1) << shift);
-			
+
 			uint8_t mask = 0;
 			mask = 0xff - (((1 << length) - 1) << shift);
@@ -376,23 +376,23 @@
 				if (i == (offset / 8)) {
 					tmp_value = value;
-					tmp_value = tmp_value & 
+					tmp_value = tmp_value &
 					    ((1 << (8 - (offset % 8))) - 1);
 
 					tmp_value = tmp_value << (offset % 8);
-					
+
 					mask = ~(((1 << (8 - (offset % 8))) - 1)
 					    << (offset % 8));
 
-					buffer[i] = (buffer[i] & mask) | 
+					buffer[i] = (buffer[i] & mask) |
 					    tmp_value;
 				} else if (i == ((offset + length - 1) / 8)) {
-					
-					value = value >> (length - 
+
+					value = value >> (length -
 					    ((offset + length) % 8));
 
-					value = value & ((1 << (length - 
+					value = value & ((1 << (length -
 					    ((offset + length) % 8))) - 1);
-					
-					mask = (1 << (length - 
+
+					mask = (1 << (length -
 					    ((offset + length) % 8))) - 1;
 
@@ -407,5 +407,5 @@
 		report_item->value = 0;
 	}
-	
+
 	return EOK;
 }
@@ -418,5 +418,5 @@
  * @return ranslated value
  */
-uint32_t usb_hid_translate_data_reverse(usb_hid_report_field_t *item, 
+uint32_t usb_hid_translate_data_reverse(usb_hid_report_field_t *item,
     int value)
 {
@@ -430,23 +430,23 @@
 	if ((item->physical_minimum == 0) && (item->physical_maximum == 0)) {
 		item->physical_minimum = item->logical_minimum;
-		item->physical_maximum = item->logical_maximum;			
-	}
-	
+		item->physical_maximum = item->logical_maximum;
+	}
+
 	/* variable item */
 	if (item->physical_maximum == item->physical_minimum) {
-	    resolution = 1;
-	} else {
-	    resolution = (item->logical_maximum - item->logical_minimum) /
-		((item->physical_maximum - item->physical_minimum) *
-		(usb_pow(10, (item->unit_exponent))));
-	}
-
-	ret = ((value - item->physical_minimum) * resolution) + 
+		resolution = 1;
+	} else {
+		resolution = (item->logical_maximum - item->logical_minimum) /
+		    ((item->physical_maximum - item->physical_minimum) *
+		    (usb_pow(10, (item->unit_exponent))));
+	}
+
+	ret = ((value - item->physical_minimum) * resolution) +
 	    item->logical_minimum;
 
 	usb_log_debug("\tvalue(%x), resolution(%x), phymin(%x) logmin(%x), "
-	    "ret(%x)\n", value, resolution, item->physical_minimum, 
+	    "ret(%x)\n", value, resolution, item->physical_minimum,
 	    item->logical_minimum, ret);
-	
+
 	if ((item->logical_minimum < 0) || (item->logical_maximum < 0)) {
 		return USB_HID_INT32_TO_UINT32(ret, item->size);
@@ -467,8 +467,8 @@
 {
 	usb_hid_report_item_t *new_report_item;
-	
+
 	if (!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) {
 		return NULL;
-	}					
+	}
 	memcpy(new_report_item,item, sizeof(usb_hid_report_item_t));
 	link_initialize(&(new_report_item->link));
@@ -485,5 +485,5 @@
  * @param field Current field. If NULL is given, the first one in the report
  * is returned. Otherwise the next one i nthe list is returned.
- * @param path Usage path specifying which fields wa are interested in. 
+ * @param path Usage path specifying which fields wa are interested in.
  * @param flags Flags defining mode of usage paths comparison
  * @param type Type of report we search.
@@ -491,13 +491,13 @@
  * @retval Pointer to the founded report structure when founded
  */
-usb_hid_report_field_t *usb_hid_report_get_sibling(usb_hid_report_t *report, 
-    usb_hid_report_field_t *field, usb_hid_report_path_t *path, int flags, 
+usb_hid_report_field_t *usb_hid_report_get_sibling(usb_hid_report_t *report,
+    usb_hid_report_field_t *field, usb_hid_report_path_t *path, int flags,
     usb_hid_report_type_t type)
 {
-	usb_hid_report_description_t *report_des = 
+	usb_hid_report_description_t *report_des =
 	    usb_hid_report_find_description(report, path->report_id, type);
 
 	link_t *field_it;
-	
+
 	if (report_des == NULL) {
 		return NULL;
@@ -511,5 +511,5 @@
 
 	while (field_it != &report_des->report_items.head) {
-		field = list_get_instance(field_it, usb_hid_report_field_t, 
+		field = list_get_instance(field_it, usb_hid_report_field_t,
 		    ritems_link);
 
@@ -553,7 +553,7 @@
 	usb_hid_report_description_t *report_des;
 	link_t *report_it;
-	
+
 	if (report_id > 0) {
-		report_des = usb_hid_report_find_description(report, report_id, 
+		report_des = usb_hid_report_find_description(report, report_id,
 		    type);
 		if (report_des == NULL) {
@@ -561,5 +561,5 @@
 		} else {
 			report_it = report_des->reports_link.next;
-		}	
+		}
 	} else {
 		report_it = report->reports.head.next;
@@ -567,5 +567,5 @@
 
 	while (report_it != &report->reports.head) {
-		report_des = list_get_instance(report_it, 
+		report_des = list_get_instance(report_it,
 		    usb_hid_report_description_t, reports_link);
 
@@ -594,8 +594,8 @@
 		return;
 	}
-	
+
 	report_item->usages_count = 0;
 	memset(report_item->usages, 0, USB_HID_MAX_USAGES);
-	
+
 	report_item->extended_usage_page = 0;
 	report_item->usage_minimum = 0;
