[fpc-pascal] Writing to a drive which may be spun down
winni at bartnick.info
Thu Nov 21 20:38:17 CET 2019
Am 21.11.19 um 13:52 schrieb Brian:
> On 11/21/19 7:12 AM, wkitty42 at windstream.net wrote:
>> On 11/21/19 1:16 AM, Brian wrote:
>>> My question: Is there a standard method for handling this situation,
>>> i.e. making sure that a drive has not spun down, or is it just a case
>>> of writing a wrapper round the write function and handling the 'No
>>> such file' error with a wait and a retry?
>> why not just turn off or adjust your power management so that drive
>> doesn't spin down when it is connected? i do similar here but for my
>> monitors which sometimes don't want to wake back up after being put to
> Because on the *overwhelming* majority of occasions, I'm happy for the
> drives to sleep if not being accessed. Most things that I do don't
> need the USB drives. Bo's idea of a program which kept the drives spun
> up had occurred to me if I couldn't find a setting somewhere, but I
> was hoping for a solution which didn't require me to either disable
> the drive's power management or do constant accesses.
The old trick from DOS times with fileExists does not work anymore
because the directory is cached.
What I do with "sleeping" USB disks is this:
writeln (txt,'I''m so tired ...');
io := ioResult;
// showMessage ('--> '+IntToStr(io));
If your disk is not corrupt or full then after this loop the drive is
Tested with USB drives from Seagate and Toshiba.
This only tested with Linux!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal