From 6d1ab2c580ad51b627856d3957202b7e92e827f2 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 10 Sep 2006 10:09:17 +0000 Subject: [PATCH] Slowed down highspeed loops waiting for drive status changes --- trunk/cdrskin/cdrskin.c | 18 +++++++++++------- trunk/libburn/drive.c | 3 ++- trunk/test/libburner.c | 6 ++++-- trunk/test/testburner.c | 6 ++++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/trunk/cdrskin/cdrskin.c b/trunk/cdrskin/cdrskin.c index 006fab75..ec2d35e6 100644 --- a/trunk/cdrskin/cdrskin.c +++ b/trunk/cdrskin/cdrskin.c @@ -2297,6 +2297,9 @@ int Cdrskin_grab_drive(struct CdrskiN *skin, int flag) ClN(fprintf(stderr, "cdrskin_debug: Cdrskin_grab_drive() on active libburn\n")); if(strlen(skin->preskin->device_adr)<=0) { + + /* >>> forget unwanted drives here ! */; + ret= Cdrskin_reinit_lib_with_adr(skin,1|(flag&2)); goto ex; /* this calls Cdrskin_grab() with persistent address or fails */ } @@ -2810,9 +2813,9 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) return(ret); drive= skin->drives[skin->driveno].drive; while(burn_drive_get_status(drive,NULL)) - sleep(2); + usleep(100002); while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY) - sleep(2); + usleep(100002); Cdrskin_report_disc_status(skin,s,0); if(s==BURN_DISC_APPENDABLE && skin->no_blank_appendable) { is_not_really_erasable= 1; @@ -2864,7 +2867,8 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) } if(strlen(skin->preskin->device_adr)>0) burn_drive_add_whitelist(skin->preskin->device_adr); - while (!burn_drive_scan(&(skin->drives), &(skin->n_drives))) ; + while(!burn_drive_scan(&(skin->drives),&(skin->n_drives))) + usleep(1002); ret= Cdrskin_grab_drive(skin,0); if(ret<=0) return(ret); @@ -2960,9 +2964,9 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) drive= skin->drives[skin->driveno].drive; while(burn_drive_get_status(drive,NULL)) - sleep(2); + usleep(100002); while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY) - sleep(2); + usleep(100002); if(skin->verbosity>=Cdrskin_verbose_progresS) Cdrskin_report_disc_status(skin,s,0); if(s!=BURN_DISC_FULL && @@ -3341,10 +3345,10 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag) drive= skin->drives[skin->driveno].drive; while (burn_drive_get_status(drive, NULL)) - sleep(2); /* >>> ??? add a timeout ? */ + usleep(100002); /* >>> ??? add a timeout ? */ while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY) - sleep(2); /* >>> ??? add a timeout ? */ + usleep(100002); /* >>> ??? add a timeout ? */ if(skin->verbosity>=Cdrskin_verbose_progresS) Cdrskin_report_disc_status(skin,s,0); diff --git a/trunk/libburn/drive.c b/trunk/libburn/drive.c index adbcef51..92f85c38 100644 --- a/trunk/libburn/drive.c +++ b/trunk/libburn/drive.c @@ -626,7 +626,8 @@ int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr, fprintf(stderr,"libburn: experimental: burn_drive_scan_and_grab(%s)\n", adr); */ - while (!burn_drive_scan(drive_infos, &n_drives)); + while (!burn_drive_scan(drive_infos, &n_drives)) + usleep(1002); if (n_drives <= 0) return 0; /* diff --git a/trunk/test/libburner.c b/trunk/test/libburner.c index 99fe8442..392ab6e3 100644 --- a/trunk/test/libburner.c +++ b/trunk/test/libburner.c @@ -162,7 +162,8 @@ int libburner_aquire_by_driveno(int *driveno) int ret, i; printf("Beginning to scan for devices ...\n"); - while (!burn_drive_scan(&drive_list, &drive_count)) ; + while (!burn_drive_scan(&drive_list, &drive_count)) + usleep(1002); if (drive_count <= 0 && *driveno >= 0) { printf("FAILED (no drives found)\n"); return 0; @@ -433,7 +434,8 @@ int libburner_payload(struct burn_drive *drive, const char *source_adr, burn_disc_write(burn_options, target_disc); burn_write_opts_free(burn_options); - while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) ; + while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) + usleep(1002); while (burn_drive_get_status(drive, &progress)) { if( progress.sectors <= 0 || progress.sector == last_sector) printf( diff --git a/trunk/test/testburner.c b/trunk/test/testburner.c index 52773d71..70930020 100644 --- a/trunk/test/testburner.c +++ b/trunk/test/testburner.c @@ -260,7 +260,8 @@ int libburner_aquire_by_driveno(int *driveno) int ret= 0, i; printf("Beginning to scan for devices ...\n"); - while (!burn_drive_scan(&drive_list, &drive_count)) ; + while (!burn_drive_scan(&drive_list, &drive_count)) + usleep(1002); if (drive_count <= 0 && *driveno >= 0) { printf("FAILED (no drives found)\n"); return 0; @@ -537,7 +538,8 @@ int libburner_payload(struct burn_drive *drive, const char *source_adr, burn_disc_write(burn_options, target_disc); burn_write_opts_free(burn_options); - while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) ; + while (burn_drive_get_status(drive, NULL) == BURN_DRIVE_SPAWNING) + usleep(1002); while (burn_drive_get_status(drive, &progress)) { if( progress.sectors <= 0 || progress.sector == last_sector) printf(