-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hello @lighterowl :), as the title says, I found this minor problem while testing my Plextor drive. Option -r works incorrectly with option -i but works correctly without it, just like the following logs.
without -i
E:\Install pack\Optical_Drive>cachex.exe -d -s 0 -l 5 -r D8h -c -n 10 L
CacheExplorer 0.13 - https://github.com/xavery/cachex, based on
CacheExplorer 0.9 - spath@cdfreaks.com
Drive on L is PLEXTOR CD-R PREMIUM 1.06
[+] Changing read speed to max
info: spinning the drive...
[+] Testing cache line size:
info: using command D8h
info: 10 test(s), c/nc ratio: 4, burst: 1, max: 1000
1171 kB / 510 sectors (41.42 .. 1.48 -> 2.13)
1171 kB / 510 sectors (52.92 .. 2.10 -> 1.50)
1171 kB / 510 sectors (47.13 .. 2.11 -> 1.50)
1171 kB / 510 sectors (47.19 .. 2.12 -> 1.48)
1171 kB / 510 sectors (47.07 .. 2.17 -> 2.12)
1171 kB / 510 sectors (47.02 .. 2.11 -> 1.51)
1171 kB / 510 sectors (47.04 .. 2.10 -> 1.48)
1171 kB / 510 sectors (47.05 .. 2.13 -> 2.15)
1171 kB / 510 sectors (41.41 .. 2.11 -> 1.49)
1171 kB / 510 sectors (47.11 .. 1.47 -> 2.15)
with -i
E:\Install pack\Optical_Drive>cachex.exe -i -d -s 0 -l 5 -r D8h -c L
CacheExplorer 0.13 - https://github.com/xavery/cachex, based on
CacheExplorer 0.9 - spath@cdfreaks.com
Drive on L is PLEXTOR CD-R PREMIUM 1.06
[+] Buffer size: 8192 kB, read cache is enabled
[+] Supported cache flush commands: A8h 28h 28h_12
[+] Supported read commands: BEh D8h
[+] Changing read speed to max
info: spinning the drive...
[+] Testing cache line size:
info: using command BEh
info: 10 test(s), c/nc ratio: 4, burst: 1, max: 1000
1171 kB / 510 sectors (47.11 .. 2.13 -> 2.17)
1171 kB / 510 sectors (47.13 .. 1.55 -> 2.14)
1171 kB / 510 sectors (47.05 .. 2.04 -> 2.18)
1171 kB / 510 sectors (41.54 .. 2.09 -> 2.18)
1171 kB / 510 sectors (41.36 .. 2.16 -> 1.58)
1171 kB / 510 sectors (52.89 .. 2.13 -> 2.21)
1171 kB / 510 sectors (47.03 .. 2.10 -> 2.17)
1171 kB / 510 sectors (41.49 .. 2.09 -> 2.19)
1171 kB / 510 sectors (41.43 .. 2.07 -> 2.22)
1171 kB / 510 sectors (47.03 .. 2.09 -> 2.37)
Then I checked source code and found that function sReadCommand &GetSupportedCommand() used by int TestPlextorFUACommandWorksWrapper(long int, int) and function int TestCacheLineSizeWrapper(long int, int, int, short) only uses the first supported sReadCommand (that's mean, sReadCommand.Supported == true) in std::array<sReadCommand, 7> Commands.
option -i has checked the supportability of these commands before option -r works. And in my case, the first supported sReadCommand is “BEh”.
Solution:
So my solution is to reset supportability of these commands before setting the chosen one: insert for (auto &&cmd : Commands) cmd.Supported = false; to Line1593 in cachex.cpp.
Lines 1591 to 1599 in 1a8042f
| if (chosen_cmd->pFunc(10000, 1, false)) | |
| { | |
| chosen_cmd->Supported = true; | |
| } | |
| else | |
| { | |
| std::cerr << "\nError: command " << UserReadCommand << " not supported\n"; | |
| exit(-1); | |
| } |
Just like this:
if (chosen_cmd->pFunc(10000, 1, false))
{
for (auto &&cmd : Commands) cmd.Supported = false;
chosen_cmd->Supported = true;
}
else
{
std::cerr << "\nError: command " << UserReadCommand << " not supported\n";
exit(-1);
}Now it seems works expectantly on my PC :)
D:\Document\source\repos\cachex\x64\Debug>cachex.exe -s 0 -i -d -r D8h -c -n 5 L
CacheExplorer 0.13 - https://github.com/xavery/cachex, based on
CacheExplorer 0.9 - spath@cdfreaks.com
Drive on L is PLEXTOR CD-R PREMIUM 1.06
[+] Buffer size: 8192 kB, read cache is enabled
[+] Supported cache flush commands: A8h 28h 28h_12
[+] Supported read commands: BEh D8h
[+] Changing read speed to max
[+] Testing cache line size:
info: using command D8h
info: 5 test(s), c/nc ratio: 4, burst: 1, max: 1000
1171 kB / 510 sectors (57.95 .. 1.47 -> 1.72)
1171 kB / 510 sectors (43.91 .. 1.94 -> 1.59)
1171 kB / 510 sectors (50.94 .. 1.53 -> 2.04)
1171 kB / 510 sectors (50.95 .. 1.58 -> 1.81)
1171 kB / 510 sectors (43.93 .. 1.74 -> 2.06)