Skip to content

Commit

Permalink
Merge pull request #134 from erichelgeson/eric/bugfixes
Browse files Browse the repository at this point in the history
Fix onReadCapacity calculation & Sense offset for Flexable Geometry
  • Loading branch information
erichelgeson authored Jun 24, 2022
2 parents 4dbba49 + 2807821 commit 4552496
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/BlueSCSI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,16 +999,18 @@ byte onRequestSense(SCSI_DEVICE *dev, const byte *cdb)
* READ CAPACITY command processing.
*/
byte onReadCapacity(SCSI_DEVICE *dev, const byte *cdb)
{
{
uint32_t blocksize = dev->m_blocksize;
uint32_t blockcount = dev->m_fileSize / blocksize - 1; // Points to last LBA
uint8_t buf[8] = {
dev->m_blockcount >> 24,
dev->m_blockcount >> 16,
dev->m_blockcount >> 8,
dev->m_blockcount - 1, // Points to last LBA
dev->m_blocksize >> 24,
dev->m_blocksize >> 16,
dev->m_blocksize >> 8,
dev->m_blocksize
blockcount >> 24,
blockcount >> 16,
blockcount >> 8,
blockcount,
blocksize >> 24,
blocksize >> 16,
blocksize >> 8,
blocksize
};
writeDataPhase(8, buf);
return SCSI_STATUS_GOOD;
Expand Down Expand Up @@ -1226,7 +1228,7 @@ byte onModeSense(SCSI_DEVICE *dev, const byte *cdb)
m_buf[a + 4] = 16; // Number of heads
m_buf[a + 5] = 18; // Sectors per track
m_buf[a + 6] = 0x2000; // Data bytes per sector
a += 0x1E;
a += 0x20;
if(pageCode != SCSI_SENSE_MODE_ALL) break;
case SCSI_SENSE_MODE_VENDOR_APPLE:
{
Expand Down

0 comments on commit 4552496

Please sign in to comment.