Index: burn-medium.c
===================================================================
--- burn-medium.c	(revision 1626)
+++ burn-medium.c	(working copy)
@@ -1391,6 +1391,46 @@
 }
 
 static BraseroBurnResult
+brasero_medium_track_set_leadout_CDR_blank (BraseroMedium *self,
+					    BraseroDeviceHandle *handle,
+					    BraseroMediumTrack *leadout,
+					    BraseroScsiErrCode *code)
+{
+	BraseroScsiAtipData *atip = NULL;
+	BraseroMediumPrivate *priv;
+	BraseroScsiResult result;
+	int size = 0;
+
+	priv = BRASERO_MEDIUM_PRIVATE (self);
+
+	BRASERO_BURN_LOG ("Using fallback method for blank CDR to retrieve NWA and leadout information");
+
+	/* NWA is easy for blank CDRs, it's 0. So far, so good... */
+	priv->next_wr_add = 0;
+
+	result = brasero_mmc1_read_atip (handle, &atip, &size, code);
+	if (result != BRASERO_SCSI_OK) {
+		BRASERO_BURN_LOG ("READ ATIP failed");
+		return BRASERO_BURN_ERR;
+	}
+
+	leadout->blocks_num = atip->desc->leadout_mn * 60 * 75 +
+			      atip->desc->leadout_sec * 75 +
+			      atip->desc->leadout_frame;
+
+	/* of course it starts at 0 since it's empty */
+	leadout->start = 0;
+
+	BRASERO_BURN_LOG ("Leadout (through READ ATIP): start = %llu size = %llu",
+			  leadout->start,
+			  leadout->blocks_num);
+
+	g_free (atip);
+
+	return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
 brasero_medium_track_set_leadout (BraseroMedium *self,
 				  BraseroDeviceHandle *handle,
 				  BraseroMediumTrack *leadout,
@@ -1426,17 +1466,51 @@
 		g_free (data);
 
 		BRASERO_BURN_LOG ("MODE SENSE failed");
+
+		/* This only for CD-R */
+		if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_CDR|BRASERO_MEDIUM_BLANK))
+			return brasero_medium_track_set_leadout_CDR_blank (self,
+									   handle,
+									   leadout,
+									   code);
+
 		return BRASERO_BURN_ERR;
 	}
 
 	wrt_page = (BraseroScsiWritePage *) &data->page;
+	BRASERO_BURN_LOG ("Former write type %d", wrt_page->write_type);
+	BRASERO_BURN_LOG ("Former track mode %d", wrt_page->track_mode);
+	BRASERO_BURN_LOG ("Former data block type %d", wrt_page->data_block_type);
+
+	/* "reset some stuff to be on the safe side" (words and ideas
+	 * taken from k3b:)). */
+	wrt_page->ps = 0;
+	wrt_page->BUFE = 0;
+	wrt_page->multisession = 0;
+	wrt_page->testwrite = 0;
+	wrt_page->LS_V = 0;
+	wrt_page->copy = 0;
+	wrt_page->FP = 0;
+	wrt_page->session_format = 0;
+	BRASERO_SET_16 (wrt_page->pause_len, 150);
+
 	wrt_page->write_type = BRASERO_SCSI_WRITE_TAO;
+	wrt_page->track_mode = 4; /* should be 5 for DVD-R(W) */
+	wrt_page->data_block_type = 8;
 
 	result = brasero_spc1_mode_select (handle, data, size, code);
 	g_free (data);
 
 	if (result != BRASERO_SCSI_OK) {
 		BRASERO_BURN_LOG ("MODE SELECT failed");
+
+		/* This only for CD-R */
+		if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_CDR|BRASERO_MEDIUM_BLANK))
+			return brasero_medium_track_set_leadout_CDR_blank (self,
+									   handle,
+									   leadout,
+									   code);
+
 		return BRASERO_BURN_ERR;
 	}
 
@@ -1470,6 +1544,14 @@
 
 	if (result != BRASERO_SCSI_OK) {
 		BRASERO_BURN_LOG ("READ TRACK INFO failed");
+
+		/* This only for CD-R */
+		if (BRASERO_MEDIUM_IS (priv->info, BRASERO_MEDIUM_CDR|BRASERO_MEDIUM_BLANK))
+			return brasero_medium_track_set_leadout_CDR_blank (self,
+									   handle,
+									   leadout,
+									   code);
+
 		return BRASERO_BURN_ERR;
 	}
 
Index: scsi-write-page.h
===================================================================
--- scsi-write-page.h	(revision 1626)
+++ scsi-write-page.h	(working copy)
@@ -51,7 +51,7 @@
 	uchar FP		:1;
 	uchar multisession	:2;
 
-	uchar book_type		:4;
+	uchar data_block_type	:4;
 	uchar reserved2		:4;
 
 	uchar link_size;
@@ -102,7 +102,7 @@
 	uchar track_mode	:4;
 
 	uchar reserved2		:4;
-	uchar book_type		:4;
+	uchar data_block_type	:4;
 
 	uchar link_size;
 
