summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ddhardrescue.c3
-rw-r--r--src/recover.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/src/ddhardrescue.c b/src/ddhardrescue.c
index 691bf09..e10d323 100644
--- a/src/ddhardrescue.c
+++ b/src/ddhardrescue.c
@@ -140,11 +140,12 @@ void cursesUpdateSliceDump(slices_evt_t *slicesEvt, slice_t *modifiedSlice) {
// static int progress=0;
char *toPrint;
address_t blockSize=0;
+ unsigned int charCount=(getmaxx(winUpdateSliceDump)-getbegx(winUpdateSliceDump))*(getmaxy(winUpdateSliceDump)-getbegy(winUpdateSliceDump)+2);
//FIXME : do that realy
pthread_mutex_lock(&ncursesWriteMutex);
- toPrint=slicesDump(slicesEvt->data, &blockSize, 1000, slicesEvt->data->min, slicesEvt->data->max);
+ toPrint=slicesDump(slicesEvt->data, &blockSize, charCount, slicesEvt->data->min, slicesEvt->data->max);
if (toPrint != NULL) {
attron(COLOR_PAIR(4));
mvwprintw(winUpdateSliceDump, 1, 0, toPrint);
diff --git a/src/recover.c b/src/recover.c
index 8d47853..e6e574a 100644
--- a/src/recover.c
+++ b/src/recover.c
@@ -2,6 +2,9 @@
#include <stdio.h>
#include "recover.h"
+// Just for sleep
+#include <unistd.h>
+
void recover(slices_evt_t *slicesEvt, char *src, char *dst, char *ddOpts) {
slice_t *sliceToRead;
address_t firstError=0, median, foundMax=0;
@@ -105,7 +108,8 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src,
*/
// Simulate for each read a pseudo random error position and generate some cases of full read without error
- address_t error=sliceToRead->begin + rand()%count;
+ //address_t error=sliceToRead->begin + rand()%(count);
+ address_t error=sliceToRead->begin + rand()%(count/3);
if ( error % 42 == 0 ) {
res=0;
} else {
@@ -113,6 +117,7 @@ int tryRecoverUntilError(slice_t *sliceToRead, address_t *firstError, char *src,
*firstError=error;
}
+ usleep(10000);
return res;
}