diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index c867f78e8..eeb343d0c 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -9,7 +9,7 @@ * Implementation of the CD-ROM drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)cdrom.c 1.0.51 2018/10/06 + * Version: @(#)cdrom.c 1.0.52 2018/10/09 * * Author: Miran Grca, * @@ -1781,6 +1781,15 @@ cdrom_command(cdrom_t *dev, uint8_t *cdb) should forget about the not ready, and report unit attention straight away. */ cdrom_set_phase(dev, SCSI_PHASE_DATA_IN); max_len = cdb[4]; + + if (!max_len) { + cdrom_set_phase(dev, SCSI_PHASE_STATUS); + dev->packet_status = CDROM_PHASE_COMPLETE; + dev->callback = 20LL * CDROM_TIME; + cdrom_set_callback(dev); + break; + } + cdrom_buf_alloc(dev, 256); cdrom_set_buf_len(dev, BufLen, &max_len); cdrom_request_sense(dev, cdbufferb, max_len); diff --git a/src/disk/zip.c b/src/disk/zip.c index 03282ddce..7452b4008 100644 --- a/src/disk/zip.c +++ b/src/disk/zip.c @@ -9,7 +9,7 @@ * Implementation of the Iomega ZIP drive with SCSI(-like) * commands, for both ATAPI and SCSI usage. * - * Version: @(#)zip.c 1.0.25 2018/10/07 + * Version: @(#)zip.c 1.0.26 2018/10/09 * * Author: Miran Grca, * @@ -1594,6 +1594,15 @@ zip_command(zip_t *dev, uint8_t *cdb) should forget about the not ready, and report unit attention straight away. */ zip_set_phase(dev, SCSI_PHASE_DATA_IN); max_len = cdb[4]; + + if (!max_len) { + zip_set_phase(dev, SCSI_PHASE_STATUS); + dev->packet_status = ZIP_PHASE_COMPLETE; + dev->callback = 20LL * ZIP_TIME; + zip_set_callback(dev); + break; + } + zip_buf_alloc(dev, 256); zip_set_buf_len(dev, BufLen, &max_len); len = (cdb[1] & 1) ? 8 : 18; diff --git a/src/scsi/scsi_disk.c b/src/scsi/scsi_disk.c index 96d905c2a..faa88e143 100644 --- a/src/scsi/scsi_disk.c +++ b/src/scsi/scsi_disk.c @@ -6,7 +6,7 @@ * * Emulation of SCSI fixed disks. * - * Version: @(#)scsi_disk.c 1.0.23 2018/10/07 + * Version: @(#)scsi_disk.c 1.0.24 2018/10/09 * * Author: Miran Grca, * @@ -663,6 +663,14 @@ scsi_disk_command(scsi_disk_t *dev, uint8_t *cdb) /* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE should forget about the not ready, and report unit attention straight away. */ len = cdb[4]; + + if (!len) { + scsi_disk_set_phase(dev, SCSI_PHASE_STATUS); + dev->packet_status = CDROM_PHASE_COMPLETE; + dev->callback = 20 * SCSI_TIME; + break; + } + scsi_disk_set_buf_len(dev, BufLen, &len); if (*BufLen < cdb[4])