Skip to content

Commit

Permalink
Merge pull request #194 from mynameistroy/troy/cdb_length_fix
Browse files Browse the repository at this point in the history
added a full lookup table for cdb length
  • Loading branch information
erichelgeson authored Dec 1, 2022
2 parents 726d72c + 6ec7530 commit a8903d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/BlueSCSI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,7 @@ void loop()

LOGHEX(cmd[0]);
// Command length selection, reception
static const int cmd_class_len[8]={6,10,10,6,6,12,6,6};
len = cmd_class_len[cmd[0] >> 5];
len = cdb_len_lookup[cmd[0]];
cmd[1] = readHandshake(); LOG(":");LOGHEX(cmd[1]);
cmd[2] = readHandshake(); LOG(":");LOGHEX(cmd[2]);
cmd[3] = readHandshake(); LOG(":");LOGHEX(cmd[3]);
Expand Down
16 changes: 15 additions & 1 deletion src/BlueSCSI.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,19 @@ typedef __attribute__((aligned(4))) struct _SCSI_DEVICE
uint8_t m_sector_offset; // optical sector offset for missing sync header
} SCSI_DEVICE;

static byte cdb_len_lookup[] = {
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
10,10,10,10,10,10,10,10,10,10,10,10,10,10
};

#endif
#endif

0 comments on commit a8903d4

Please sign in to comment.