New -calm_drive mode "revoke"

This commit is contained in:
Thomas Schmitt 2009-11-12 20:44:09 +00:00
parent 22fafb92eb
commit 33b1b9a454
4 changed files with 31 additions and 25 deletions

View File

@ -805,13 +805,14 @@ the elsewise trustworthy table-of-content scan for those media.
To be in effect, the -rom_toc_scan setting has to be made before the -*dev
command which aquires drive and media.
.TP
\fB\-calm_drive\fR "in"|"out"|"all"|"on"|"off"
\fB\-calm_drive\fR "in"|"out"|"all"|"revoke"|"on"|"off"
Reduce drive noise until it is actually used again. Some drives stay alert
for substantial time after they have been used for reading. This reduces
the startup time for the next drive operation but can be loud and waste
energy if no i/o with the drive is expected to happen soon.
.br
Modes "in", "out", "all" immediately calm down -indev, -outdev, resp. both.
Mode "revoke" immediately alerts both.
Mode "on" causes -calm_drive to be performed automatically after each -dev,
-indev, and -outdev. Mode "off" disables this.
.TP

View File

@ -13592,19 +13592,20 @@ show_status:;
/* Option -calm_drive */
int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)
{
int gu_flag= 4, ret;
int gu_flag= 0, ret;
if(strncmp(which,"in",2)==0)
gu_flag|= 1;
else if(strncmp(which,"out",3)==0)
gu_flag|= 2;
else if(strncmp(which,"on",2)==0) {
if(strcmp(which,"in")==0)
gu_flag= 1;
else if(strcmp(which,"out")==0)
gu_flag= 2;
else if(strcmp(which,"on")==0) {
xorriso->do_calm_drive|= 1;
} else if(strncmp(which,"off",3)==0) {
} else if(strcmp(which,"off")==0) {
xorriso->do_calm_drive&= ~1;
} else if(strncmp(which,"off",3)==0) {
} else if(strcmp(which,"revoke")==0) {
gu_flag= 7;
} else
gu_flag|= 3;
gu_flag= 3;
ret= Xorriso_drive_snooze(xorriso, gu_flag);
return(ret);
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.10.27.205410"
#define Xorriso_timestamP "2009.11.12.204523"

View File

@ -1311,8 +1311,6 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
}
}
}
if((xorriso->do_calm_drive & 1) && !(flag & 64))
burn_drive_snooze(drive, 0); /* No need to make noise from start */
ret= 1+not_writeable;
ex:
@ -1321,6 +1319,9 @@ ex:
hret= Xorriso_give_up_drive(xorriso, (flag&3)|((flag&32)>>2));
if(hret<ret)
ret= hret;
} else {
if((xorriso->do_calm_drive & 1) && !(flag & 64))
burn_drive_snooze(drive, 0); /* No need to make noise from start */
}
if(ropts!=NULL)
isoburn_ropt_destroy(&ropts, 0);
@ -5326,7 +5327,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
"on attempt to print Table Of Content",
flag & (2 | 16));
if(ret<=0)
return(0);
{ret= 0; goto ex;}
respt= xorriso->result_line;
@ -5341,13 +5342,13 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
devadr);
Xorriso_toc_line(xorriso, flag & 8);
if(flag & 128)
return(1);
{ret= 1; goto ex;}
sprintf(respt, "Drive type : vendor '%s' product '%s' revision '%s'\n",
dinfo[0].vendor, dinfo[0].product, dinfo[0].revision);
if((flag & 32) | !(flag & 1))
Xorriso_toc_line(xorriso, flag & 8);
if(flag & 32)
return(1);
{ret= 1; goto ex;}
ret= burn_disc_get_profile(drive, &profile_no, profile_name);
s= isoburn_disc_get_status(drive);
@ -5372,7 +5373,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
if((flag & 64) || !(flag & 1)) {
Xorriso_media_product(xorriso, flag & (2 | 8 | 16));
if(xorriso->request_to_abort)
return(1);
{ret= 1; goto ex;}
}
sprintf(respt, "Media status : ");
@ -5396,9 +5397,9 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
Xorriso_toc_line(xorriso, flag & 8);
}
if(s != BURN_DISC_FULL && s != BURN_DISC_APPENDABLE)
return(1);
{ret= 1; goto ex;}
if(xorriso->request_to_abort)
return(1);
{ret= 1; goto ex;}
if(!(flag & 2))
Xorriso_show_boot_info(xorriso, 1 | (flag & 8) | ((flag & 1) << 1));
@ -5420,10 +5421,10 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
if(flag&1)
return(0);
{ret= 0; goto ex;}
sprintf(xorriso->info_text, "Cannot obtain Table Of Content");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
{ret= 0; goto ex;}
}
/* fabricate TOC */
@ -5537,7 +5538,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
}
}
if(xorriso->request_to_abort)
return(1);
{ret= 1; goto ex;}
num_wasted= lba - num_payload;
num_nondata= lba - num_data;
Sfile_scale(((double) num_data) * 2048.0, mem_text,5,1e4,1);
@ -5563,7 +5564,9 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
if (disc!=NULL)
isoburn_toc_disc_free(disc);
Xorriso_process_msg_queues(xorriso,0);
return(1);
ret= 1;
ex:;
return(ret);
}
@ -12878,6 +12881,7 @@ int Xorriso_md5_end(struct XorrisO *xorriso, void **ctx, char md5[16],
/* @param flag bit0=input drive
bit1=output drive
bit2= wake up rather than calm down
*/
int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag)
{
@ -12889,14 +12893,14 @@ int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag)
if((flag & 1) && xorriso->in_drive_handle != NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to calm drive", 0);
burn_drive_snooze(drive, 0);
burn_drive_snooze(drive, !!(flag & 4));
if(in_is_out_too)
{ret= 1; goto ex;}
}
if((flag&2) && xorriso->out_drive_handle!=NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to calm drive", 2);
burn_drive_snooze(drive, 0);
burn_drive_snooze(drive, !!(flag & 4));
}
ret= 1;
ex:;