<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Am 21.11.19 um 13:52 schrieb Brian:
<br>
<blockquote type="cite" style="color: #000000;">On 11/21/19 7:12 AM,
<a class="moz-txt-link-abbreviated"
href="mailto:wkitty42@windstream.net">wkitty42@windstream.net</a>
wrote:
<br>
<blockquote type="cite" style="color: #000000;">On 11/21/19 1:16
AM, Brian wrote:
<br>
<blockquote type="cite" style="color: #000000;">My question: Is
there a standard method for handling this situation,
<br>
i.e. making sure that a drive has not spun down, or is it just
a case
<br>
of writing a wrapper round the write function and handling the
'No
<br>
such file' error with a wait and a retry?
<br>
</blockquote>
<br>
why not just turn off or adjust your power management so that
drive
<br>
doesn't spin down when it is connected? i do similar here but
for my
<br>
monitors which sometimes don't want to wake back up after being
put to
<br>
sleep...
<br>
<br>
</blockquote>
Because on the <b class="moz-txt-star"><span class="moz-txt-tag">*</span>overwhelming<span
class="moz-txt-tag">*</span></b> majority of occasions, I'm
happy for the
<br>
drives to sleep if not being accessed. Most things that I do don't
<br>
need the USB drives. Bo's idea of a program which kept the drives
spun
<br>
up had occurred to me if I couldn't find a setting somewhere, but
I
<br>
was hoping for a solution which didn't require me to either
disable
<br>
the drive's power management or do constant accesses.
<br>
<br>
Brian.
<br>
</blockquote>
<br>
<br>
The old trick from DOS times with fileExists does not work anymore
because the directory is cached.
<br>
<br>
What I do with "sleeping" USB disks is this:
<br>
<br>
{$I-}
<br>
repeat
<br>
application.processmessages;
<br>
assignFile(txt,'/mnt/test.txt');
<br>
rewrite (txt);
<br>
writeln (txt,'I''m so tired ...');
<br>
closeFile(txt);
<br>
io := ioResult;
<br>
// showMessage ('--> '+IntToStr(io));
<br>
until io=0;
<br>
{$I+}
<br>
<br>
<br>
If your disk is not corrupt or full then after this loop the drive
is ready.
<br>
<br>
Tested with USB drives from Seagate and Toshiba.
<br>
<br>
This only tested with Linux!
<br>
<br>
Winni
<br>
<br>
</body>
</html>