Monday 30 April 2007

Removable disk timeouts in CE

Ever wondered why it takes ages for the Windows CE filesystem to remove SDCards from the filesystem after physically removing the card?

Well its because there are two FATFS registry settings which affect this behaviour. Also these are the reason why after a resume an SDCard can take 12 seconds to become responsive again if a ReadFile operation was called when the driver was powering down for the suspend.

"PNPUnloadDelay"
Specifies the time delay in milliseconds between unmounting and detaching a device.
Used during suspend/resume cycles where a block driver might unload and reload on resume.
Default is 5000 microseconds.

"PnPWaitIoDelay"
Specifies the amount of time waited before re-trying an I/O operation on an unavailable device.
This subkey is not present in the default registry, but may be added by the OEM. If this value is not specified, it is assumed to be three times that of PNPUnloadDelay

See :

http://msdn2.microsoft.com/en-us/library/aa912238.aspx

The default is set in CE5.0 as 4 seconds to unmount the volume after device removal, this is the delay you see in explorer. And 3 x 4 seconds if any IO operation fails (i.e. if an app is reading/writing to an SDCard whilst the device is suspending/resuming)

No comments: