Added ability to set the serial baud rate via the user's terminal in the XPLAINBridge...
[pub/USBasp.git] / Demos / Device / ClassDriver / MassStorage / Lib / SCSI.c
index 6c20576..35d5b59 100644 (file)
@@ -138,8 +138,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)
  */
 static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)
 {
-       uint16_t AllocationLength  = (((uint16_t)MSInterfaceInfo->State.CommandBlock.SCSICommandData[3] << 8) |
-                                                MSInterfaceInfo->State.CommandBlock.SCSICommandData[4]);
+       uint16_t AllocationLength  = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[3]);
        uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :
                                                                               sizeof(InquiryData);
 
@@ -160,7 +159,7 @@ static void SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)
        uint8_t PadBytes[AllocationLength - BytesTransferred];
        
        /* Pad out remaining bytes with 0x00 */
-       Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
+       Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
 
        /* Finalize the stream transfer to send the last packet */
        Endpoint_ClearIN();