Show at least a moving progress meter when formatting the drive.
authorCarl Hetherington <cth@carlh.net>
Sun, 29 Mar 2020 20:07:26 +0000 (22:07 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 29 Mar 2020 20:07:26 +0000 (22:07 +0200)
src/lib/copy_to_drive_job.cc
src/lib/dist_writer_messages.h
src/tools/dcpomatic_dist_writer.cc

index 1aeb4bfc27e6a8e871851779f81834b4b9d805c0..828946123b6f9ce52a52e9c2f89d8c6f421c1d97 100644 (file)
@@ -76,9 +76,12 @@ CopyToDriveJob::run ()
                        string const m = _nanomsg.blocking_get ();
                        string const n = _nanomsg.blocking_get ();
                        throw CopyError (m, raw_convert<int>(n));
+               } else if (s == DIST_WRITER_FORMATTING) {
+                       sub ("Formatting drive");
+                       set_progress_unknown ();
                } else if (s == DIST_WRITER_PROGRESS) {
-                       string p = _nanomsg.blocking_get();
-                       set_progress (raw_convert<float>(p));
+                       sub ("Copying DCP");
+                       set_progress (raw_convert<float>(_nanomsg.blocking_get()));
                }
        }
 }
index fedbc8b353604122264464b9650d51aa68557162..d0a541dddbbdfe2259f733967e2af6194242b9df 100644 (file)
@@ -47,7 +47,15 @@ Disc full\n
 */
 #define DIST_WRITER_ERROR "E"
 
-/** Some progress has been made.  Following this will come
+/** The disk writer is formatting the drive.  It is not possible
+ *  to give progress reports on this so the writer just tells us
+ *  it's happening.  This is finished when DIST_WRITER_PROGRESS
+ *  messages start arriving
+ */
+#define DIST_WRITER_FORMATTING "F"
+
+/** Some progress has been made in the main "copy" part of the task.
+ *  Following this will come
 
 progress as a float from 0 to 1\n
 
index b81c42418f2a744b999b7341befb571a5e5125e4..f7ed50345a7bff589fa35a04e6efaffadfe6c196 100644 (file)
@@ -307,6 +307,8 @@ try
        }
        LOG_DIST_NC ("Opened partition");
 
+       nanomsg->blocking_send(DIST_WRITER_FORMATTING "\n");
+
        r = ext4_mkfs(&fs, bd, &info, F_SET_EXT4);
        if (r != EOK) {
                throw CopyError ("Failed to make filesystem", r);