From 4dffa2530b6aedc5ac4910d3dead3930b4293c12 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 14 Aug 2011 20:55:21 +0000 Subject: Ajout d'un usleep dans tryToRecover... histoire d'arriver à voir que le graphique évolue. Bon, prochaine étape, la gestion du resizing de fenetre ? Ya la gestion du zoom à faire aussi. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@19 d3078510-dda0-49f1-841c-895ef4b7ec81 --- src/ddhardrescue.c | 3 ++- src/recover.c | 7 ++++++- 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 #include "recover.h" +// Just for sleep +#include + 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; } -- cgit v1.2.3