...
 
Commits (3)
......@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH CDRSKIN 1 "Version 1.5.1, Sep 16, 2018"
.TH CDRSKIN 1 "Version 1.5.1, Apr 17, 2019"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
......@@ -1471,6 +1471,46 @@ better buffer fills while still avoiding the problem:
Alphabetical list of options which are only intended for very special
situations and not for normal use:
.TP
.BI \--list_features
List the SCSI/MMC features which were obtained from the drive when it was
last acquired or re-assessed. Although this is better readable than the
raw reply to SCSI command GET CONFIGURATION, the MMC specification text
is still needed for interpreting it.
.br
The list consists of line groups of the form
.br
Code +/- : Name : Version,P/N
.br
Raw feature data bytes as hex numbers
.br
Parsed info as Name=Value pairs
.br
The headline is the only one which has no blank at its start.
Code is given as 16 bit hex number.
.br
"+" marks a currently offered feature. "-" marks those which may be offered
under different circumstances.
.br
Name is the feature name as listed in MMC specs.
.br
"P" marks persistent features. "N" marks non-persistent features.
.br
The Raw data can occupy more than one line. No "=" occurs in such lines.
If no raw data are present, one line with some blanks is listed instead.
.br
The Parsed info shows some extracted field values with names which resemble
the names used in the MMC description of the particular feature. Parsed info
lines contain at least one Name=Value pair. More than one line is possible.
If no parsed info is produced, one line with some blanks is listed instead.
.br
Example:
.br
0107 - : Real Time Streaming : 4,N
.br
1f 00 00 00
.br
RBCB=1 , SCS=1 , MP2A=1 , WSPD=1 , SW=1
.TP
.BI \--abort_handler
Establish default signal handling not to leave a drive in busy state
but rather to shut it down and to wait until it has ended the final operations.
......
/*
cdrskin.c , Copyright 2006-2018 Thomas Schmitt <scdbackup@gmx.net>
cdrskin.c , Copyright 2006-2019 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
A cdrecord compatible command line interface for libburn.
......@@ -2904,6 +2904,7 @@ set_dev:;
printf(" --list_formats list format descriptors for loaded media.\n");
printf(" --list_ignored_options list all ignored cdrecord options.\n");
printf(" --list_speeds list speed descriptors for loaded media.\n");
printf(" --list_features list SCSI features reported by the drive\n");
printf(" --long_toc print overview of media content\n");
printf(" modesty_on_drive=<options> no writing into full drive buffer\n");
printf(" --no_abort_handler exit even if the drive is in busy state\n");
......@@ -3409,6 +3410,7 @@ struct CdrskiN {
int do_atip;
int do_list_speeds;
int do_list_formats;
int do_list_features;
int do_cdtext_to_textfile;
char cdtext_to_textfile_path[Cdrskin_strleN];
int do_cdtext_to_vt07;
......@@ -3676,6 +3678,7 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag)
o->do_atip= 0;
o->do_list_speeds= 0;
o->do_list_formats= 0;
o->do_list_features= 0;
o->do_cdtext_to_textfile= 0;
o->cdtext_to_textfile_path[0]= 0;
o->do_cdtext_to_vt07= 0;
......@@ -5956,6 +5959,128 @@ ex:;
}
/* @param flag: bit0= do not print prefix on first line
bit1= plan for multiples of 4 hex words
*/
static int Feature_printf(char *prefix, char *text, int flag)
{
char *tpt, *npt;
int lp, lp0, line_size;
lp0= !(flag & 1);
tpt= text;
lp= strlen(prefix);
/* Plan 2 char shorter for possible comma inclusion */
line_size= 77;
if(flag & 2) {
line_size= (80 - lp) / 3;
line_size-= line_size % 4;
line_size= line_size * 3 - 1 + lp;
}
while(lp * lp0 + strlen(tpt) >= 80) {
/* Line size for 20 */
for(npt= tpt + line_size - lp * lp0; npt > tpt; npt--)
if(*npt == ' ')
break;
if(npt <= tpt) {
printf("%s%s\n", lp0 ? prefix : "", tpt);
return(2);
}
/* Keep comma in printed line */
if(*(npt + 1) == ',' && *(npt + 1) == ' ')
npt+= 2;
/* Print and advance */
*npt= 0;
printf("%s%s\n", lp0 ? prefix : "", tpt);
tpt= npt + 1;
lp0= 1;
}
printf("%s%s\n", lp0 ? prefix : "", tpt);
return(1);
}
/** Perform --list_features
@param flag Bitfield for control purposes:
@return <=0 error, 1 success
*/
int Cdrskin_list_features(struct CdrskiN *skin, int flag)
{
struct burn_drive *d;
int ret, count, i, j;
unsigned int *feature_codes= NULL;
unsigned char flags, additional_length, *feature_data = NULL;
char *feature_text = NULL, *cpt, *dpt;
ret= Cdrskin_grab_drive(skin,0);
if(ret <= 0)
return(ret);
d= skin->drives[skin->driveno].drive;
fprintf(stderr, "SCSI Features reported by the drive:\n");
fprintf(stderr,
" + = Current, - = Not Current, P = Persistent, N = Not Persistent\n");
fprintf(stderr, "Code C : Name : Version,Persistent\n");
fprintf(stderr, " Additional data if present (hex bytes)\n");
fprintf(stderr, " Parsed info if available (fieldname=content)\n");
fprintf(stderr, "\n");
burn_drive_get_feature_codes(d, &count, &feature_codes);
if(count <= 0) {
fprintf(stderr, "cdrskin: NOTE: The drive feature list is empty\n");
ret= 1; goto ex;
}
for(i= 0; i < count; i++) {
ret= burn_drive_get_feature(d, feature_codes[i], &flags, &additional_length,
&feature_data, &feature_text);
if(ret <= 0) {
fprintf(stderr, "cdrskin: SORRY: Cannot obtain data of feature %4.4x\n",
feature_codes[i]);
continue;
}
cpt= feature_text;
for(j= 0; j < 3 && cpt != NULL; j++)
cpt= strchr(cpt + 1, ':');
if(cpt != NULL) {
*cpt= 0;
cpt++;
}
Feature_printf(" ", feature_text, 1);
if(cpt != NULL) {
dpt= cpt;
if(*dpt == ' ')
dpt++;
for(j= 0; j < 1 && cpt != NULL; j++)
cpt= strchr(cpt + 1, ':');
if(cpt != NULL) {
*cpt= 0;
cpt++;
}
Feature_printf(" ", dpt, 2);
}
if(cpt != NULL) {
if(*cpt == ' ')
cpt++;
Feature_printf(" ", cpt, 0);
} else {
printf("\n");
}
if(feature_data != NULL)
free(feature_data);
feature_data= NULL;
if(feature_text != NULL)
free(feature_text);
feature_text= NULL;
}
ret= 1;
ex:;
if(feature_codes != NULL)
free(feature_codes);
return(ret);
}
int Cdrskin_read_textfile(struct CdrskiN *skin, char *path, int flag)
{
int ret, num_packs = 0;
......@@ -8843,6 +8968,10 @@ set_isrc:;
skin->do_list_speeds= 1;
skin->preskin->demands_cdrskin_caps= 1;
} else if(strcmp(argv[i],"--list_features")==0) {
skin->do_list_features= 1;
skin->preskin->demands_cdrskin_caps= 1;
} else if(strncmp(argv[i],"fallback_program=",17)==0) {
/* is handled in Cdrpreskin_setup() */;
......@@ -9711,6 +9840,15 @@ int Cdrskin_run(struct CdrskiN *skin, int *exit_value, int flag)
if(ret<=0)
{*exit_value= 16; goto ex;}
}
if(skin->do_list_features) {
if(skin->n_drives<=0)
{*exit_value= 20; goto no_drive;}
if(Cdrskin__is_aborting(0))
goto ex;
ret= Cdrskin_list_features(skin, 0);
if(ret<=0)
{*exit_value= 20; goto ex;}
}
if(skin->do_blank) {
if(skin->n_drives<=0)
{*exit_value= 8; goto no_drive;}
......
#define Cdrskin_timestamP "2019.04.13.173610"
#define Cdrskin_timestamP "2019.04.17.095742"
......@@ -3677,3 +3677,63 @@ int burn_drive_get_immed(struct burn_drive *drive)
}
/* ts B90412 , API */
int burn_drive_get_feature(struct burn_drive *d, unsigned int feature_code,
unsigned char *flags,
unsigned char *additional_length,
unsigned char **feature_data,
char **feature_text)
{
int ret, i;
struct burn_feature_descr *descr;
*flags = 0;
*additional_length = 0;
*feature_data = NULL;
if (feature_text != NULL)
*feature_text = NULL;
if (!burn_drive_has_feature(d, feature_code, &descr, 0))
return 0;
*flags = descr->flags;
*additional_length = descr->data_lenght;
if (*additional_length > 0)
BURN_ALLOC_MEM(*feature_data, unsigned char,
*additional_length);
for (i = 0; i < *additional_length; i++)
(*feature_data)[i] = descr->data[i];
if (feature_text != NULL) {
ret = burn_make_feature_text(d, feature_code, *flags,
*additional_length, *feature_data,
feature_text, 0);
} else {
ret = 1;
}
ex:
return ret;
}
/* ts B90412 , API */
void burn_drive_get_feature_codes(struct burn_drive *d,
int *count, unsigned int **feature_codes)
{
struct burn_feature_descr *o;
int to_alloc;
*count = 0;
*feature_codes = NULL;
for (o = d->features; o != NULL; o = o->next)
(*count)++;
if (*count == 0)
return;
to_alloc = *count;
*count = 0;
BURN_ALLOC_MEM_VOID(*feature_codes, unsigned int, to_alloc);
for (o = d->features; o != NULL; o = o->next) {
(*feature_codes)[*count] = o->feature_code;
(*count)++;
}
ex:;
}
......@@ -3429,6 +3429,55 @@ int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles,
int burn_obtain_profile_name(int profile_code, char name[80]);
/* ts B90414 */
/** Obtains the list of SCSI Feature Codes from feature descriptors which
were obtained from the drive when it was most recently acquired or
re-assessed.
@param d Drive to query
@param count Returns the number of allocated elements in feature_codes
@param feature_codes Returns the allocated array of feature codes.
If returned *feature_codes is not NULL, dispose it
by free() when it is no longer needed.
@since 1.5.2
*/
void burn_drive_get_feature_codes(struct burn_drive *d,
int *count, unsigned int **feature_codes);
/* ts B90414 */
/** Obtains the fields and data of a particular feature which were obtained
from the drive when it was last acquired or re-assessed. See MMC specs
for full detail.
@param d Drive to query
@param feature_code A number as learned by burn_drive_get_feature_codes()
@param flags Returns byte 2 of the feature descriptor:
bit0= Current
bit1= Persistent
bit2-5= Version
@param additional_length Returns byte 3 of descriptor.
This is the size of feature_data.
@param feature_data Returns further bytes of descriptor.
If returned *feature_data is not NULL, dispose it
by free() when it is no longer needed.
@param feature_text Returns text representation of the feature descriptor:
Code +/- : Name : Version,P/N : Hex bytes : Parsed info
Current features are marked by "+", others by "-".
Persistent features are marked by "P", others by "N".
feature_text may be submitted as NULL. In this case
no text is generated and returned.
If returned *feature_text is not NULL, dispose it
by free() when it is no longer needed.
@return 0 feature descriptor is not present
-1 out of memory
>0 success
@since 1.5.2
*/
int burn_drive_get_feature(struct burn_drive *d, unsigned int feature_code,
unsigned char *flags,
unsigned char *additional_length,
unsigned char **feature_data,
char **feature_text);
/** Gets the maximum write speed for a drive and eventually loaded media.
The return value might change by the media type of already loaded media,
again by call burn_drive_grab() and again by call burn_disc_read_atip().
......
......@@ -54,6 +54,8 @@ burn_drive_get_bd_r_pow;
burn_drive_get_best_speed;
burn_drive_get_disc;
burn_drive_get_drive_role;
burn_drive_get_feature;
burn_drive_get_feature_codes;
burn_drive_get_immed;
burn_drive_get_media_sno;
burn_drive_get_min_write_speed;
......
This diff is collapsed.
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2006 - 2019 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
......@@ -2042,7 +2042,7 @@ static void react_on_drive_loss(struct burn_drive *d, struct command *c,
*/
int sg_issue_command(struct burn_drive *d, struct command *c)
{
int done = 0, no_c_page = 0, i, ret;
int done = 0, no_c_page = 0, i, j, ret;
int err;
time_t start_time;
sg_io_hdr_t s;
......@@ -2199,6 +2199,24 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
(unsigned int) s.host_status,
(unsigned int) s.driver_status);
scsi_log_message(d, fp, msg, 0);
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x0002010c,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
sprintf(msg, "Attempted command: %s : ",
spc_command_name(
(unsigned int) c->opcode[0], 0));
for (j = 0; j <16 && j < c->oplen; j++)
sprintf(msg + strlen(msg), "%2.2x ",
c->opcode[j]);
sprintf(msg + strlen(msg), " : dxfer_len= %d",
s.dxfer_len);
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x0002010c,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
react_on_drive_loss(d, c, fp);
{ret = -1; goto ex;}
}
......
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2016 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2006 - 2019 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
......@@ -1720,6 +1720,13 @@ static char *scsi_command_name(unsigned int c, int flag)
}
/* ts B90206: Avoid publishing more inner API functions which begin by scsi_ */
char *spc_command_name(unsigned int c, int flag)
{
return(scsi_command_name(c, flag));
}
/* ts A61030 - A61115 */
/* @param flag bit0= do report conditions which are considered not an error
bit1= report with severity FAILURE rather than DEBUG
......
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2006 - 2019 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
......@@ -114,6 +114,9 @@ int scsi_log_message(struct burn_drive *d, void *fp, char * msg, int flag);
int spc_decode_sense(unsigned char *sense, int senselen,
int *key, int *asc, int *ascq);
/* ts B90206 */
char *spc_command_name(unsigned int c, int flag);
/* ts B00808 */
/** Evaluates outcome of a single SCSI command, eventually logs sense data,
and issues DEBUG error message in case the command is evaluated as done.
......