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

Reformatted Logging #262

Merged
merged 6 commits into from
Feb 17, 2024
Merged

Reformatted Logging #262

merged 6 commits into from
Feb 17, 2024

Conversation

dotsam
Copy link

@dotsam dotsam commented Feb 15, 2024

This PR is mainly focused on cleaner/more informative logging, keeping information grouped with the section/file it belongs with.

The PR also endeavours to make better use of constants and macros, and use a consistent convention around char array lengths. There's also some light whitespace cleanup and fixing of a few typos.

The largest functional change in the PR is the change from finalizeFileLog to finalizeDevices. This function now contains the call to readSCSIDeviceConfig in the case that two files are defined with the same ID, so that it is only called once, and the function now also outputs the filename that is being served for the ID to make absolutely clear on what IDs the drive image should be appearing.

This PR doesn't make any changes to anything that runs in the loop, so hopefully there will not be any performance impacts, although some of the discussion in #118 leads me to worry that even changes outside the loop could have performance impacts.

(I also see that PR #261 just came in, I'm happy to rebase if that PR is merged)

Here's an example of the new log output, including the case where two files with the same ID are seen, to show that the "devices table" indicates that the last ID detected is the one used:

BlueSCSI https://github.com/erichelgeson/BlueSCSI
VER: 1.1-20231117-SNAPSHOT-USB DEBUG: 0
SD Card Info:
 SPI Speed: 50MHz
 Format: FAT32/16/12 - exFAT may improve performance
 Max Filename Length: 64
 MID: 1B OID: SM
 Name: GC1S5 Date: 9/2021
 Serial: 3782502390
Looking for images in: /
 HD10_512 200MB.hda
 Parsed: HDD ID 1 LUN 0 Blocksize 512k
 WARNING: Fragmented, see https://github.com/erichelgeson/BlueSCSI/wiki/Image-File-Fragmentation
 File size: 209780736 bytes, 204864KiB, 200MiB

 HD10_512 200MB Duplicate.hda
 Parsed: HDD ID 1 LUN 0 Blocksize 512k
 WARNING: Fragmented, see https://github.com/erichelgeson/BlueSCSI/wiki/Image-File-Fragmentation
 File size: 209780736 bytes, 204864KiB, 200MiB

SCSI Devices
ID	LUN	Name
0	0	-
1	0	HD10_512 200MB Duplicate.hda
		INI Overrides: Forced HDD / Vendor: SEAGATE / Product: ST225N / Revision: 9
2	0	-
3	0	-
4	0	-
5	0	-
6	0	-
Finished configuration - Starting BlueSCSI

@erichelgeson
Copy link
Owner

Thanks for this, and offering to rebase. Please rebase and I'll merge!

@dotsam
Copy link
Author

dotsam commented Feb 17, 2024

Rebased, should be good to go. Tried my best to not increase firmware size too much, this looks to add about 92 bytes to the USB firmware.

@erichelgeson erichelgeson merged commit 2baa015 into erichelgeson:main Feb 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants