Skip to content

Commit

Permalink
scsi: fix std inquiry len set when vendor info is added. fixes: #152
Browse files Browse the repository at this point in the history
  • Loading branch information
erichelgeson committed Sep 22, 2024
1 parent a45bfc3 commit 7152c59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/BlueSCSI_platform_RP2040/BlueSCSI_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern const char *g_platform_name;
#define PLATFORM_NAME "BlueSCSI"
#define PLATFORM_REVISION "2.0"
#define PLATFORM_TOOLBOX_API 0
#define PLATFORM_INQUIRY PLATFORM_NAME " v" BLUESCSI_FW_VERSION
#define PLATFORM_INQUIRY PLATFORM_NAME "v" FW_VER_NUM
#define PLATFORM_MAX_SCSI_SPEED S2S_CFG_SPEED_SYNC_10
#define PLATFORM_OPTIMAL_MIN_SD_WRITE_SIZE 32768
#define PLATFORM_OPTIMAL_MAX_SD_WRITE_SIZE 65536
Expand Down
29 changes: 14 additions & 15 deletions lib/SCSI2SD/src/firmware/inquiry.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ static uint8_t StandardResponse[] =
0x00, // device type modifier
0x02, // Complies with ANSI SCSI-2.
0x01, // Response format is compatible with the old CCS format.
0x1f, // standard length.
INQUIRY_STD_RESPONSE_LEN, // Additional data size. standard length: 0x1f (31)
0, 0, // Reserved
0x18 // Enable sync and linked commands
};
// Vendor set by config 'c','o','d','e','s','r','c',' ',
// prodId set by config'S','C','S','I','2','S','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',
// Revision set by config'2','.','0','a'
// Vendor set by config - 8
// prodId set by config - 16
// Revision set by config - 4


static const uint8_t SupportedVitalPages[] =
Expand Down Expand Up @@ -258,22 +258,21 @@ uint32_t s2s_getStandardInquiry(
sizeof(cfg->vendor) +
sizeof(cfg->prodId) +
sizeof(cfg->revision);

// Vendor Unique Parameters
if(cfg->deviceType == S2S_CFG_ZIP100) {
memcpy(&out[size], IOMegaVendorInquiry, sizeof(IOMegaVendorInquiry));
size += sizeof(IOMegaVendorInquiry);
out[7] = 0x00; // Disable sync and linked commands
out[4] = 0x75; // 117 length
out[INQUIRY_STD_RESPONSE_LEN_OFFSET] = 0x75; // 117 length
} else if(cfg->deviceType != S2S_CFG_NETWORK) {
// Mac Daynaport Driver does not like this added.
memcpy(&out[size], PLATFORM_INQUIRY, sizeof(PLATFORM_INQUIRY) - 1);
size += sizeof(PLATFORM_INQUIRY) - 1;
out[size++] = PLATFORM_TOOLBOX_API;
out[INQUIRY_STD_RESPONSE_LEN_OFFSET] = INQUIRY_STD_RESPONSE_LEN +
sizeof(PLATFORM_INQUIRY);
}
// Mac Daynaport Driver does not like this added.
// IOMega already has a vendor inquiry
if(cfg->deviceType != S2S_CFG_NETWORK && cfg->deviceType != S2S_CFG_ZIP100) {
memcpy(&out[size], PLATFORM_INQUIRY, sizeof(PLATFORM_INQUIRY));
size += sizeof(PLATFORM_INQUIRY);
out[size] = PLATFORM_TOOLBOX_API;
size += 1;
}
return size;
return size;
}

uint8_t getDeviceTypeQualifier()
Expand Down
3 changes: 3 additions & 0 deletions lib/SCSI2SD/src/firmware/inquiry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#ifndef S2S_INQUIRY_H
#define S2S_INQUIRY_H

#define INQUIRY_STD_RESPONSE_LEN_OFFSET 4
#define INQUIRY_STD_RESPONSE_LEN 0x1f // 31

void s2s_scsiInquiry(void);
uint32_t s2s_getStandardInquiry(const S2S_TargetCfg* cfg, uint8_t* out, uint32_t maxlen);
uint8_t getDeviceTypeQualifier(void);
Expand Down

0 comments on commit 7152c59

Please sign in to comment.