From 48267765b55155998f5c510f30336ac19678d6f7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 29 Mar 2020 22:07:26 +0200 Subject: [PATCH] Show at least a moving progress meter when formatting the drive. --- src/lib/copy_to_drive_job.cc | 7 +++++-- src/lib/dist_writer_messages.h | 10 +++++++++- src/tools/dcpomatic_dist_writer.cc | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/copy_to_drive_job.cc b/src/lib/copy_to_drive_job.cc index 1aeb4bfc2..828946123 100644 --- a/src/lib/copy_to_drive_job.cc +++ b/src/lib/copy_to_drive_job.cc @@ -76,9 +76,12 @@ CopyToDriveJob::run () string const m = _nanomsg.blocking_get (); string const n = _nanomsg.blocking_get (); throw CopyError (m, raw_convert(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(p)); + sub ("Copying DCP"); + set_progress (raw_convert(_nanomsg.blocking_get())); } } } diff --git a/src/lib/dist_writer_messages.h b/src/lib/dist_writer_messages.h index fedbc8b35..d0a541ddd 100644 --- a/src/lib/dist_writer_messages.h +++ b/src/lib/dist_writer_messages.h @@ -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 diff --git a/src/tools/dcpomatic_dist_writer.cc b/src/tools/dcpomatic_dist_writer.cc index b81c42418..f7ed50345 100644 --- a/src/tools/dcpomatic_dist_writer.cc +++ b/src/tools/dcpomatic_dist_writer.cc @@ -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); -- 2.30.2