Hi,

What do people think about this?
--- Begin Message ---
I have an old system (eMachine 433MH) with a new external USB drive
(which is actually faster than the internal hard drive that came with
the box).  It takes a few seconds for the Linux to bring it online, due
in some part I think to a 5 second delay in kernel driver usb-storage
(specifically usb.c).  This console message gives a clue as to what is
happening:

usb-storage: waiting for device to settle before scanning
  
Once I installed uswsusp I noticed the boot process stopping because the
'stat' call only happens once (and fails), but almost immediately
afterward the drive would come online.

I worked up a patch that issues the stat call, sleeps for half a second
then checks again.  If it's successful it breaks out of the loop.  I set
the loop counter to 60 for a 30 second timeout.  It takes about 5 to 10
seconds for the drive to come online on my system but again, my system
is slow, mileage may vary.  Here's the patch:

--- resume.c.dpkg       2007-06-10 22:49:25.000000000 -0400
+++ resume.c    2007-06-11 23:02:33.000000000 -0400
@@ -731,6 +731,9 @@
        struct stat stat_buf;
        int dev;
        int n, error = 0;
+       // Grace period variables
+       int loopcnt;
+       unsigned int usecs = 500000;            // half a second

        page_size = getpagesize();
        buffer_size = BUFFER_PAGES * page_size;
@@ -755,6 +758,18 @@
        if (splash_param != 'y' && splash_param != 'Y')
                splash_param = 0;

+       /*
+        *  30 second grace period to allow resume device
+        *  to come online (i.e. external USB drives)
+       */
+       for (loopcnt = 1; loopcnt <= 60; loopcnt++)
+       {
+           if (stat(resume_dev_name, &stat_buf) != 0)
+               usleep(usecs);                          // wait a half
second
+           else
+               break;
+       }
+
        while (stat(resume_dev_name, &stat_buf)) {
                fprintf(stderr,
                        "resume: Could not stat the resume device
file.\n"

  



--- End Message ---

Attachment: signature.asc
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to