Commit c5bc9f6d authored by Thomas Schmitt's avatar Thomas Schmitt

New API calls burn_drive_get_feature_codes(), burn_drive_get_feature()

parent 610e213f
#define Cdrskin_timestamP "2019.04.17.085941"
#define Cdrskin_timestamP "2019.04.17.092323"
......@@ -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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment