diff --git a/README.md b/README.md index a6acabb..ab9ab7b 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,12 @@ Thanks to Changelog -------------- +**v0.2.6:** + +* Updated codebase to use `localtime_r()` instead of `localtime()` to avoid possible race conditions with other threads. +* Fixed `fs-libs` building under Linux distros with pacman. Thanks to [ITotalJustice](https://github.com/ITotalJustice) for reporting this issue! +* Implemented support for UMS devices that don't byteswap the Command Status Wrapper signature before sending back SCSI command responses.Thanks to [rdmrocha](https://github.com/rdmrocha) for reporting this issue! + **v0.2.5:** * Updated lwext4 patch to fix mountpoint corruption issues if a mountpoint name is reused after a previous call to `ext4_mount` failed. diff --git a/include/usbhsfs.h b/include/usbhsfs.h index bece435..6937763 100644 --- a/include/usbhsfs.h +++ b/include/usbhsfs.h @@ -22,7 +22,7 @@ extern "C" { /// Library version. #define LIBUSBHSFS_VERSION_MAJOR 0 #define LIBUSBHSFS_VERSION_MINOR 2 -#define LIBUSBHSFS_VERSION_MICRO 5 +#define LIBUSBHSFS_VERSION_MICRO 6 /// Helper macro to generate a string based on a filesystem type value. #define LIBUSBHSFS_FS_TYPE_STR(x) ((x) == UsbHsFsDeviceFileSystemType_FAT12 ? "FAT12" : ((x) == UsbHsFsDeviceFileSystemType_FAT16 ? "FAT16" : ((x) == UsbHsFsDeviceFileSystemType_FAT32 ? "FAT32" : \ diff --git a/source/usbhsfs_scsi.c b/source/usbhsfs_scsi.c index 5ae3c8a..7e1dfee 100644 --- a/source/usbhsfs_scsi.c +++ b/source/usbhsfs_scsi.c @@ -985,7 +985,7 @@ static bool usbHsFsScsiTransferCommand(UsbHsFsDriveContext *drive_ctx, ScsiComma if (receive && rest_size == sizeof(ScsiCommandStatusWrapper)) { memcpy(&csw, xfer_buf, sizeof(ScsiCommandStatusWrapper)); - if (csw.dCSWSignature == __builtin_bswap32(SCSI_CSW_SIGNATURE) && csw.dCSWTag == cbw->dCBWTag) + if ((csw.dCSWSignature == SCSI_CSW_SIGNATURE || csw.dCSWSignature == __builtin_bswap32(SCSI_CSW_SIGNATURE)) && csw.dCSWTag == cbw->dCBWTag) { USBHSFS_LOG_DATA(&csw, sizeof(ScsiCommandStatusWrapper), "Data from unexpected CSW (interface %d, LUN %u):", drive_ctx->usb_if_id, cbw->bCBWLUN); @@ -1150,7 +1150,7 @@ static bool usbHsFsScsiReceiveCommandStatusWrapper(UsbHsFsDriveContext *drive_ct USBHSFS_LOG_DATA(csw, sizeof(ScsiCommandStatusWrapper), "Data from received CSW (interface %d, LUN %u):", drive_ctx->usb_if_id, cbw->bCBWLUN); /* Check CSW signature. */ - if (csw->dCSWSignature != __builtin_bswap32(SCSI_CSW_SIGNATURE)) + if (csw->dCSWSignature != SCSI_CSW_SIGNATURE && csw->dCSWSignature != __builtin_bswap32(SCSI_CSW_SIGNATURE)) { USBHSFS_LOG_MSG("Invalid CSW signature! (0x%08X) (interface %d, LUN %u).", __builtin_bswap32(csw->dCSWSignature), drive_ctx->usb_if_id, cbw->bCBWLUN); goto end;