Skip to content

Commit a45bfc3

Browse files
authored
Merge pull request #195 from BlueSCSI/eric/variousThings
Various things
2 parents bb09517 + 39098a0 commit a45bfc3

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ dist/
99
.vscode/ipch
1010
.vscode/extensions.json
1111
cc-nc-hardware/*/*-backups/
12+
.idea/

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Join us in #bluescsi on https://discord.gg/GKcvtgU7P9[Discord] or open an issue
1010

1111
## Hardware
1212

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

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

src/BlueSCSI_disk.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ static void checkDiskGeometryDivisible(image_config_t &img)
512512
uint32_t sectorsPerHeadTrack = img.sectorsPerTrack * img.headsPerCylinder;
513513
if (img.scsiSectors % sectorsPerHeadTrack != 0)
514514
{
515-
log("WARNING: Host used command ", scsiDev.cdb[0],
516-
" which is affected by drive geometry. Current settings are ",
517-
(int)img.sectorsPerTrack, " sectors x ", (int)img.headsPerCylinder, " heads = ",
518-
(int)sectorsPerHeadTrack, " but image size of ", (int)img.scsiSectors,
519-
" sectors is not divisible. This can cause error messages in diagnostics tools.");
515+
debuglog("WARNING: Host used command ", scsiDev.cdb[0],
516+
" which is affected by drive geometry. Current settings are ",
517+
(int)img.sectorsPerTrack, " sectors x ", (int)img.headsPerCylinder, " heads = ",
518+
(int)sectorsPerHeadTrack, " but image size of ", (int)img.scsiSectors,
519+
" sectors is not divisible. This can cause error messages in diagnostics tools.");
520520
img.geometrywarningprinted = true;
521521
}
522522
}

src/BlueSCSI_initiator.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,12 @@ void scsiInitiatorMainLoop()
235235
g_initiator_state.sectorcount = g_initiator_state.sectorcount_all = 0;
236236
}
237237

238-
const char *filename_format = "HD00_imaged.hda";
238+
char filename[18] = "";
239239
if (inquiryok)
240240
{
241241
g_initiator_state.deviceType = inquiry_data[0] & 0x1F;
242242
if (g_initiator_state.deviceType == DEVICE_TYPE_CD)
243243
{
244-
filename_format = "CD00_imaged.iso";
245244
g_initiator_state.ejectWhenDone = true;
246245
}
247246
else if(g_initiator_state.deviceType != DEVICE_TYPE_DIRECT_ACCESS)
@@ -252,11 +251,7 @@ void scsiInitiatorMainLoop()
252251

253252
if (g_initiator_state.sectorcount > 0)
254253
{
255-
char filename[32] = {0};
256-
int lun = 0;
257-
258-
strncpy(filename, filename_format, sizeof(filename) - 1);
259-
filename[2] += g_initiator_state.target_id;
254+
int image_num = 0;
260255

261256
uint64_t sd_card_free_bytes = (uint64_t)SD.vol()->freeClusterCount() * SD.vol()->bytesPerCluster();
262257
if(sd_card_free_bytes < total_bytes)
@@ -266,14 +261,14 @@ void scsiInitiatorMainLoop()
266261
return;
267262
}
268263

269-
while(SD.exists(filename))
270-
{
271-
filename[3] = lun++ + '0';
272-
}
273-
if(lun != 0)
274-
{
275-
log("Using filename: ", filename, " to avoid overwriting existing file.");
276-
}
264+
do {
265+
sprintf(filename, "%s%d_imaged-%03d.%s",
266+
(g_initiator_state.deviceType == DEVICE_TYPE_CD) ? "CD" : "HD",
267+
g_initiator_state.target_id,
268+
++image_num,
269+
(g_initiator_state.deviceType == DEVICE_TYPE_CD) ? "iso" : "hda");
270+
} while(SD.exists(filename));
271+
log("Imaging filename: ", filename, ".");
277272
g_initiator_state.target_file = SD.open(filename, O_WRONLY | O_CREAT | O_TRUNC);
278273
if (!g_initiator_state.target_file.isOpen())
279274
{

0 commit comments

Comments
 (0)