Add option to disable HDD power saving - #61
Conversation
Some USB hard disks enter aggressive power-saving states while a game is idle. Their multi-second wake latency can exceed the Wii USB stack timeout and leave games frozen or on a black screen at the next load transition. Add an opt-in setting under Hard Drive Settings. During the next IOS58 startup, probe the mounted USB disk with ATA CHECK POWER MODE. If the bridge supports SAT pass-through, independently disable ATA Advanced Power Management and the ATA standby timer before USB Loader GX reloads into cIOS. Keep the option off by default. Target only the disk already mounted by the loader, report full, partial, unsupported, and transport-error outcomes, and never write sectors, partitions, bridge EEPROM, or firmware. The ATA settings are volatile and reset when the HDD loses power. This is intended for rotating SATA HDDs behind compatible USB-to-SATA bridges. Disabling power saving may keep a mechanical disk spinning continuously, increasing power use, temperature, noise, and accumulated running time. Tested after a full Wii and HDD cold boot with: - Maxone USB 3.0 1 TB enclosure - JMicron JMS578 bridge (152d:0578, firmware 0215) - HGST HTS541010A9E680 1 TB 5400 RPM HDD (firmware JA0OA560) The drive restores ATA APM level 1 after power loss. With this setting enabled, previously reproducible idle/load freezes did not recur in The Legend of Zelda: Twilight Princess or Guitar Hero III. A similar Maxone 2.5-inch Wii drive freeze at load transitions was reported here: https://www.reddit.com/r/WiiHacking/comments/1rj17al/game_freezes_at_transition_help/
|
Could you run FwUpdateTool to create a backup of your firmware and then upload it? You should just need to click on If the firmware is similar enough to my own, I should be able to try it on my enclosure. If I can then replicate the issue, I might know of a more universal fix that would work for a wider range of devices, including ones that don't allow APM to be disabled or have their APM setting reset by their firmware after 5 to 10 minutes. |
|
Hello @wiidev ! Thanks for reviewing. Yes, I have a pristine firmware backup made with RD Version and Backup Old Firmware Only. I made two reads before modifying anything and verified that their SHA-256 hashes matched. One clarification that may help your investigation: on this enclosure I tested the bridge standby setting separately from the drive’s ATA power management. Setting the JMS578 standby timer to zero produced a verified NVRAM change at offset 0xC4F2 (0x28 → 0x20), but the approximately 2.7-second wake delay after roughly 45 seconds idle remained. The internal drive is an HGST HTS541010A9E680. After a full power cycle it reported ATA APM level 1. Disabling ATA APM and the ATA standby timer reduced a comparable Windows raw-read test from approximately 2.25 seconds to 0.06 seconds. After power loss, APM returned to level 1 and the delay returned. The USB Loader GX change fixes this unit by reapplying those volatile ATA commands during startup. So the reproduced issue on this particular enclosure appears to be drive-side APM rather than the JMS578’s own standby timer. I agree that comparing the bridge firmware could still be useful for a more universal solution, especially for drives or bridges that reject APM changes or restore them after several minutes. The backup is 50,688 bytes and contains the Maxone USB identity strings and unique enclosure serial number. |
|
I tried to replicate the issue by flashing the firmware onto my enclosure, which changed it from
The problem I have with this approach is that I already know it won't help every drive, since some don't allow APM to be disabled, while others will reset the setting after a few minutes. Plus, it then becomes another debugging step that forums and Discord servers need to parrot to users. Historically, some of the JMS578 firmware versions have been really buggy, which is why threads like this one on GBAtemp exist. The d2x cIOS already reads a random sector every 10 seconds to keep drives awake. Could it be that your enclosure needs the interval to be shorter than that? You could test this yourself by forking the repo and editing this line to something like Just so you're aware, I'm currently working on the next major loader and d2x cIOS updates, and I don't push any of my changes to GitHub until I'm ready to share a new release. So, if adjusting the interval for reading a random sector helps avoid freezes, just let me know and I'll adjust it in my local copy. If adjusting the interval doesn't help, then I might consider adding the optional ability to disable APM and the standby timer directly to the cIOS, since then it would work from any loading IOS, and, if necessary, I could even have it check and resend the ATA commands while you're playing a game. |
|
Hi @wiidev, thanks for the suggestion. I tested the shorter watchdog interval, but unfortunately it did not prevent the freeze. My existing installation was already current:
I built d2x-v11-beta3 from commit 33ad1ee with only this change: I installed it separately as IOS252[56], revision 21999, named d2x-v999-watchdog5s, and explicitly selected IOS252 for the second test. The other cIOS modules were the official v11-beta3 binaries, I only replaced EHCI.app for the custom build. For both tests:
Test procedure:
With both IOS249’s 10-second watchdog and IOS252’s 5-second watchdog, the game black-screened at that point. The HDD activity LED continued flashing throughout the idle period, so periodic USB activity was still occurring. As a positive control, enabling my USB Loader GX’s Disable HDD power saving feature prevents this freeze. Twilight Princess and Guitar Hero III both survive their previously reproducible idle/loading failures with that option enabled. So reducing the random-sector interval from ten to five seconds does not address my unit. Given that the bridge firmware alone did not reproduce the problem in your enclosure I believe this is dependent on the internal HGST drive’s APM behaviour. Your proposal regarding a cIOS-level ATA commands with periodic reapplication now seems like the more promising direction to me. I would be happy to test or contribute that implementation.
|
|
Good news. I can now reproduce the issue. I happened to have an old 2.5" HGST drive, so I connected it to a PC via SATA and used FTool (FT216M2 for my drive) to change the APM value from 128 to 1. Then I followed these steps:
You might be able to do the opposite to permanently fix your drive too. I'll see if I can come up with another solution, or at least make disabling APM a seamless process for users. |
|
That's cool! thank you for taking the time to reproduce it with another HGST drive. I did investigate changing the drive itself before implementing the USB Loader GX workaround. Through the JMS578 bridge, the standard ATA APM command works, but only for the current power session: After completely removing power and reconnecting the enclosure, it returns to APM level 1. I also changed the JMS578’s persistent EEPROM standby setting to zero and verified the resulting firmware backup. That did not eliminate the wake delay or the Wii freezes, that's how I confirmed that the bridge’s standby timer and the internal HGST drive’s APM default are separate settings. FTool may provide a permanent fix for this particular disk, but your procedure used a model-appropriate FTool build and a native SATA connection. My drive is in the Maxone enclosure with only an USB access available. I have not found a verified FTool version or a supported procedure for changing its persistent APM default through that bridge. Doing so would require opening the enclosure, connecting the drive directly to SATA and modifying its persistent drive configuration - I don't have the hardware to do that right now. In any case, it could be a useful personal hardware-level solution if I can identify and validate the exact tool but it would remain model-specific and, in my opinion, more invasive than a reversible software workaround. It also would not help users with sealed enclosures, no native SATA access (like myself) or drives whose persistent settings cannot be modified safely. I agree that making this seamless (at the cIOS layer) would be a better general solution than requiring users to diagnose and modify individual drives. I’m happy to test any implementation you develop. I'd also be happy to rework it around whichever architecture you consider appropriate if you're open to outlining the interface or behaviour you want and letting me prepare the patch for review, if you prefer. |
|
Can you confirm that this version fixes the issue for you? It's based on the current enhanced branch and only requires this one file to be modified. This should be an improvement, since it doesn't require users to adjust any settings and keeps APM enabled, which should result in lower power consumption compared to disabling APM entirely. I've already ported it to the cIOS, since it does fix things for my drive. |


