Группа :: Архивирование/Создание CD
Пакет: cdrtools
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: cdrtools-2.01a32-ossdvd-alt.patch
diff -u -r -3 cdrtools-2.01/cdrecord/cdr_drv.c cdrtools-2.01.ossdvd/cdrecord/cdr_drv.c
--- cdrtools-2.01/cdrecord/cdr_drv.c 2004-03-02 02:06:26.000000000 +0100
+++ cdrtools-2.01.ossdvd/cdrecord/cdr_drv.c 2004-08-27 05:22:37.000000000 +0200
@@ -42,6 +42,7 @@
extern cdr_t cdr_oldcd;
extern cdr_t cdr_cd;
extern cdr_t cdr_mmc;
+extern cdr_t cdr_mdvd;
extern cdr_t cdr_mmc_sony;
extern cdr_t cdr_cd_dvd;
extern cdr_t cdr_philips_cdd521O;
@@ -80,6 +81,7 @@
cdr_t *drivers[] = {
&cdr_cd_dvd,
&cdr_mmc,
+ &cdr_mdvd,
&cdr_mmc_sony,
&cdr_cd,
&cdr_oldcd,
diff -u -r -3 cdrtools-2.01/cdrecord/cdrecord.c cdrtools-2.01.ossdvd/cdrecord/cdrecord.c
--- cdrtools-2.01/cdrecord/cdrecord.c 2004-06-17 11:24:50.000000000 +0200
+++ cdrtools-2.01.ossdvd/cdrecord/cdrecord.c 2004-08-27 05:22:37.000000000 +0200
@@ -215,7 +215,7 @@
LOCAL BOOL checkdsize __PR((SCSI *scgp, cdr_t *dp,
long tsize, int flags));
LOCAL void raise_fdlim __PR((void));
-LOCAL void gargs __PR((int, char **, int *, track_t *, char **,
+LOCAL int gargs __PR((int, char **, int *, track_t *, char **,
int *, cdr_t **,
int *, long *, int *));
LOCAL void set_trsizes __PR((cdr_t *, int, track_t *));
@@ -270,6 +270,7 @@
SCSI *scgp = NULL;
char errstr[80];
BOOL gracedone = FALSE;
+ int ispacket;
#ifdef __EMX__
/* This gives wildcard expansion with Non-Posix shells with EMX */
@@ -284,7 +285,7 @@
track[i].track = track[i].trackno = i;
track[0].tracktype = TOC_MASK;
raise_fdlim();
- gargs(ac, av, &tracks, track, &dev, &timeout, &dp, &speed, &flags,
+ ispacket = gargs(ac, av, &tracks, track, &dev, &timeout, &dp, &speed, &flags,
&blanktype);
if ((track[0].tracktype & TOC_MASK) == TOC_MASK)
comerrno(EX_BAD, "Internal error: Bad TOC type.\n");
@@ -351,6 +352,10 @@
CLONE_TITLE,
cdr_version,
HOST_CPU, HOST_VENDOR, HOST_OS);
+ printf("NOTE: this is OSS DVD extensions for cdrtools and thus may have bugs\n");
+ printf(" related to DVD issues that are not present in the original cdrtools. Use\n");
+ printf(" http://bugzilla.altlinux.org for bug reports. Nor OSS DVD author nor original\n");
+ printf(" cdrtools author should not be bothered with problems in this version.\n");
#if defined(SOURCE_MODIFIED) || !defined(IS_SCHILY_XCONFIG)
#define INSERT_YOUR_EMAIL_ADDRESS_HERE
@@ -591,6 +596,19 @@
} else if (!is_unknown_dev(scgp) && dp != get_cdrcmds(scgp)) {
errmsgno(EX_BAD, "WARNING: Trying to use other driver on known device.\n");
}
+ if (ispacket) {
+ BOOL is_cdwr = FALSE;
+ BOOL is_dvdwr = FALSE;
+ is_mmc(scgp, &is_cdwr, &is_dvdwr);
+ if (is_dvdwr) {
+ track[0].flags |= TI_PACKET;
+ /*XXX put here to only affect DVD writing, should be in gargs.
+ * however if set in args for all mode, packet writing is then
+ * broken for all disc as cdrecord assume that PACKET imply TAO which
+ * is not true at all???? */
+ track[0].flags &= ~TI_TAO;
+ }
+ }
if (!is_cddrive(scgp))
comerrno(EX_BAD, "Sorry, no CD/DVD-Drive found on this target.\n");
@@ -632,7 +650,7 @@
if (!is_mmc(scgp, &is_cdwr, &is_dvdwr))
is_cdwr = TRUE; /* If it is not MMC, it must be a CD writer */
- if (is_dvdwr && !set_cdrcmds("mmc_dvd", (cdr_t **)NULL)) {
+ if (is_dvdwr && !set_cdrcmds("mmc_mdvd", (cdr_t **)NULL)) {
errmsgno(EX_BAD,
"This version of cdrecord does not include DVD-R/DVD-RW support code.\n");
errmsgno(EX_BAD,
@@ -1180,6 +1198,14 @@
trackno = 0;
}
scgp->silent--;
+
+ /* If it is DVD, the information in TOC is fabricated :)
+ The real information is from read disk info command*/
+ if((dp->cdr_dstat->ds_disktype&DT_DVD) && (dp->cdr_dstat->ds_trlast>0)){
+ trackno=dp->cdr_dstat->ds_trlast-1;
+ printf("trackno=%d\n",trackno);
+ }
+
if ((tracks + trackno) > MAX_TRACK) {
/*
* XXX How many tracks are allowed on a DVD?
@@ -2911,10 +2937,13 @@
/*
* dsp->ds_maxblocks == 0 (disk capacity is unknown).
*/
- if (endsec >= (405000-300)) { /*<90 min disk*/
- errmsgno(EX_BAD,
- "Data will not fit on any disk.\n");
- goto toolarge;
+ if (endsec >= (2300000)) {
+ errmsgno(EX_BAD,
+ "ERROR: Could not manage to find medium size, and more than 4.3 GB of data.\n");
+ goto toolarge;
+ } else if (endsec >= (405000-300)) { /*<90 min disk or DVD*/
+ errmsgno(EX_BAD,
+ "WARNING: Could not manage to find medium size, and more than 90 mins of data.\n");
} else if (endsec >= (333000-150)) { /* 74 min disk*/
errmsgno(EX_BAD,
"WARNING: Data may not fit on standard 74min disk.\n");
@@ -2998,7 +3027,7 @@
#define M_RAW 4 /* Raw mode */
#define M_PACKET 8 /* Packed mode */
-LOCAL void
+LOCAL int
gargs(ac, av, tracksp, trackp, devp, timeoutp, dpp, speedp, flagsp, blankp)
int ac;
char **av;
@@ -3666,14 +3695,14 @@
((strncmp(*devp, "HELP", 4) == 0) ||
(strncmp(*devp, "help", 4) == 0))) {
*flagsp |= F_CHECKDRIVE; /* Set this for not calling mlockall() */
- return;
+ return ispacket;
}
if (*flagsp & (F_LOAD|F_DLCK|F_SETDROPTS|F_MSINFO|F_TOC|F_PRATIP|F_FIX|F_VERSION|F_CHECKDRIVE|F_PRCAP|F_INQUIRY|F_SCANBUS|F_RESET|F_ABORT)) {
if (tracks != 0) {
errmsgno(EX_BAD, "No tracks allowed with this option\n");
susage(EX_BAD);
}
- return;
+ return ispacket;
}
*tracksp = tracks;
if (*flagsp & F_SAO) {
@@ -3702,12 +3731,13 @@
susage(EX_BAD);
}
cuefilename = cuefile;
- return;
+ return ispacket;
}
if (tracks == 0 && (*flagsp & (F_LOAD|F_DLCK|F_EJECT|F_BLANK|F_FORMAT)) == 0) {
errmsgno(EX_BAD, "No tracks specified. Need at least one.\n");
susage(EX_BAD);
}
+ return ispacket;
}
LOCAL void
@@ -4131,9 +4161,11 @@
/*
* Verify that scheduling is available
*/
+ if (!linuxcheck()) seteuid ( 0 );
#ifdef _SC_PRIORITY_SCHEDULING
if (sysconf(_SC_PRIORITY_SCHEDULING) == -1) {
errmsg("WARNING: RR-scheduler not available, disabling.\n");
+ if (!linuxcheck()) seteuid ( getuid() );
return (-1);
}
#endif
@@ -4141,8 +4173,10 @@
scp.sched_priority = sched_get_priority_max(SCHED_RR) - pri;
if (sched_setscheduler(0, SCHED_RR, &scp) < 0) {
errmsg("WARNING: Cannot set RR-scheduler\n");
+ if (!linuxcheck()) seteuid ( getuid() );
return (-1);
}
+ if (!linuxcheck()) seteuid ( getuid() );
return (0);
}
diff -u -r -3 cdrtools-2.01/cdrecord/cdrecord.h cdrtools-2.01.ossdvd/cdrecord/cdrecord.h
--- cdrtools-2.01/cdrecord/cdrecord.h 2004-05-25 00:36:01.000000000 +0200
+++ cdrtools-2.01.ossdvd/cdrecord/cdrecord.h 2004-08-27 05:22:37.000000000 +0200
@@ -570,6 +570,12 @@
#define DSF_NEED_FORMAT 0x0800 /* Disk needs to be formatted */
/*
+ * Definitions for disktype flags
+ */
+#define DT_CD 0x001 /*is a CD */
+#define DT_DVD 0x002 /*is a DVD */
+
+/*
* Definitions for disk_status disk type
* used in "ds_type".
*/
diff -u -r -3 cdrtools-2.01/cdrecord/drv_mmc.c cdrtools-2.01.ossdvd/cdrecord/drv_mmc.c
--- cdrtools-2.01/cdrecord/drv_mmc.c 2004-05-25 00:36:01.000000000 +0200
+++ cdrtools-2.01.ossdvd/cdrecord/drv_mmc.c 2004-08-27 05:23:18.000000000 +0200
@@ -84,8 +84,11 @@
EXPORT char *hasdrvopt __PR((char *optstr, char *optname));
LOCAL cdr_t *identify_mmc __PR((SCSI *scgp, cdr_t *, struct scsi_inquiry *));
LOCAL int attach_mmc __PR((SCSI *scgp, cdr_t *));
+LOCAL int attach_mdvd __PR((SCSI *scgp, cdr_t *));
EXPORT int check_writemodes_mmc __PR((SCSI *scgp, cdr_t *dp));
+EXPORT int check_writemodes_mdvd __PR((SCSI *scgp, cdr_t *dp));
LOCAL int deflt_writemodes_mmc __PR((SCSI *scgp, BOOL reset_dummy));
+LOCAL int deflt_writemodes_mdvd __PR((SCSI *scgp, BOOL reset_dummy));
LOCAL int get_diskinfo __PR((SCSI *scgp, struct disk_info *dip));
LOCAL void di_to_dstat __PR((struct disk_info *dip, dstat_t *dsp));
LOCAL int get_atip __PR((SCSI *scgp, struct atipinfo *atp));
@@ -94,18 +97,26 @@
#endif
LOCAL int init_mmc __PR((SCSI *scgp, cdr_t *dp));
LOCAL int getdisktype_mmc __PR((SCSI *scgp, cdr_t *dp));
+LOCAL int getdisktype_mdvd __PR((SCSI *scgp, cdr_t *dp));
LOCAL int speed_select_mmc __PR((SCSI *scgp, cdr_t *dp, int *speedp));
+LOCAL int speed_select_mdvd __PR((SCSI *scgp, cdr_t *dp, int *speedp));
LOCAL int mmc_set_speed __PR((SCSI *scgp, int readspeed, int writespeed, int rotctl));
LOCAL int next_wr_addr_mmc __PR((SCSI *scgp, track_t *trackp, long *ap));
+LOCAL int next_wr_addr_mdvd __PR((SCSI *scgp, track_t *trackp, long *ap));
LOCAL int write_leadin_mmc __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
LOCAL int open_track_mmc __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
+LOCAL int open_track_mdvd __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
LOCAL int close_track_mmc __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
+LOCAL int close_track_mdvd __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
LOCAL int open_session_mmc __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
+LOCAL int open_session_mdvd __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
LOCAL int waitfix_mmc __PR((SCSI *scgp, int secs));
LOCAL int fixate_mmc __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
+LOCAL int fixate_mdvd __PR((SCSI *scgp, cdr_t *dp, track_t *trackp));
LOCAL int blank_mmc __PR((SCSI *scgp, cdr_t *dp, long addr, int blanktype));
LOCAL int send_opc_mmc __PR((SCSI *scgp, caddr_t, int cnt, int doopc));
LOCAL int opt1_mmc __PR((SCSI *scgp, cdr_t *dp));
+LOCAL int opt1_mdvd __PR((SCSI *scgp, cdr_t *dp));
LOCAL int opt2_mmc __PR((SCSI *scgp, cdr_t *dp));
LOCAL int scsi_sony_write __PR((SCSI *scgp, caddr_t bp, long sectaddr, long size, int blocks, BOOL islast));
LOCAL int gen_cue_mmc __PR((track_t *trackp, void *vcuep, BOOL needgap));
@@ -197,6 +208,46 @@
opt2_mmc,
};
+cdr_t cdr_mdvd = {
+ 0, 0,
+ CDR_SWABAUDIO,
+ 370,370,
+ "mmc_mdvd",
+ "generic SCSI-3/mmc DVD-R(W) driver",
+ 0,
+ (dstat_t *)0,
+ identify_mmc,
+ attach_mdvd,
+ init_mmc,
+ getdisktype_mdvd,
+ scsi_load,
+ scsi_unload,
+ read_buff_cap,
+ cmd_dummy, /* recovery_needed */
+ (int(*)__PR((SCSI *, int)))cmd_dummy, /* recover */
+ speed_select_mdvd,
+ select_secsize,
+ next_wr_addr_mdvd,
+ (int(*)__PR((SCSI *, Ulong)))cmd_ill, /* reserve_track */
+ scsi_cdr_write,
+ (int(*)__PR((SCSI *scgp, int, track_t *)))cmd_dummy, /* gen_cue */
+ (int(*)__PR((SCSI *scgp, cdr_t *, track_t *)))cmd_dummy, /* send_cue */
+ write_leadin_mmc,
+ open_track_mdvd,
+ close_track_mdvd,
+ open_session_mdvd,
+ cmd_dummy,
+ cmd_dummy, /* abort */
+ read_session_offset,
+ fixate_mdvd,
+ stats_mmc,
+ blank_mmc,
+ format_dummy,
+ send_opc_mmc,
+ opt1_mdvd,
+ opt2_mmc,
+};
+
/*
* Sony MMC CD-writer
*/
@@ -589,11 +640,8 @@
}
} else if (profile >= 0x10 && profile < 0x18) {
errmsgno(EX_BAD,
- "Found DVD media but DVD-R/DVD-RW support code is missing.\n");
- errmsgno(EX_BAD,
- "If you need DVD-R/DVD-RW support, ask the Author for cdrecord-ProDVD.\n");
- errmsgno(EX_BAD,
- "Free test versions and free keys for personal use are at ftp://ftp.berlios.de/pub/cdrecord/ProDVD/\n");
+ "Found DVD media: using cdr_mdvd.\n");
+ dp = &cdr_mdvd;
return (dp);
}
} else {
@@ -662,11 +710,8 @@
}
if (is_dvd) {
errmsgno(EX_BAD,
- "Found DVD media but DVD-R/DVD-RW support code is missing.\n");
- errmsgno(EX_BAD,
- "If you need DVD-R/DVD-RW support, ask the Author for cdrecord-ProDVD.\n");
- errmsgno(EX_BAD,
- "Free test versions and free keys for personal use are at ftp://ftp.berlios.de/pub/cdrecord/ProDVD/\n");
+ "Found DVD media: using cdr_mdvd.\n");
+ dp = &cdr_mdvd;
}
return (dp);
}
@@ -856,6 +901,42 @@
return (0);
}
+LOCAL int
+attach_mdvd(scgp, dp)
+ SCSI *scgp;
+ cdr_t *dp;
+{
+ struct cd_mode_page_2A *mp;
+
+
+ allow_atapi(scgp, TRUE);/* Try to switch to 10 byte mode cmds */
+
+ scgp->silent++;
+ mp = mmc_cap(scgp, NULL);/* Get MMC capabilities in allocated mp */
+ scgp->silent--;
+ if (mp == NULL)
+ return (-1); /* Pre SCSI-3/mmc drive */
+
+ dp->cdr_cdcap = mp; /* Store MMC cap pointer */
+
+ if (mp->loading_type == LT_TRAY)
+ dp->cdr_flags |= CDR_TRAYLOAD;
+ else if (mp->loading_type == LT_CADDY)
+ dp->cdr_flags |= CDR_CADDYLOAD;
+
+ if (mp->BUF != 0)
+ dp->cdr_flags |= CDR_BURNFREE;
+
+ check_writemodes_mdvd(scgp, dp);
+
+ if (driveropts != NULL) {
+ if (strcmp(driveropts, "help") == 0) {
+ mmc_opthelp(dp, 0);
+ }
+ }
+
+ return (0);
+}
EXPORT int
check_writemodes_mmc(scgp, dp)
@@ -1007,6 +1088,77 @@
}
LOCAL int
+check_writemodes_mdvd(scgp, dp)
+ SCSI *scgp;
+ cdr_t *dp;
+{
+ Uchar mode[0x100];
+ int len;
+ struct cd_mode_page_05 *mp;
+
+ if (xdebug)
+ printf("Checking possible write modes: ");
+
+ deflt_writemodes_mdvd(scgp, FALSE);
+
+ fillbytes((caddr_t)mode, sizeof(mode), '\0');
+
+ scgp->silent++;
+ if (!get_mode_params(scgp, 0x05, "CD write parameter",
+ mode, (Uchar *)0, (Uchar *)0, (Uchar *)0, &len)) {
+ scgp->silent--;
+ return (-1);
+ }
+ if (len == 0) {
+ scgp->silent--;
+ return (-1);
+ }
+
+ mp = (struct cd_mode_page_05 *)
+ (mode + sizeof(struct scsi_mode_header) +
+ ((struct scsi_mode_header *)mode)->blockdesc_len);
+
+ mp->test_write = 0;
+
+ /*We only check for PACKET and SAO since these are the only supported modes for DVD */
+ /*XXX these checks are irrelevant because they are not medium sensitive. ie the device returns
+ error only when it does not support a given mode for ALL mediums. It should check using
+ GET CONFIGURATION command.*/
+
+ mp->write_type = WT_PACKET;
+ mp->fp = 0;
+ i_to_4_byte(mp->packet_size, 0);
+
+ if (set_mode_params(scgp, "CD write parameter", mode, len, 0, -1)) {
+ dp->cdr_flags |= CDR_PACKET;
+ if (xdebug)
+ printf("PACKET ");
+ } else
+ dp->cdr_flags &= ~CDR_PACKET;
+ mp->fp = 0;
+ i_to_4_byte(mp->packet_size, 0);
+ mp->track_mode = TM_DATA;
+
+
+ mp->write_type = WT_SAO;
+
+ if (set_mode_params(scgp, "CD write parameter", mode, len, 0, -1)) {
+ dp->cdr_flags |= CDR_SAO;
+ if (xdebug)
+ printf("SAO ");
+ } else
+ dp->cdr_flags &= ~CDR_SAO;
+
+
+ if (xdebug)
+ printf("\n");
+
+ deflt_writemodes_mdvd(scgp, TRUE);
+ scgp->silent--;
+ return (0);
+}
+
+LOCAL int
deflt_writemodes_mmc(scgp, reset_dummy)
SCSI *scgp;
BOOL reset_dummy;
@@ -1080,6 +1232,61 @@
return (0);
}
+LOCAL int
+deflt_writemodes_mdvd(scgp, reset_dummy)
+ SCSI *scgp;
+ BOOL reset_dummy;
+{
+ Uchar mode[0x100];
+ int len;
+ struct cd_mode_page_05 *mp;
+
+ fillbytes((caddr_t)mode, sizeof(mode), '\0');
+
+ scgp->silent++;
+ if (!get_mode_params(scgp, 0x05, "DVD write parameter",
+ mode, (Uchar *)0, (Uchar *)0, (Uchar *)0, &len)) {
+ scgp->silent--;
+ return (-1);
+ }
+ if (len == 0) {
+ scgp->silent--;
+ return (-1);
+ }
+
+ mp = (struct cd_mode_page_05 *)
+ (mode + sizeof(struct scsi_mode_header) +
+ ((struct scsi_mode_header *)mode)->blockdesc_len);
+
+ mp->test_write = 0;
+ /*
+ * This is the only place where we reset mp->test_write (-dummy)
+ */
+ if (reset_dummy)
+ mp->test_write = 0;
+
+
+ /*
+ * Set default values:
+ * Write type = 02 (session at once)
+ *
+ * XXX Note: the same code appears in check_writemodes_mmc() and
+ * XXX in speed_select_mmc().
+ */
+ mp->write_type = WT_SAO;
+ mp->track_mode = TM_DATA;
+ mp->dbtype = DB_ROM_MODE1;
+ mp->session_format = SES_DA_ROM;
+
+
+ if (set_mode_params(scgp, "DVD write parameter", mode, len, 0, -1) < 0) {
+ scgp->silent--;
+ return (-1);
+ }
+ scgp->silent--;
+ return (0);
+}
+
#ifdef PRINT_ATIP
LOCAL void print_di __PR((struct disk_info *dip));
LOCAL void atip_printspeed __PR((char *fmt, int speedindex, char speedtab[]));
@@ -1149,6 +1356,9 @@
if (dsp->ds_last_leadout == 0 && dsp->ds_maxblocks >= 0)
dsp->ds_last_leadout = dsp->ds_maxblocks;
+ dsp->ds_trfirst=dip->first_track;
+ dsp->ds_trlast=dip->last_track_ls;
+ dsp->ds_trfirst_ls=dip->first_track_ls;
}
LOCAL int
@@ -1259,6 +1469,30 @@
}
LOCAL int
+getdisktype_mdvd(scgp, dp)
+ SCSI *scgp;
+ cdr_t *dp;
+{
+ int ret;
+ dstat_t *dsp = dp->cdr_dstat;
+
+ struct track_info track_info;
+ if(getdisktype_mmc(scgp, dp)<0)
+ return -1;
+
+ /* read rzone info to get the space left on disk */
+ /*ds_trlast is the last rzone on disk, can be invisible */
+ if(read_rzone_info(scgp, (caddr_t)&track_info, sizeof(track_info))>=0)
+ dsp->ds_maxblocks=a_to_u_4_byte(track_info.free_blocks)+a_to_4_byte(track_info.next_writable_addr);
+
+ dsp->ds_disktype&= ~DT_CD;
+ dsp->ds_disktype|= DT_DVD;
+
+ return (ret);
+
+}
+
+LOCAL int
getdisktype_mmc(scgp, dp)
SCSI *scgp;
cdr_t *dp;
@@ -1762,6 +1996,68 @@
}
LOCAL int
+speed_select_mdvd(scgp, dp, speedp)
+ SCSI *scgp;
+ cdr_t *dp;
+ int *speedp;
+{
+ int retcode;
+ unsigned char perf_desc[28];
+ int write_speed = *speedp * 1385;
+ int val = 0, val2 = 0;
+ int i;
+
+/* For the moment we just divide the CD speed by 7*/
+
+ if(speedp!=NULL)
+ (*speedp)=(*speedp)*8;
+
+ memset(perf_desc, 0, sizeof(perf_desc));
+
+ /* Write Rotation Control = ROTCTL_CLV
+ * | Restore Logical Unit Defaults = 0
+ * | Exact = 0
+ * | Random Access = 0)
+ */
+ perf_desc[0]= ROTCTL_CLV << 3 | 0 << 2 | 0 << 1 | 0;
+ /* Start LBA to 0 */
+ perf_desc[4] = 0;
+ perf_desc[5] = 0;
+ perf_desc[6] = 0;
+ perf_desc[7] = 0;
+ /* End LBA set to 0 (setting to 0xffffffff failed on my LG burner
+ */
+ perf_desc[8] = 0;
+ perf_desc[9] = 0;
+ perf_desc[10] = 0;
+ perf_desc[11] = 0;
+ /* Read Speed = 0xFFFF */
+ perf_desc[12] = 0;
+ perf_desc[13] = 0;
+ perf_desc[14] = 0xFF;
+ perf_desc[15] = 0xFF;
+ /* Read Time = 1s */
+ perf_desc[18] = 1000 >> 8;
+ perf_desc[19] = 1000 & 0xFF;
+ /* Write Speed */
+ perf_desc[20] = write_speed >> 24;
+ perf_desc[21] = write_speed >> 16 & 0xFF;
+ perf_desc[22] = write_speed >> 8 & 0xFF;
+ perf_desc[23] = write_speed & 0xFF;
+ /* Write Time = 1s */
+ perf_desc[26] = 1000 >> 8;
+ perf_desc[27] = 1000 & 0xFF;
+
+ //retcode = scsi_set_streaming(scgp, NULL, 0);
+ retcode = scsi_set_streaming(scgp, &perf_desc, sizeof(perf_desc));
+ if (retcode == -1) return retcode;
+ retcode = speed_select_mmc(scgp, dp, speedp);
+ if(speedp!=NULL)
+ (*speedp)=(*speedp)/7;
+ return retcode;
+}
+
+LOCAL int
next_wr_addr_mmc(scgp, trackp, ap)
SCSI *scgp;
track_t *trackp;
@@ -1898,6 +2194,48 @@
};
LOCAL int
+next_wr_addr_mdvd(scgp, trackp, ap)
+ SCSI *scgp;
+ track_t *trackp;
+ long *ap;
+{
+ int track;
+ struct track_info track_info;
+ long next_addr;
+ int result = -1;
+ struct disk_info disk_info;
+ if (trackp){
+ track = trackp->trackno;
+ }
+
+ if (trackp != 0 && track > 0 && is_packet(trackp)) {
+ scgp->silent++;
+ result = read_rzone_info(scgp, (caddr_t)&track_info, sizeof(track_info));
+ scgp->silent--;
+ if (scsi_in_progress(scgp)){
+ return -1;
+ }
+
+ }
+
+ if (result < 0) {
+ /* Get the last rzone*/
+ if(read_disk_info(scgp,(caddr_t)&disk_info,8)<0)
+ return (-1);
+
+ if (read_rzone_info(scgp, (caddr_t)&track_info, sizeof(track_info)) < 0)
+ return (-1);
+ }
+ if (scgp->verbose)
+ scg_prbytes("track info:", (Uchar *)&track_info,
+ sizeof(track_info)-scg_getresid(scgp));
+ next_addr = a_to_4_byte(track_info.next_writable_addr);
+ if (ap)
+ *ap = next_addr;
+ return (0);
+}
+
+LOCAL int
open_track_mmc(scgp, dp, trackp)
SCSI *scgp;
cdr_t *dp;
@@ -1978,6 +2316,45 @@
}
LOCAL int
+open_track_mdvd(scgp, dp, trackp)
+ SCSI *scgp;
+ cdr_t *dp;
+ track_t *trackp;
+{
+ Uchar mode[0x100];
+ int len;
+ struct cd_mode_page_05 *mp;
+
+ if (is_packet(trackp)) {
+ fillbytes((caddr_t)mode, sizeof(mode), '\0');
+
+ if (!get_mode_params(scgp, 0x05, "DVD write parameter",
+ mode, (Uchar *)0, (Uchar *)0, (Uchar *)0, &len))
+ return (-1);
+ if (len == 0)
+ return (-1);
+
+ mp = (struct cd_mode_page_05 *)
+ (mode + sizeof(struct scsi_mode_header) +
+ ((struct scsi_mode_header *)mode)->blockdesc_len);
+
+ mp->write_type = WT_PACKET;
+ mp->LS_V = 1;
+ /*For now we set the link size to 0x10(32k) because Pioneer-A03 only support this */
+ mp->link_size=0x10;
+ mp->fp = 1;
+ i_to_4_byte(mp->packet_size, trackp->pktsize);
+ } else {
+ return 0;
+ }
+
+ if (!set_mode_params(scgp, "CD write parameter", mode, len, 0, trackp->secsize))
+ return (-1);
+
+ return (0);
+}
+
+LOCAL int
close_track_mmc(scgp, dp, trackp)
SCSI *scgp;
cdr_t *dp;
@@ -2003,6 +2380,30 @@
return (0);
}
+LOCAL int
+close_track_mdvd(scgp, dp, trackp)
+ SCSI *scgp;
+ cdr_t *dp;
+ track_t *trackp;
+{
+ int ret;
+ if (!is_packet(trackp))
+ return (0);
+
+ if (scsi_flush_cache(scgp, (dp->cdr_cmdflags&F_IMMED) != 0) < 0) {
+ printf("Trouble flushing the cache\n");
+ return -1;
+ }
+ wait_unit_ready(scgp, 300); /* XXX Wait for ATAPI */
+ if (is_packet(trackp) && !is_noclose(trackp)) {
+ /* close the incomplete track */
+ ret = scsi_close_tr_session(scgp, 1, 0xFF, (dp->cdr_cmdflags&F_IMMED) != 0);
+ wait_unit_ready(scgp, 300); /* XXX Wait for ATAPI */
+ return (ret);
+ }
+ return (0);
+}
+
int toc2sess[] = {
SES_DA_ROM, /* CD-DA */
SES_DA_ROM, /* CD-ROM */
@@ -2086,6 +2487,80 @@
}
LOCAL int
+open_session_mdvd(scgp, dp, trackp)
+ SCSI *scgp;
+ cdr_t *dp;
+ track_t *trackp;
+{
+ Uchar mode[0x100];
+ int tracks = trackp->tracks;
+
+ int len;
+ struct cd_mode_page_05 *mp;
+ Ulong totalsize;
+ int i;
+ struct track_info track_info;
+
+ fillbytes((caddr_t)mode, sizeof(mode), '\0');
+
+ if (!get_mode_params(scgp, 0x05, "DVD write parameter",
+ mode, (Uchar *)0, (Uchar *)0, (Uchar *)0, &len))
+ return (-1);
+ if (len == 0)
+ return (-1);
+
+ mp = (struct cd_mode_page_05 *)
+ (mode + sizeof(struct scsi_mode_header) +
+ ((struct scsi_mode_header *)mode)->blockdesc_len);
+ if(is_packet(trackp)){
+ mp->write_type=WT_PACKET;
+ mp->multi_session = (track_base(trackp)->tracktype & TOCF_MULTI) ? MS_MULTI : MS_NONE;
+ mp->fp=0;
+ mp->BUFE=1;
+ mp->track_mode=1;
+ }else{
+ mp->write_type = WT_SAO;
+ }
+
+
+ if (lverbose && dp->cdr_cdcap->BUF != 0)
+ printf("BURN-Free is %s.\n", mp->BUFE?"ON":"OFF");
+ if (driveropts != NULL) {
+ if ((strcmp(driveropts, "burnproof") == 0 ||
+ strcmp(driveropts, "burnfree") == 0) && dp->cdr_cdcap->BUF != 0) {
+ errmsgno(EX_BAD, "Turning BURN-Free on\n");
+ mp->BUFE = 1;
+ } else if ((strcmp(driveropts, "noburnproof") == 0 ||
+ strcmp(driveropts, "noburnfree") == 0)) {
+ errmsgno(EX_BAD, "Turning BURN-Free off\n");
+ mp->BUFE = 0;
+ } else if (strcmp(driveropts, "help") == 0) {
+ mmc_opthelp(dp, 0);
+ } else {
+ errmsgno(EX_BAD, "Bad driver opts '%s'.\n", driveropts);
+ mmc_opthelp(dp, EX_BAD);
+ }
+ }
+
+
+ if (!set_mode_params(scgp, "DVD write parameter", mode, len, 0, -1))
+ return (-1);
+
+
+ totalsize=0;
+ for(i=1;i<=tracks;i++) {
+ totalsize+=trackp[i].tracksecs;
+ }
+
+ if(!is_packet(trackp)){
+ /* in DAO mode we need to reserve space for the track*/
+ if(reserve_track(scgp, totalsize)<0)
+ return (-1);
+ }
+ return (0);
+}
+
+LOCAL int
waitfix_mmc(scgp, secs)
SCSI *scgp;
int secs;
@@ -2215,6 +2690,25 @@
return (ret);
}
+LOCAL int
+fixate_mdvd(scgp, dp, trackp)
+ SCSI *scgp;
+ cdr_t *dp;
+ track_t *trackp;
+{
+ /*set a really BIG timeout and call fixate_mmc
+ The BIG timeout is needed in case there was a very short rzone to write at the
+ beginning of the disk, because lead-out needs to be at some distance.
+ */
+ scg_settimeout(scgp, 1000);
+ if(is_packet(trackp)){
+ scsi_close_tr_session(scgp, 2, 0, FALSE);
+ }
+ fixate_mmc(scgp, dp, trackp);
+ scg_settimeout(scgp, 200);
+
+}
+
char *blank_types[] = {
"entire disk",
"PMA, TOC, pregap",
@@ -2453,6 +2947,42 @@
}
LOCAL int
+opt1_mdvd(scgp, dp)
+ SCSI *scgp;
+ cdr_t *dp;
+{
+ int oflags = dp->cdr_dstat->ds_cdrflags;
+
+ if ((dp->cdr_dstat->ds_cdrflags & RF_AUDIOMASTER) != 0) {
+ printf("Turning Audio Master Q. R. on\n");
+ if (set_audiomaster_yamaha(scgp, dp, TRUE) < 0)
+ return (-1);
+ if (!debug && lverbose <= 1)
+ dp->cdr_dstat->ds_cdrflags &= ~RF_PRATIP;
+ if (getdisktype_mdvd(scgp, dp) < 0) {
+ dp->cdr_dstat->ds_cdrflags = oflags;
+ return (-1);
+ }
+ dp->cdr_dstat->ds_cdrflags = oflags;
+ if (oflags & RF_PRATIP) {
+ msf_t msf;
+ lba_to_msf(dp->cdr_dstat->ds_first_leadin, &msf);
+ printf("New start of lead in: %ld (%02d:%02d/%02d)\n",
+ (long)dp->cdr_dstat->ds_first_leadin,
+ msf.msf_min,
+ msf.msf_sec,
+ msf.msf_frame);
+ lba_to_msf(dp->cdr_dstat->ds_maxblocks, &msf);
+ printf("New start of lead out: %ld (%02d:%02d/%02d)\n",
+ (long)dp->cdr_dstat->ds_maxblocks,
+ msf.msf_min,
+ msf.msf_sec,
+ msf.msf_frame);
+ }
+ }
+ return (0);
+}
+LOCAL int
scsi_sony_write(scgp, bp, sectaddr, size, blocks, islast)
SCSI *scgp;
caddr_t bp; /* address of buffer */
diff -u -r -3 cdrtools-2.01/cdrecord/scsi_cdr.c cdrtools-2.01.ossdvd/cdrecord/scsi_cdr.c
--- cdrtools-2.01/cdrecord/scsi_cdr.c 2004-05-25 00:36:01.000000000 +0200
+++ cdrtools-2.01.ossdvd/cdrecord/scsi_cdr.c 2004-08-27 05:46:33.000000000 +0200
@@ -107,6 +107,7 @@
EXPORT int send_cue_sheet __PR((SCSI *scgp, caddr_t bp, long size));
EXPORT int read_buff_cap __PR((SCSI *scgp, long *, long *));
EXPORT int scsi_blank __PR((SCSI *scgp, long addr, int blanktype, BOOL immed));
+EXPORT int scsi_set_streaming __PR((SCSI *scgp, caddr_t addr, int size));
EXPORT BOOL allow_atapi __PR((SCSI *scgp, BOOL new));
EXPORT int mode_select __PR((SCSI *scgp, Uchar *, int, int, int));
EXPORT int mode_sense __PR((SCSI *scgp, Uchar *dp, int cnt, int page, int pcf));
@@ -519,6 +520,32 @@
}
EXPORT int
+scsi_set_streaming(scgp, perf_desc, size)
+ SCSI *scgp;
+ caddr_t perf_desc;
+ int size;
+{
+ register struct scg_cmd *scmd = scgp->scmd;
+
+ fillbytes((caddr_t)scmd, sizeof (*scmd), '\0');
+ scmd->addr = perf_desc;
+ scmd->size = size;
+ scmd->flags = SCG_DISRE_ENA;
+ scmd->cdb_len = SC_G5_CDBLEN;
+ scmd->sense_len = CCS_SENSE_LEN;
+ scmd->cdb.g5_cdb.cmd = 0xB6;
+ scmd->cdb.cmd_cdb[11] = 0;
+ scmd->cdb.cmd_cdb[10] = size;
+
+ scgp->cmdname = "set streaming";
+
+ printf("scsi_set_streaming\n");
+ if (scg_cmd(scgp) < 0)
+ return (-1);
+ return (0);
+}
+
+EXPORT int
scsi_set_speed(scgp, readspeed, writespeed, rotctl)
SCSI *scgp;
int readspeed;
@@ -1042,6 +1069,32 @@
return (0);
}
+
+EXPORT int
+reserve_track(scgp, size)
+ SCSI *scgp;
+ Ulong size;
+
+{
+ register struct scg_cmd *scmd = scgp->scmd;
+
+ fillbytes((caddr_t)scmd, sizeof(*scmd), '\0');
+ scmd->flags = SCG_DISRE_ENA;
+ scmd->cdb_len = SC_G1_CDBLEN;
+ scmd->sense_len = CCS_SENSE_LEN;
+ scmd->cdb.g1_cdb.cmd = 0x53;
+ scmd->cdb.g1_cdb.lun = scg_lun(scgp);
+ i_to_4_byte(&scmd->cdb.g1_cdb.addr[3], size);
+
+ scgp->cmdname = "reserve track";
+
+ if (scg_cmd(scgp) < 0)
+ return (-1);
+
+ return (0);
+
+}
+
EXPORT int
read_rzone_info(scgp, bp, cnt)
SCSI *scgp;
diff -u -r -3 cdrtools-2.01/include/utypes.h cdrtools-2.01.ossdvd/include/utypes.h
--- cdrtools-2.01/include/utypes.h 2003-06-15 23:41:23.000000000 +0200
+++ cdrtools-2.01.ossdvd/include/utypes.h 2004-08-27 07:13:09.076574488 +0200
@@ -75,6 +75,25 @@
typedef unsigned char Uchar;
/*
+ * Added these cause Linux distro's using kernel 2.6.x seems
+ * to want them.
+ */
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+#if defined(__GNUC__) /* this is defined gcc-3.x */
+typedef unsigned long long u64;
+#endif
+
+/*
+ * Dodge the __attribute_const__ out of sneaky kernel includes.
+ * cdrtools is a userland program, so no kernel attribute's
+ */
+#ifndef __attribute_const__
+# define __attribute_const__ /* unimplemented */
+#endif
+
+/*
* This is a definition for a compiler dependant 64 bit type.
* It currently is silently a long if the compiler does not
* support it. Check if this is the right way.
diff -u -r -3 cdrtools-2.01/cdda2wav/interface.c cdrtools-2.01.ossdvd/cdda2wav/interface.c
--- cdrtools-2.01/cdda2wav/interface.c 2004-06-07 11:49:18.000000000 +0200
+++ cdrtools-2.01.ossdvd/cdda2wav/interface.c 2004-08-27 05:35:20.000000000 +0200
@@ -44,6 +44,7 @@
#include <assert.h>
#include <schily.h>
#include <device.h>
+#include <utypes.h>
#include <sys/ioctl.h>
#include <statdefs.h>
@@ -79,7 +80,6 @@
#include "exitcodes.h"
#include "scsi_cmds.h"
-#include <utypes.h>
#include <cdrecord.h>
#include "scsi_scan.h"
diff -u -r -3 cdrtools-2.01/cdda2wav/ioctl.c cdrtools-2.01.ossdvd/cdda2wav/ioctl.c
--- cdrtools-2.01/cdda2wav/ioctl.c 2003-12-27 17:29:28.000000000 +0100
+++ cdrtools-2.01.ossdvd/cdda2wav/ioctl.c 2004-08-27 05:37:59.000000000 +0200
@@ -28,6 +28,7 @@
#include <statdefs.h>
#include <schily.h>
#include <device.h>
+#include <utypes.h>
#include <scg/scsitransp.h>
@@ -55,7 +56,6 @@
#include "global.h"
#include "exitcodes.h"
-#include <utypes.h>
#include <cdrecord.h>
#if defined (HAVE_IOCTL_INTERFACE)