diff --git a/tools/hitag2crack/crack5opencl/hitag2.c b/tools/hitag2crack/crack5opencl/hitag2.c index 181f029ac..3ff851a9f 100644 --- a/tools/hitag2crack/crack5opencl/hitag2.c +++ b/tools/hitag2crack/crack5opencl/hitag2.c @@ -1,3 +1,4 @@ +#include #include "ht2crack5opencl.h" #include "hitag2.h" diff --git a/tools/hitag2crack/crack5opencl/ht2crack5opencl.c b/tools/hitag2crack/crack5opencl/ht2crack5opencl.c index 7d2f9eba7..ad93f1a4b 100644 --- a/tools/hitag2crack/crack5opencl/ht2crack5opencl.c +++ b/tools/hitag2crack/crack5opencl/ht2crack5opencl.c @@ -1011,7 +1011,7 @@ int main(int argc, char **argv) { // at this point z is the max value, still usefulfor free's #if DEBUGME > 0 - printf("[debug] Lower profile between %u device(s) is: %d\n", selected_devices_cnt, profile); + printf("[debug] Lower profile between %zu device(s) is: %d\n", selected_devices_cnt, profile); #endif uint32_t max_step = profiles[profile][0]; @@ -1102,9 +1102,9 @@ int main(int argc, char **argv) { if (ctx.thread_sched_type == THREAD_TYPE_ASYNC) { size_t th_status_err = 0; for (z = 0; z < thread_count; z++) { - pthread_mutex_lock(&thread_mutexs[z]); + pthread_mutex_lock(&th_ctx.thread_mutexs[z]); thread_status_t tmp = t_arg[z].status; - pthread_mutex_unlock(&thread_mutexs[z]); + pthread_mutex_unlock(&th_ctx.thread_mutexs[z]); if (tmp != TH_START) { printf("! Warning: Thread %zu is not in TH_START, found in %s\n", z, thread_status_strdesc(tmp)); diff --git a/tools/hitag2crack/crack5opencl/opencl.c b/tools/hitag2crack/crack5opencl/opencl.c index 79b7b1e92..04daa8b90 100644 --- a/tools/hitag2crack/crack5opencl/opencl.c +++ b/tools/hitag2crack/crack5opencl/opencl.c @@ -54,7 +54,7 @@ unsigned int get_smallest_profile(compute_platform_ctx_t *cd_ctx, size_t ocl_pla if (!cd_ctx[x].device[y].selected) continue; #if DEBUGME > 1 - printf("[debug] Initial profile for device %zu: %d\n", z, cd_ctx[x].device[y].profile); + printf("[debug] Initial profile for device %zu: %d\n", y, cd_ctx[x].device[y].profile); #endif // with same devices will be selected the best diff --git a/tools/hitag2crack/crack5opencl/threads.c b/tools/hitag2crack/crack5opencl/threads.c index 50c4c7762..2bd024223 100644 --- a/tools/hitag2crack/crack5opencl/threads.c +++ b/tools/hitag2crack/crack5opencl/threads.c @@ -510,17 +510,17 @@ void *computing_process(void *arg) { a->slice = wu.id + 1; if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) { - float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max); #if DEBUGME > 0 - printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); + printf("[%zu] Slice %5zu (off %6zu), max %5zu, remain %5zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); #else - printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); + float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max); + printf("\r[%zu] Slice %5zu/%5zu (%5zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); #endif // DEBUGME } else { - float progress = (((wu.id + 1) * 100.0) / wu.max); #if DEBUGME > 0 printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off); #else + float progress = (((wu.id + 1) * 100.0) / wu.max); printf("\r[%zu] Slice %zu/%zu ( %2.1f%% )", z, wu.id + 1, wu.max, progress); #endif // DEBUGME } @@ -588,7 +588,7 @@ void *computing_process_async(void *arg) { if (status == TH_START) { #if TDEBUG >= 1 - printf("[%s][%zu] plat id %d, uid %u, aR2 %u, nR1 %u, nR2 %u, Initial status: %s\n", __func__, z, ctx->id_platform, uid, aR2, nR1, nR2, thread_status_strdesc(status)); + printf("[%s][%zu] uid %u, aR2 %u, nR1 %u, nR2 %u, Initial status: %s\n", __func__, z, uid, aR2, nR1, nR2, thread_status_strdesc(status)); #endif status = TH_WAIT; // proceed to next @@ -665,17 +665,17 @@ void *computing_process_async(void *arg) { a->slice = wu.id + 1; if (ctx->queue_ctx.queue_type == QUEUE_TYPE_RANDOM) { - float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max); #if DEBUGME > 0 - printf("[%zu] Slice %zu (off %zu), max %zu, remain %zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); + printf("[%zu] Slice %5zu (off %6zu), max %5zu, remain %5zu slice(s)\n", z, wu.id + 1, wu.off, wu.max, wu.rem); #else - printf("\r[%zu] Slice %zu/%zu (%zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); + float progress = 100.0 - (((wu.rem + 1) * 100.0) / wu.max); + printf("\r[%zu] Slice %5zu/%5zu (%5zu remain) ( %2.1f%% )", z, wu.id + 1, wu.max, wu.rem, progress); #endif // DEBUGME } else { - float progress = (((wu.id + 1) * 100.0) / wu.max); #if DEBUGME > 0 printf("[%zu] Slice %zu/%zu, off %zu\n", z, wu.id + 1, wu.max, wu.off); #else + float progress = (((wu.id + 1) * 100.0) / wu.max); printf("\r[%zu] Slice %zu/%zu ( %2.1f%% )", z, wu.id + 1, wu.max, progress); #endif // DEBUGME } @@ -772,7 +772,11 @@ void *computing_process_async(void *arg) { a->quit = true; pthread_mutex_unlock(&a->thread_ctx->thread_mutexs[z]); #if TDEBUG >= 1 +#ifdef _ISOC99_SOURCE + printf("[%s][%zu] master, I found the key ! state %U64x, slice %zu\n", __func__, z, a->s, a->slice + 1); +#else printf("[%s][%zu] master, I found the key ! state %" STR(OFF_FORMAT_U) ", slice %zu\n", __func__, z, a->s, a->slice + 1); +#endif fflush(stdout); #endif