Synchronized Daynaport Inquiry with other implementations

This commit is contained in:
Uwe Seimet 2021-08-23 11:38:32 +02:00
parent b3b43e7a64
commit 832a8759ef
2 changed files with 16 additions and 38 deletions

View File

@ -149,34 +149,34 @@ void SCSIDaynaPort::Open(const Filepath& path)
// INQUIRY
//
//---------------------------------------------------------------------------
int SCSIDaynaPort::Inquiry(const DWORD *cdb, BYTE *buffer)
int SCSIDaynaPort::Inquiry(const DWORD *cdb, BYTE *buf)
{
// scsi_cdb_6_byte_t command;
// memcpy(&command,cdb,sizeof(command));
ASSERT(cdb);
ASSERT(buffer);
ASSERT(buf);
//allocation_length = command->length;
DWORD allocation_length = cdb[4] + (((DWORD)cdb[3]) << 8);
// if(allocation_length != command.length){
// LOGDEBUG("%s CDB: %02X %02X %02X %02X %02X %02X", __PRETTY_FUNCTION__, (unsigned int)cdb[0], (unsigned int)cdb[1], (unsigned int)cdb[2], (unsigned int)cdb[3], (unsigned int)cdb[4], (unsigned int)cdb[5] );
// LOGWARN(":::::::::: Expected allocation length %04X but found %04X", (unsigned int)allocation_length, (unsigned int)command.length);
// LOGWARN(":::::::::: Doing runtime pointer conversion: %04X", ((scsi_cdb_6_byte_t*)cdb)->length);
// }
LOGTRACE("%s Inquiry, allocation length: %d",__PRETTY_FUNCTION__, (int)allocation_length);
if (allocation_length > 4){
if (allocation_length > sizeof(m_daynaport_inquiry_response)) {
allocation_length = sizeof(m_daynaport_inquiry_response);
if (allocation_length > 44) {
allocation_length = 44;
}
// Copy the pre-canned response
memcpy(buffer, m_daynaport_inquiry_response, allocation_length);
// Basic data
// buf[0] ... Processor Device
// buf[1] ... Not removable
// buf[2] ... SCSI-2 compliant command system
// buf[3] ... SCSI-2 compliant Inquiry response
// buf[4] ... Inquiry additional data
//http://www.bitsavers.org/pdf/apple/scsi/dayna/daynaPORT/pocket_scsiLINK/pocketscsilink_inq.png
memset(buf, 0, allocation_length);
buf[0] = 0x03;
buf[2] = 0x01;
buf[4] = 0x1F;
// Padded vendor, product, revision
memcpy(&buffer[8], GetPaddedName().c_str(), 28);
memcpy(&buf[8], GetPaddedName().c_str(), 28);
}
LOGTRACE("response size is %d", (int)allocation_length);

View File

@ -172,28 +172,6 @@ private:
const BYTE m_daynacom_mac_prefix[3] = {0x00,0x80,0x19};
// Basic data
// buf[0] ... Processor Device
// buf[1] ... Not removable
// buf[2] ... SCSI-2 compliant command system
// buf[3] ... SCSI-2 compliant Inquiry response
// buf[4] ... Inquiry additional data
//http://www.bitsavers.org/pdf/apple/scsi/dayna/daynaPORT/pocket_scsiLINK/pocketscsilink_inq.png
const uint8_t m_daynaport_inquiry_response[44] = {
0x03, 0x00, 0x01, 0x00, // 4 bytes
0x1F, 0x00, 0x00, 0x00, // 4 bytes
// Vendor ID (8 Bytes)
'D','a','y','n','a',' ',' ',' ',
// Product ID (16 Bytes)
'S','C','S','I','/','L','i','n',
'k',' ',' ',' ',' ',' ',' ',' ',
// Revision Number (4 Bytes)
'1','.','4','a',
// Firmware Version (8 Bytes)
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
CTapDriver *m_tap;
// TAP driver
BOOL m_bTapEnable;