Browse Source

New API calls burn_drive_get_all_profiles(), burn_obtain_profile_name()

ZeroSevenZero
Thomas Schmitt 12 years ago
parent
commit
c59300b27a
  1. 2
      cdrskin/cdrskin_timestamp.h
  2. 27
      libburn/drive.c
  3. 28
      libburn/libburn.h
  4. 25
      libburn/mmc.c
  5. 3
      libburn/mmc.h
  6. 3
      libburn/transport.h

2
cdrskin/cdrskin_timestamp.h

@ -1 +1 @@
#define Cdrskin_timestamP "2009.07.14.133159"
#define Cdrskin_timestamP "2009.08.15.133332"

27
libburn/drive.c

@ -40,6 +40,9 @@
/* A70903 : for burn_scsi_setup_drive() */
#include "spc.h"
/* A90815 : for mmc_obtain_profile_name() */
#include "mmc.h"
#include "libdax_msgs.h"
extern struct libdax_msgs *libdax_messenger;
@ -2001,6 +2004,30 @@ int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80])
}
/* ts A90815 : New API function */
int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles,
int profiles[64], char is_current[64])
{
int i;
*num_profiles = d->num_profiles;
for (i = 0; i < d->num_profiles; i++) {
profiles[i] = (d->all_profiles[i * 4] << 8) |
d->all_profiles[i * 4 + 1];
is_current[i] = d->all_profiles[i * 4 + 2] & 1;
}
return 1;
}
/* ts A90815 : New API function */
int burn_obtain_profile_name(int profile_number, char name[80])
{
strcpy(name, mmc_obtain_profile_name(profile_number));
return(name[0] != 0);
}
/* ts A61223 : New API function */
int burn_drive_wrote_well(struct burn_drive *d)
{

28
libburn/libburn.h

@ -1998,6 +1998,34 @@ void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts,
void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts,
unsigned char hardware_error_retries);
/* ts A90815 */
/** Gets the list of profile codes supported by the drive.
Profiles depict the feature sets which constitute media types. For
known profile codes and names see burn_disc_get_profile().
@param d is the drive to query
@param num_profiles returns the number of supported profiles
@param profiles returns the profile codes
@param is_current returns the status of the corresponding profile code:
1= current, i.e. the matching media is loaded
0= not current, i.e. the matching media is not loaded
@return always 1 for now
@since 0.7.0
*/
int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles,
int profiles[64], char is_current[64]);
/* ts A90815 */
/** Obtains the profile name associated with a profile code.
@param profile_code the profile code to be translated
@param name returns the profile name (e.g. "DVD+RW")
@return 1= known profile code , 0= unknown profile code
@since 0.7.0
*/
int burn_obtain_profile_name(int profile_code, char name[80]);
/** 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().

25
libburn/mmc.c

@ -1467,7 +1467,7 @@ inquire_drive:;
/* ts A61201 */
static char *mmc_obtain_profile_name(int profile_number)
char *mmc_obtain_profile_name(int profile_number)
{
static char *texts[0x53] = {NULL};
int i, max_pno = 0x53;
@ -2250,7 +2250,7 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len)
{
struct buffer buf;
int len, cp, descr_len = 0, feature_code, prf_number, only_current = 1;
int old_alloc_len;
int old_alloc_len, only_current_profile = 0;
unsigned char *descr, *prf, *up_to, *prf_end;
struct command c;
int phys_if_std = 0;
@ -2264,6 +2264,7 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len)
d->current_is_cd_profile = 0;
d->current_is_supported_profile = 0;
d->current_is_guessed_profile = 0;
d->num_profiles = 0;
d->current_has_feat21h = 0;
d->current_feat21h_link_size = -1;
d->current_feat23h_byte4 = 0;
@ -2272,10 +2273,6 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len)
scsi_init_command(&c, MMC_GET_CONFIGURATION,
sizeof(MMC_GET_CONFIGURATION));
/*
memcpy(c.opcode, MMC_GET_CONFIGURATION, sizeof(MMC_GET_CONFIGURATION));
c.oplen = sizeof(MMC_GET_CONFIGURATION);
*/
c.dxfer_len= *alloc_len;
c.retry = 1;
c.opcode[7] = (c.dxfer_len >> 8) & 0xff;
@ -2381,7 +2378,7 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len)
#endif
/* Enable this to get loud and repeated reports about the feature set :
#define Libburn_print_feature_descriptorS 1
#define Libburn_print_feature_descriptorS 1
*/
/* ts A70127 : Interpret list of profile and feature descriptors.
see mmc5r03c.pdf 5.2
@ -2395,7 +2392,7 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len)
"-----------------------------------------------------------------\n");
fprintf(stderr,
"LIBBURN_EXPERIMENTAL : feature list length = %d , shown = %d\n",
len, up_to - c.page->data);
len, (int) (up_to - c.page->data));
#endif /* Libburn_print_feature_descriptorS */
for (descr = c.page->data + 8; descr + 3 < up_to; descr += descr_len) {
@ -2413,8 +2410,14 @@ static int mmc_get_configuration_al(struct burn_drive *d, int *alloc_len)
if (feature_code == 0x0) {
prf_end = descr + 4 + descr[3];
d->num_profiles = descr[3] / 4;
if (d->num_profiles > 64)
d->num_profiles = 64;
if (d->num_profiles > 0)
memcpy(d->all_profiles, descr + 4,
d->num_profiles * 4);
for (prf = descr + 4; prf + 2 < prf_end; prf += 4) {
if (only_current && !(prf[2] & 1))
if (only_current_profile && !(prf[2] & 1))
continue;
prf_number = (prf[0] << 8) | prf[1];
@ -3865,13 +3868,15 @@ int mmc_setup_drive(struct burn_drive *d)
d->start_lba = -2000000000;
d->end_lba = -2000000000;
/* ts A61201 - A70223*/
/* ts A61201 - A90815*/
d->erasable = 0;
d->current_profile = -1;
d->current_profile_text[0] = 0;
d->current_is_cd_profile = 0;
d->current_is_supported_profile = 0;
d->current_is_guessed_profile = 0;
memset(d->all_profiles, 0, 256);
d->num_profiles = 0;
d->current_has_feat21h = 0;
d->current_feat21h_link_size = -1;
d->current_feat23h_byte4 = 0;

3
libburn/mmc.h

@ -75,6 +75,9 @@ int mmc_read_10(struct burn_drive *d, int start, int amount,
/* ts A81210 : Determine the upper limit of readable data size */
int mmc_read_capacity(struct burn_drive *d);
/* ts A61201 */
char *mmc_obtain_profile_name(int profile_number);
/* mmc5r03c.pdf 4.3.4.4.1 d) "The maximum number of RZones is 2 302." */
#define BURN_MMC_FAKE_TOC_MAX_SIZE 2302

3
libburn/transport.h

@ -163,6 +163,9 @@ struct burn_drive
int current_is_supported_profile;
/* ts A90603 */
int current_is_guessed_profile;
/* ts A90815 */
unsigned char all_profiles[256];
int num_profiles;
/* ts A70128 : MMC-to-MMC feature info from 46h for DVD-RW.
Quite internal. Regard as opaque :)

Loading…
Cancel
Save