Attached is a patch which provides better status while a reset is in
progress. Otherwise, the user doesn't know what is happening until either
the reset succeeds or the max timeout occurs (currently 50 seconds).commit af3f4a4402c7c0545e9608dd94a9eddedeab2d1d
Author: Scott Talbert <s...@techie.net>
Date: Sun Jun 9 20:41:16 2013 -0400
Provide better status while resetting.
Signed-off-by: Scott Talbert <s...@techie.net>
diff --git a/libconcord/libconcord.cpp b/libconcord/libconcord.cpp
index 1959ea3..a4c0c97 100644
--- a/libconcord/libconcord.cpp
+++ b/libconcord/libconcord.cpp
@@ -795,18 +795,21 @@ int get_identity(lc_callback cb, void *cb_arg)
int reset_remote(lc_callback cb, void *cb_arg)
{
int err;
- if (cb)
- cb(LC_CB_STAGE_RESET, 0, 0, 2, LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
+ int secs = 0;
+ const int max_secs = MAX_WAIT_FOR_BOOT * WAIT_FOR_BOOT_SLEEP;
if ((err = rmt->Reset(COMMAND_RESET_DEVICE)))
return err;
- if (cb)
- cb(LC_CB_STAGE_RESET, 1, 1, 2, LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
-
deinit_concord();
for (int i = 0; i < MAX_WAIT_FOR_BOOT; i++) {
- sleep(WAIT_FOR_BOOT_SLEEP);
+ for (int j = 0; j < WAIT_FOR_BOOT_SLEEP; j++) {
+ if (cb)
+ cb(LC_CB_STAGE_RESET, secs, secs, max_secs,
+ LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
+ sleep(1);
+ secs++;
+ }
err = init_concord();
if (err == 0) {
err = _get_identity(NULL, NULL, 0);
@@ -829,7 +832,8 @@ int reset_remote(lc_callback cb, void *cb_arg)
return err;
if (cb)
- cb(LC_CB_STAGE_RESET, 2, 2, 2, LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
+ cb(LC_CB_STAGE_RESET, max_secs, max_secs, max_secs,
+ LC_CB_COUNTER_TYPE_STEPS, cb_arg, NULL);
return 0;
}
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel