Fixed incorrect values for REPORT_ITEM_TYPE_* enum values causing corrupt data in...
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 23 Nov 2009 13:01:50 +0000 (13:01 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 23 Nov 2009 13:01:50 +0000 (13:01 +0000)
Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
LUFA/Drivers/USB/Class/Common/HID.h
LUFA/ManPages/ChangeLog.txt

index 21ffa45..a4caaa2 100644 (file)
                \r
                /** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */\r
                #define DEVICE_TYPE_CDROM   0x05\r
-\r
-       /* Type Defines: */\r
-               /** Type define for a SCSI response structure to a SCSI INQUIRY command. For details of the\r
-                *  structure contents, refer to the SCSI specifications.\r
-                */\r
-               typedef struct\r
-               {\r
-                       unsigned char DeviceType          : 5;\r
-                       unsigned char PeripheralQualifier : 3;\r
-                       \r
-                       unsigned char _RESERVED1          : 7;\r
-                       unsigned char Removable           : 1;\r
-                       \r
-                       uint8_t      Version;\r
-                       \r
-                       unsigned char ResponseDataFormat  : 4;\r
-                       unsigned char _RESERVED2          : 1;\r
-                       unsigned char NormACA             : 1;\r
-                       unsigned char TrmTsk              : 1;\r
-                       unsigned char AERC                : 1;\r
-\r
-                       uint8_t      AdditionalLength;\r
-                       uint8_t      _RESERVED3[2];\r
-\r
-                       unsigned char SoftReset           : 1;\r
-                       unsigned char CmdQue              : 1;\r
-                       unsigned char _RESERVED4          : 1;\r
-                       unsigned char Linked              : 1;\r
-                       unsigned char Sync                : 1;\r
-                       unsigned char WideBus16Bit        : 1;\r
-                       unsigned char WideBus32Bit        : 1;\r
-                       unsigned char RelAddr             : 1;\r
-                       \r
-                       uint8_t      VendorID[8];\r
-                       uint8_t      ProductID[16];\r
-                       uint8_t      RevisionID[4];\r
-               } SCSI_Inquiry_Response_t;\r
-               \r
-               /** Type define for a SCSI sense structure to a SCSI REQUEST SENSE command. For details of the\r
-                *  structure contents, refer to the SCSI specifications.\r
-                */\r
-               typedef struct\r
-               {\r
-                       uint8_t       ResponseCode;\r
-                       \r
-                       uint8_t       SegmentNumber;\r
-                       \r
-                       unsigned char SenseKey            : 4;\r
-                       unsigned char _RESERVED1          : 1;\r
-                       unsigned char ILI                 : 1;\r
-                       unsigned char EOM                 : 1;\r
-                       unsigned char FileMark            : 1;\r
-                       \r
-                       uint8_t      Information[4];\r
-                       uint8_t      AdditionalLength;\r
-                       uint8_t      CmdSpecificInformation[4];\r
-                       uint8_t      AdditionalSenseCode;\r
-                       uint8_t      AdditionalSenseQualifier;\r
-                       uint8_t      FieldReplaceableUnitCode;\r
-                       uint8_t      SenseKeySpecific[3];\r
-               } SCSI_Request_Sense_Response_t;\r
                \r
        /* Function Prototypes: */\r
                bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);\r
index 921f3a9..b3c17a8 100644 (file)
@@ -165,7 +165,7 @@ void ReadNextReport(void)
  *\r
  *  \param[in] ReportOUTData  Buffer containing the report to send to the device\r
  *  \param[in] ReportIndex  Index of the report in the device (zero if the device does not use multiple reports)\r
- *  \param[in] ReportType  Type of report to send, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature\r
+ *  \param[in] ReportType  Type of report to send, either REPORT_TYPE_OUT or REPORT_TYPE_FEATURE\r
  *  \param[in] ReportLength  Length of the report to send\r
  */\r
 void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength)\r
@@ -175,7 +175,7 @@ void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t Report
        \r
        /* Not all HID devices have an OUT endpoint (some require OUT reports to be sent over the\r
         * control endpoint instead) - check to see if the OUT endpoint has been initialized */\r
-       if (Pipe_IsConfigured())\r
+       if (Pipe_IsConfigured() && (ReportType == REPORT_TYPE_OUT))\r
        {\r
                Pipe_Unfreeze();\r
 \r
index 3395e32..1c6210a 100644 (file)
                /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
                #define LEDMASK_USB_ERROR        (LEDS_LED1 | LEDS_LED3)\r
                \r
+               /** HID Report Type to indicate an IN report. */\r
+               #define REPORT_TYPE_IN           1\r
+\r
+               /** HID Report Type to indicate an OUT report. */\r
+               #define REPORT_TYPE_OUT          2\r
+\r
+               /** HID Report Type to indicate a FEATURE report. */\r
+               #define REPORT_TYPE_FEATURE      3\r
+               \r
        /* Function Prototypes: */\r
                void SetupHardware(void);\r
                void HID_Host_Task(void);\r
index f303317..8271808 100644 (file)
@@ -90,9 +90,9 @@
                /** Enum for the different types of HID reports. */\r
                enum HID_ReportItemTypes_t\r
                {\r
-                       REPORT_ITEM_TYPE_In                   = 1, /**< Indicates that the item is an IN report type. */\r
-                       REPORT_ITEM_TYPE_Out                  = 2, /**< Indicates that the item is an OUT report type. */\r
-                       REPORT_ITEM_TYPE_Feature              = 3, /**< Indicates that the item is a FEATURE report type. */\r
+                       REPORT_ITEM_TYPE_In                   = 0, /**< Indicates that the item is an IN report type. */\r
+                       REPORT_ITEM_TYPE_Out                  = 1, /**< Indicates that the item is an OUT report type. */\r
+                       REPORT_ITEM_TYPE_Feature              = 2, /**< Indicates that the item is a FEATURE report type. */\r
                };\r
 \r
                /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID\r
index 996f716..a69eb9a 100644 (file)
@@ -21,6 +21,7 @@
   *\r
   *  <b>Fixed:</b>\r
   *  - Added missing CDC_Host_CreateBlockingStream() function code to the CDC Host Class driver\r
+  *  - Fixed incorrect values for REPORT_ITEM_TYPE_* enum values causing corrupt data in the HID Host Parser\r
   *\r
   *  \section Sec_ChangeLog091122 Version 091122\r
   *\r