[8525, TyTN, MDA Vario II, JasJam Software Upgradin] Keyosuke:
A better workaround.

|Edit:Ignore everything after this edit/paragraph in this post as it is partially wrong and won't help. Seems I didn't test it well enough. Always give fixes more than a hang full of tests ;-) I'll keep working on it. In the meantime you can read this: http://blogs.msdn.com/windowsmobile/archive/2007/01/12/everything-you-want-to-know-about-sd.aspx

I was trying to find a way to stop the storage card from unmounting, though that would be against the intent of microsoft, it seems. I'm leaving this because it shows what doesn't work and I'll change it if I find something that works. Seems you can't edit the pnpunloaddelay during CE runtime or it has no effect, and you can't stop the card from unloading by the other means I haven't posted about. Buying a card that reinitializes faster might be the only solution, as well as using a rom cooked to have a super late pnpunloaddelay. Note: it's in miliseconds so the values you guys use make no sense at all. Might as well just use 5000 if you're going over what can be specified in a 3 nibbles of memory, which is 4095. If you're using 8*** might as well use 8 something rounder there as well, like 0x1FFF| Idiocy starts here:

I think I've found a workaround that should solve this problem for everyone (though solve isn't the best word because it introduces a disadvantage). I have chosen to use this workaround and the change it creates can be observed without even a soft reset.

The conditions this fixes: My storage card becomes corrupt, doesn't allow file access, disconnects, and many other strange things if the device goes into true standby/suspend mode. This can be enduced through a software function that triggers suspend, or through leaving the device alone for enough time to cause the screen to become dark, and then perhaps a little more time depending on the device. This isn't limited to Hermes and is seen in many WM6 and WM5 roms that utilize SDHC driver patches or "more recent" memory card drivers. When the device goes into suspend, all use of the card is suspended and it is shutdown until the device comes out of suspend. This confuses the driver due to how some cards initialize, causing the driver to fail. The previous registry workarounds mentioned here can help some particular cards due to the delay they introduce in the reinitialization of the card, but other cards such as my cheap brandless ones do not reinitialize regardless of the time period given to them.

The Fix:

I then recalled that my videocard had this problem under Windows XP, and the solution was simply to avoid suspend mode, but a better solution is available on Pocket PC, and that is to set the storage device manager so that it never disables the storage card upon entering suspend. This causes the card to never need reinitialization after leaving suspend mode, which guarantees the card will always be available and working. If it doesn't suspend the card, it doesn't have to "unsuspend" the card. (Scroll to the bottom for the registry setting that fixes this)

The Catches:

Leaving the card enabled means more power consumption while in suspend mode, so if you like to leave your phone in your pocket and not use it, with the card inserted, it will now lose its charge faster. Benchmark this and let us know how it effects the time, if anyone would be so kind.

This fix will probably fail for someone and cause complaining; either because that person did something incorrectly or because they have a different storage card hardware than I have (which is the reason the other fixes only work for certain folks). I hope this works for you and good luck.

How to Apply The Fix:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]

;The key below is a DWORD and not a string

"DisableOnSuspend"=0

The [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory] is the path to where the setting needs to be created and set. If you don't know how to use a registry editor to safely do this, please rely on someone else here to make a registry file. My registry editor doesn't export and I don't want to risk a syntax error so I'm not planning on doing that.

The line starting with a semicolon is simply telling you to make the setting of type DWORD, since there are multiple types available.

The final line is telling you the name of the setting and what to set it equal to. Be careful not to include the quotes in the name when you create it. The syntax I used in this post is what Microsoft uses in .reg files and on MSDN. You may also have to change the SDMemory into any of the following due to the nature of drivers and hardware on your device. I don't own a Hermes so I don't know which storage device it has or what it calls its storage in the registry. Take a look at the Profiles and try this tweak on the one that sounds the most like your storage device. If it fails to help, try it on another. All registry edits of this low level have risk, so don't blame me if it screws something up when you pick the wrong one or make a typo. A list of possible replacements of "SDMemory" is below:

CDProfile, HDProfile, MMCProfile, MMC, MSFlash, PCMCIA, SDMMC, USBCDProfile, USBFDProfile, USBHDProfile, TrueFFS_DOC, TrueFFS_DOC1, and TrueFFS_DOC2.

My devices SD slot is an SDIO slot that can accept several of the things on this list, so if you find that this solves the problem with SD cards but not MMC cards (or something like that) then try it on both. If you're having this problem then the odds are that you've flashed your rom before so this level of risk is normal for you.

To make this setting take effect immediately after entering it, initiate a suspend via the suspend button on your device (my HTC Universal has a suspend button labeled as a power button). After that, initiate a suspend using software like QuickMenu, which is a truer suspend than what my Universal does by use of the button. Right about now you are wondering how I know all of this, why I'm in the wrong location talking about the wrong phone, and why I think this works when it doesn't work for you. Well, you can call this all an educated guess, but I would rather think of it as I knowing this from being and engineer who reads a lot of microsoft webpages and likes to hack the windows registry (and who does realtime software engineering on such hardware), I'm in the wrong forum talking about the wrong phone because this issue applies to MANY phones and I'm experiencing it too, even if I'm not on identicle hardware, and this was tested by me and proved to be an excellent workaround for my specific cards and device so I am sharing it in the hopes it'll help someone else.

Thanks and Good Luck.