Slowed down highspeed loops waiting for drive status changes

This commit is contained in:
Thomas Schmitt 2006-09-10 10:09:17 +00:00
parent 244724d205
commit 59f0c4caa3
4 changed files with 21 additions and 12 deletions

View File

@ -2297,6 +2297,9 @@ int Cdrskin_grab_drive(struct CdrskiN *skin, int flag)
ClN(fprintf(stderr, ClN(fprintf(stderr,
"cdrskin_debug: Cdrskin_grab_drive() on active libburn\n")); "cdrskin_debug: Cdrskin_grab_drive() on active libburn\n"));
if(strlen(skin->preskin->device_adr)<=0) { if(strlen(skin->preskin->device_adr)<=0) {
/* >>> forget unwanted drives here ! */;
ret= Cdrskin_reinit_lib_with_adr(skin,1|(flag&2)); ret= Cdrskin_reinit_lib_with_adr(skin,1|(flag&2));
goto ex; /* this calls Cdrskin_grab() with persistent address or fails */ 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); return(ret);
drive= skin->drives[skin->driveno].drive; drive= skin->drives[skin->driveno].drive;
while(burn_drive_get_status(drive,NULL)) while(burn_drive_get_status(drive,NULL))
sleep(2); usleep(100002);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY) while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
sleep(2); usleep(100002);
Cdrskin_report_disc_status(skin,s,0); Cdrskin_report_disc_status(skin,s,0);
if(s==BURN_DISC_APPENDABLE && skin->no_blank_appendable) { if(s==BURN_DISC_APPENDABLE && skin->no_blank_appendable) {
is_not_really_erasable= 1; is_not_really_erasable= 1;
@ -2864,7 +2867,8 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag)
} }
if(strlen(skin->preskin->device_adr)>0) if(strlen(skin->preskin->device_adr)>0)
burn_drive_add_whitelist(skin->preskin->device_adr); 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); ret= Cdrskin_grab_drive(skin,0);
if(ret<=0) if(ret<=0)
return(ret); return(ret);
@ -2960,9 +2964,9 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag)
drive= skin->drives[skin->driveno].drive; drive= skin->drives[skin->driveno].drive;
while(burn_drive_get_status(drive,NULL)) while(burn_drive_get_status(drive,NULL))
sleep(2); usleep(100002);
while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY) while ((s = burn_disc_get_status(drive)) == BURN_DISC_UNREADY)
sleep(2); usleep(100002);
if(skin->verbosity>=Cdrskin_verbose_progresS) if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0); Cdrskin_report_disc_status(skin,s,0);
if(s!=BURN_DISC_FULL && if(s!=BURN_DISC_FULL &&
@ -3341,10 +3345,10 @@ int Cdrskin_burn(struct CdrskiN *skin, int flag)
drive= skin->drives[skin->driveno].drive; drive= skin->drives[skin->driveno].drive;
while (burn_drive_get_status(drive, NULL)) 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) 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) if(skin->verbosity>=Cdrskin_verbose_progresS)
Cdrskin_report_disc_status(skin,s,0); Cdrskin_report_disc_status(skin,s,0);

View File

@ -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", fprintf(stderr,"libburn: experimental: burn_drive_scan_and_grab(%s)\n",
adr); adr);
*/ */
while (!burn_drive_scan(drive_infos, &n_drives)); while (!burn_drive_scan(drive_infos, &n_drives))
usleep(1002);
if (n_drives <= 0) if (n_drives <= 0)
return 0; return 0;
/* /*

View File

@ -162,7 +162,8 @@ int libburner_aquire_by_driveno(int *driveno)
int ret, i; int ret, i;
printf("Beginning to scan for devices ...\n"); 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) { if (drive_count <= 0 && *driveno >= 0) {
printf("FAILED (no drives found)\n"); printf("FAILED (no drives found)\n");
return 0; 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_disc_write(burn_options, target_disc);
burn_write_opts_free(burn_options); 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)) { while (burn_drive_get_status(drive, &progress)) {
if( progress.sectors <= 0 || progress.sector == last_sector) if( progress.sectors <= 0 || progress.sector == last_sector)
printf( printf(

View File

@ -260,7 +260,8 @@ int libburner_aquire_by_driveno(int *driveno)
int ret= 0, i; int ret= 0, i;
printf("Beginning to scan for devices ...\n"); 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) { if (drive_count <= 0 && *driveno >= 0) {
printf("FAILED (no drives found)\n"); printf("FAILED (no drives found)\n");
return 0; 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_disc_write(burn_options, target_disc);
burn_write_opts_free(burn_options); 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)) { while (burn_drive_get_status(drive, &progress)) {
if( progress.sectors <= 0 || progress.sector == last_sector) if( progress.sectors <= 0 || progress.sector == last_sector)
printf( printf(