login
Header Space

 
 

bin/123693: Workaround for burncd: ioctl(CDIOCEJECT): Input/output error

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <freebsd-gnats-submit@...>
Date: Wednesday, May 14, 2008 - 11:39 pm

>Number:         123693
-
FreeBSD casantos 7.0-STABLE FreeBSD 7.0-STABLE #1: Fri Apr 25 03:02:38 BRT 2008     root@casantos:/share/FreeBSD/src/sys/i386/compile/HP_NX6320  i386
I get "burncd: ioctl(CDIOCEJECT): Input/output error" each time I attempt to blank a CDRW with

    burncd -f /dev/acd0 blank eject

I noticed that this does not happen when I write a data cd with

    burncd -f /dev/acd0 data cd-image.iso fixate eject

I have seen the same bahavior on 4 different computers that have DVD-RW units. It seems that it is necessary to give some time to the writer in order to let it stabilize before attempting to eject the disk.

Run "burncd -f /dev/acd0 blank eject" on a Compaq nx6320 notebook with FreeBSD 7.0-STABLE installed. I have seen the same problem on 6.x releases.
Applying the attached patch to /usr/src/usr.sbin/burncd/burncd.c solves the problem. It makes burncd attempt to eject the CD five times, sleeping for one second after each unccessful try.

Patch attached with submission follows:

--- burncd.c.orig	2005-05-13 17:06:44.000000000 -0300
+++ burncd.c	2008-05-12 01:44:30.000000000 -0300
@@ -46,6 +46,7 @@
 #include <arpa/inet.h>
 
 #define BLOCKS	16
+#define EJECT_TRIES 5
 
 struct track_info {
 	int	file;
@@ -316,9 +317,13 @@
 		err(EX_IOERR, "ioctl(CDRIOCSETBLOCKSIZE)");
 	}
 
-	if (eject)
-		if (ioctl(fd, CDIOCEJECT) < 0)
+	if (eject) {
+		int status, i = 0;
+		while ((status = ioctl(fd, CDIOCEJECT)) < 0 && ++i <= EJECT_TRIES)
+			sleep(1);
+		if (status < 0)
 			err(EX_IOERR, "ioctl(CDIOCEJECT)");
+	}
 	close(fd);
 	exit(EX_OK);
 }


_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
bin/123693: Workaround for burncd: ioctl(CDIOCEJECT): Input/..., Carlos Santos, (Wed May 14, 11:39 pm)
speck-geostationary