Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various things #195

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist/
.vscode/ipch
.vscode/extensions.json
cc-nc-hardware/*/*-backups/
.idea/
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Join us in #bluescsi on https://discord.gg/GKcvtgU7P9[Discord] or open an issue

## Hardware

Hardware schematics, designs, and production files can be found under the `cc-nc-hardware` folder.
Hardware schematics, designs, and production files can be found under the `hardware` folder.

Hardware version numbers are based on when the design was updated plus a sub-revision letter, such as "2022_11b" and "2022_12a".

Expand Down
10 changes: 5 additions & 5 deletions src/BlueSCSI_disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,11 @@ static void checkDiskGeometryDivisible(image_config_t &img)
uint32_t sectorsPerHeadTrack = img.sectorsPerTrack * img.headsPerCylinder;
if (img.scsiSectors % sectorsPerHeadTrack != 0)
{
log("WARNING: Host used command ", scsiDev.cdb[0],
" which is affected by drive geometry. Current settings are ",
(int)img.sectorsPerTrack, " sectors x ", (int)img.headsPerCylinder, " heads = ",
(int)sectorsPerHeadTrack, " but image size of ", (int)img.scsiSectors,
" sectors is not divisible. This can cause error messages in diagnostics tools.");
debuglog("WARNING: Host used command ", scsiDev.cdb[0],
" which is affected by drive geometry. Current settings are ",
(int)img.sectorsPerTrack, " sectors x ", (int)img.headsPerCylinder, " heads = ",
(int)sectorsPerHeadTrack, " but image size of ", (int)img.scsiSectors,
" sectors is not divisible. This can cause error messages in diagnostics tools.");
img.geometrywarningprinted = true;
}
}
Expand Down
25 changes: 10 additions & 15 deletions src/BlueSCSI_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,12 @@ void scsiInitiatorMainLoop()
g_initiator_state.sectorcount = g_initiator_state.sectorcount_all = 0;
}

const char *filename_format = "HD00_imaged.hda";
char filename[18] = "";
if (inquiryok)
{
g_initiator_state.deviceType = inquiry_data[0] & 0x1F;
if (g_initiator_state.deviceType == DEVICE_TYPE_CD)
{
filename_format = "CD00_imaged.iso";
g_initiator_state.ejectWhenDone = true;
}
else if(g_initiator_state.deviceType != DEVICE_TYPE_DIRECT_ACCESS)
Expand All @@ -252,11 +251,7 @@ void scsiInitiatorMainLoop()

if (g_initiator_state.sectorcount > 0)
{
char filename[32] = {0};
int lun = 0;

strncpy(filename, filename_format, sizeof(filename) - 1);
filename[2] += g_initiator_state.target_id;
int image_num = 0;

uint64_t sd_card_free_bytes = (uint64_t)SD.vol()->freeClusterCount() * SD.vol()->bytesPerCluster();
if(sd_card_free_bytes < total_bytes)
Expand All @@ -266,14 +261,14 @@ void scsiInitiatorMainLoop()
return;
}

while(SD.exists(filename))
{
filename[3] = lun++ + '0';
}
if(lun != 0)
{
log("Using filename: ", filename, " to avoid overwriting existing file.");
}
do {
sprintf(filename, "%s%d_imaged-%03d.%s",
(g_initiator_state.deviceType == DEVICE_TYPE_CD) ? "CD" : "HD",
g_initiator_state.target_id,
++image_num,
(g_initiator_state.deviceType == DEVICE_TYPE_CD) ? "iso" : "hda");
} while(SD.exists(filename));
log("Imaging filename: ", filename, ".");
g_initiator_state.target_file = SD.open(filename, O_WRONLY | O_CREAT | O_TRUNC);
if (!g_initiator_state.target_file.isOpen())
{
Expand Down