Problem
Some USB hard disks enter aggressive power-saving states while a game is
idle. Their multi-second wake latency can exceed the Wii USB stack timeout
and leave a game frozen or on a black screen at its next load transition.
A similar failure was reported by another user with a Maxone 2.5-inch Wii
drive: Game freezes at transition help.
Change
Add an opt-in Disable HDD Power Saving option under Global Settings →
Hard Drive Settings. On the next launch, while the mounted USB disk is still
available through IOS58, the loader:
CHECK POWER MODEcommand to test SATpass-through support.
continuing normal startup and reloading into cIOS.
The setting defaults to OFF. It targets only the disk already selected and
mounted by USB Loader GX. It does not write sectors, partitions, bridge
EEPROM, or firmware. The ATA settings are volatile and reset when the HDD
loses power.
Disabling power saving may keep a mechanical disk spinning continuously,
increasing power consumption, temperature, noise, and accumulated running
time. The option should therefore be enabled only when needed.
Implementation notes
menu patterns.
reloads into cIOS. At that point the selected disk is still mounted through
the IOS58/libogc backend, which exposes the raw SCSI command path needed for
SAT. This is why enabling the option takes effect on the next launch.
VID/PID allowlist, so the implementation is not tied to the tested Maxone
enclosure, and the helper does not enumerate or open another USB device.
__send_cbw()previouslyadvertised every CDB longer than six bytes as ten bytes; it now preserves
the supplied length. Existing six- and ten-byte commands retain their
previous advertised lengths.
Tested hardware
152d:0578, firmware0215)JA0OA560The tested HDD restores ATA APM level 1 after power loss. Before disabling
power saving, an uncached read after 45 seconds idle took approximately 2.25
seconds. The same Windows test took approximately 0.06 seconds after disabling
APM and the ATA standby timer.
After a full Wii and HDD cold boot, the integrated setting successfully
prevented the previously reproducible idle/load freezes in:
Hardware coverage is currently limited to the bridge and HDD listed above;
other SAT bridge and drive combinations have not been physically tested.
Verification checklist
file
increased power use, temperature, noise, and running time
Screenshots
Build verification
Built successfully using the same toolchain and command as the repository
workflow: