|
|
@@ -19,6 +19,8 @@
|
|
|
#include "vendor.h"
|
|
|
#include "diagnostic.h"
|
|
|
|
|
|
+#include <string.h>
|
|
|
+
|
|
|
// Callback after the DATA OUT phase is complete.
|
|
|
static void doAssignDiskParameters(void)
|
|
|
{
|
|
|
@@ -45,8 +47,83 @@ int scsiVendorCommand()
|
|
|
int commandHandled = 1;
|
|
|
|
|
|
uint8_t command = scsiDev.cdb[0];
|
|
|
+ uint8_t alloc_length = scsiDev.cdb[4];
|
|
|
+
|
|
|
+ // iomega sense command
|
|
|
+ if (command == 0x06 && scsiDev.target->cfg->deviceType == S2S_CFG_ZIP100)
|
|
|
+ {
|
|
|
+ int subcommand = scsiDev.cdb[2];
|
|
|
+ scsiDev.phase = DATA_IN;
|
|
|
+
|
|
|
+ // byte 0 is the page
|
|
|
+ scsiDev.data[0] = subcommand;
|
|
|
+
|
|
|
+ if (subcommand == 0x1)
|
|
|
+ {
|
|
|
+ // page is 86 bytes in length
|
|
|
+ scsiDev.dataLen = alloc_length < 0x58 ? alloc_length : 0x58;
|
|
|
+ memset(&scsiDev.data[1], 0xff, scsiDev.dataLen);
|
|
|
+ // byte 1 is the page length minus pagecode and length
|
|
|
+ scsiDev.data[1] = scsiDev.dataLen - 2;
|
|
|
+
|
|
|
+ scsiDev.data[2] = 1;
|
|
|
+ scsiDev.data[3] = 0;
|
|
|
+ scsiDev.data[4] = 0;
|
|
|
+ scsiDev.data[5] = 0;
|
|
|
+ scsiDev.data[6] = 0x5;
|
|
|
+ scsiDev.data[7] = 0xdc;
|
|
|
+ scsiDev.data[8] = 0x6;
|
|
|
+ scsiDev.data[9] = 0xc;
|
|
|
+ scsiDev.data[10] = 0x5;
|
|
|
+ scsiDev.data[11] = 0xdc;
|
|
|
+ scsiDev.data[12] = 0x6;
|
|
|
+ scsiDev.data[13] = 0xc;
|
|
|
+ scsiDev.data[14] = 0;
|
|
|
+ }
|
|
|
+ else if (subcommand == 0x2) {
|
|
|
+ // page is 61 bytes in length
|
|
|
+ scsiDev.dataLen = alloc_length < 0x3f ? alloc_length : 0x3f;
|
|
|
+ memset(&scsiDev.data[1], 0, scsiDev.dataLen);
|
|
|
+ // byte 1 is the page length minus pagecode and length
|
|
|
+ scsiDev.data[1] = scsiDev.dataLen - 2;
|
|
|
+
|
|
|
+ scsiDev.data[3] = 2;
|
|
|
+ scsiDev.data[6] = 0x2;
|
|
|
+ scsiDev.data[7] = 0xff;
|
|
|
+ scsiDev.data[8] = 0xff;
|
|
|
+ scsiDev.data[11] = 0x2;
|
|
|
|
|
|
- if (command == 0xC0)
|
|
|
+ // this has something to do with the format/disk life
|
|
|
+ // currently this makes it 100%
|
|
|
+ scsiDev.data[14] = 0x7e;
|
|
|
+ scsiDev.data[18] = 0x7e;
|
|
|
+
|
|
|
+ // byte 21 is the read/write/password settings
|
|
|
+ // 5 = password for R/W
|
|
|
+ // 3 = password for W
|
|
|
+ // 2 = RO
|
|
|
+ // 0 = RW
|
|
|
+ scsiDev.data[20] = 0;
|
|
|
+
|
|
|
+ // set a serial number ABCDEFGHIJKLMNO
|
|
|
+ // starts at byte 25 and is 15 bytes long
|
|
|
+ for(int i = 0; i < 20; i++) {
|
|
|
+ scsiDev.data[25 + i] = i + 0x41;
|
|
|
+ }
|
|
|
+
|
|
|
+ scsiDev.data[0x3e] = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // anything else is an illegal command
|
|
|
+ scsiDev.status = CHECK_CONDITION;
|
|
|
+ scsiDev.target->sense.code = ILLEGAL_REQUEST;
|
|
|
+ scsiDev.target->sense.asc = LOGICAL_UNIT_NOT_SUPPORTED;
|
|
|
+ scsiDev.phase = STATUS;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (command == 0xC0)
|
|
|
{
|
|
|
// Define flexible disk format
|
|
|
// OMTI-5204 controller
|