Add Long File Name (VFAT) entry to the Mass Storage class bootloader, so that systems...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Common / HIDParser.c
index 1d4e116..af537ef 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2012.
+     Copyright (C) Dean Camera, 2013.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  The author disclaims all warranties with regard to this
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
@@ -53,7 +53,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
        while (ReportSize)
        {
                uint8_t  HIDReportItem  = *ReportData;
        while (ReportSize)
        {
                uint8_t  HIDReportItem  = *ReportData;
-               uint32_t ReportItemData = 0;
+               uint32_t ReportItemData;
 
                ReportData++;
                ReportSize--;
 
                ReportData++;
                ReportSize--;
@@ -61,20 +61,27 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
                switch (HIDReportItem & HID_RI_DATA_SIZE_MASK)
                {
                        case HID_RI_DATA_BITS_32:
                switch (HIDReportItem & HID_RI_DATA_SIZE_MASK)
                {
                        case HID_RI_DATA_BITS_32:
-                               ReportItemData  = le32_to_cpu(*((uint32_t*)ReportData));
+                               ReportItemData  = (((uint32_t)ReportData[3] << 24) | ((uint32_t)ReportData[2] << 16) |
+                                              ((uint16_t)ReportData[1] << 8)  | ReportData[0]);
                                ReportSize     -= 4;
                                ReportData     += 4;
                                break;
                                ReportSize     -= 4;
                                ReportData     += 4;
                                break;
+
                        case HID_RI_DATA_BITS_16:
                        case HID_RI_DATA_BITS_16:
-                               ReportItemData  = le16_to_cpu(*((uint16_t*)ReportData));
+                               ReportItemData  = (((uint16_t)ReportData[1] << 8) | (ReportData[0]));
                                ReportSize     -= 2;
                                ReportData     += 2;
                                break;
                                ReportSize     -= 2;
                                ReportData     += 2;
                                break;
+
                        case HID_RI_DATA_BITS_8:
                        case HID_RI_DATA_BITS_8:
-                               ReportItemData  = *((uint8_t*)ReportData);
+                               ReportItemData  = ReportData[0];
                                ReportSize     -= 1;
                                ReportData     += 1;
                                break;
                                ReportSize     -= 1;
                                ReportData     += 1;
                                break;
+
+                       default:
+                               ReportItemData  = 0;
+                               break;
                }
 
                switch (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK))
                }
 
                switch (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK))
@@ -268,6 +275,9 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
                                }
 
                                break;
                                }
 
                                break;
+                       
+                       default:
+                               break;
                }
 
                if ((HIDReportItem & HID_RI_TYPE_MASK) == HID_RI_TYPE_MAIN)
                }
 
                if ((HIDReportItem & HID_RI_TYPE_MASK) == HID_RI_TYPE_MAIN)