[Debburn-changes] r679 - cdrkit/trunk/wodim

Eduard Bloch blade at alioth.debian.org
Sat Jan 6 14:15:53 CET 2007


Author: blade
Date: 2007-01-06 14:15:52 +0100 (Sat, 06 Jan 2007)
New Revision: 679

Modified:
   cdrkit/trunk/wodim/drv_mmc.c
   cdrkit/trunk/wodim/wodim.c
Log:
Extract drive's default speed setting in attach_mdvd(), made after after attach_mmc(); DVD speed should be set to a sane default now

Modified: cdrkit/trunk/wodim/drv_mmc.c
===================================================================
--- cdrkit/trunk/wodim/drv_mmc.c	2007-01-06 10:21:03 UTC (rev 678)
+++ cdrkit/trunk/wodim/drv_mmc.c	2007-01-06 13:15:52 UTC (rev 679)
@@ -936,19 +936,39 @@
 static int 
 attach_mdvd(SCSI *usalp, cdr_t *dp)
 {
-        struct  cd_mode_page_2A *mp;
-	
+	struct  cd_mode_page_2A *mp;
 
-        allow_atapi(usalp, TRUE);/* Try to switch to 10 byte mode cmds */
 
-        usalp->silent++;
-        mp = mmc_cap(usalp, NULL);/* Get MMC capabilities in allocated mp */
-        usalp->silent--;
-        if (mp == NULL)
-                return (-1);    /* Pre SCSI-3/mmc drive         */
+	allow_atapi(usalp, TRUE);/* Try to switch to 10 byte mode cmds */
 
-        dp->cdr_cdcap = mp;     /* Store MMC cap pointer        */
+	usalp->silent++;
+	mp = mmc_cap(usalp, NULL);/* Get MMC capabilities in allocated mp */
+	usalp->silent--;
+	if (mp == NULL)
+		return (-1);    /* Pre SCSI-3/mmc drive         */
 
+	dp->cdr_cdcap = mp;     /* Store MMC cap pointer        */
+
+	dp->cdr_dstat->ds_dr_max_rspeed = a_to_u_2_byte(mp->max_read_speed)/1385;
+	if (dp->cdr_dstat->ds_dr_max_rspeed == 0) /* EB: does that make sense? Looks like a smellin workaround for a rare case, but it should not hurt */
+		dp->cdr_dstat->ds_dr_max_rspeed = 1385;
+	dp->cdr_dstat->ds_dr_cur_rspeed = a_to_u_2_byte(mp->cur_read_speed)/1385;
+	if (dp->cdr_dstat->ds_dr_cur_rspeed == 0) /* EB: does that make sense? Looks like a smellin workaround for a rare case, but it should not hurt */
+		dp->cdr_dstat->ds_dr_cur_rspeed = 1385;
+
+	dp->cdr_dstat->ds_dr_max_wspeed = a_to_u_2_byte(mp->max_write_speed)/1385;
+	if (mp->p_len >= 28)
+		dp->cdr_dstat->ds_dr_cur_wspeed = a_to_u_2_byte(mp->v3_cur_write_speed)/1385;
+	else
+		dp->cdr_dstat->ds_dr_cur_wspeed = a_to_u_2_byte(mp->cur_write_speed)/1385;
+
+	if (dp->cdr_speedmax > dp->cdr_dstat->ds_dr_max_wspeed)
+		dp->cdr_speedmax = dp->cdr_dstat->ds_dr_max_wspeed;
+
+	if (dp->cdr_speeddef > dp->cdr_speedmax)
+		dp->cdr_speeddef = dp->cdr_speedmax;
+
+
         if (mp->loading_type == LT_TRAY)
                 dp->cdr_flags |= CDR_TRAYLOAD;
         else if (mp->loading_type == LT_CADDY)

Modified: cdrkit/trunk/wodim/wodim.c
===================================================================
--- cdrkit/trunk/wodim/wodim.c	2007-01-06 10:21:03 UTC (rev 678)
+++ cdrkit/trunk/wodim/wodim.c	2007-01-06 13:15:52 UTC (rev 679)
@@ -691,6 +691,7 @@
 	usalp->silent--;
 
 	dma_speed = get_dmaspeed(usalp, dp);
+
 	if ((debug || lverbose) && dma_speed > 0) {
 		/*
 		 * We do not yet know what medium type is in...
@@ -1007,6 +1008,7 @@
 
 #endif
 	}
+
 	if ((*dp->cdr_set_speed_dummy)(usalp, dp, &speed) < 0) {
 		errmsgno(EX_BAD, "Cannot set speed/dummy.\n");
 		if ((flags & F_FORCE) == 0)
@@ -1042,9 +1044,9 @@
 		}
 	}
 	if (tracks > 0 && (flags & F_WRITE) != 0 && dma_speed > 0) {
-		int max_dma = (flags & F_FORCE) != 0 ? dma_speed:(dma_speed+1)*4/5;
+		int max_dma = (dma_speed+1)*4/5; /* use an empirical formula to estimate available bandwith */
 
-		if (getenv("CDR_FORCESPEED"))
+        if((flags & F_FORCE) != 0 || getenv("CDR_FORCESPEED"))
 			max_dma = dma_speed;
 
 		if (speed > max_dma) {




More information about the Debburn-changes mailing list