Bug#330660: nautilus-cd-burner: Patch to fix this bug

Jason D. Hildebrand jason at peaceworks.ca
Fri Dec 16 16:52:37 UTC 2005


Package: nautilus-cd-burner
Version: 2.10.2-2
Followup-For: Bug #330660

I've resolved this issue and have submitted the patch upstream.  The short
summary is that this affects older CD burners which support the MMC-1 command
set, but not the MMC-2 command set.  I'm not sure how many users are affected,
but FWIW my drive is from 2001 and falls into this category.

The upstream bug report has more analysis and details:
    http://bugzilla.gnome.org/show_bug.cgi?id=317529

The patch has been applied to HEAD and gnome-2-12.  I don't know what
the timeline is for getting Gnome 2.12 into Debian, but assuming that
will take some time, please consider applying it to the 2.10.2 package 
currently in testing/unstable (attached below).

peace,
Jason

--- nautilus-cd-burner-2.10.2.orig/nautilus-burn-drive.c
+++ nautilus-cd-burner-2.10.2/nautilus-burn-drive.c
@@ -594,10 +596,13 @@
                                if (hal_type != NULL)
                                        hal_free_string (hal_type);
                        }
-
                        hal_free_string_array (device_names);

-                       return type;
+            /* if the type has been determined using HAL, return it.
+               Otherwise, fall through and try the non-HAL approach. */
+            if (type != NAUTILUS_BURN_MEDIA_TYPE_UNKNOWN) {
+                return type;
+            }
                }
        }

--- nautilus-cd-burner-2.10.2.orig/dvd_plus_rw_utils.cpp
+++ nautilus-cd-burner-2.10.2/dvd_plus_rw_utils.cpp
@@ -166,7 +166,7 @@
   unsigned char buf[8],inq[128];
   unsigned char *sense=cmd.sense();
   int i;
-  int profile=0,once=1,blank=0,err;
+  int profile=0,once=1,blank=0,err,erasable=0;
   unsigned int len;

   /* For valgrind */
@@ -200,11 +200,13 @@
     cmd[9] = 0;
     if ((err=cmd.transport(READ,buf,sizeof(buf)))) {
       /*sperror ("GET CONFIGURATION",err);*/
-      /*fprintf (stderr,":-( non-MMC unit?\n");*/
-      goto bail;
+      /* this is not a fatal error -- some older drives support MMC-1
+       * but don't support the GET CONFIGURATION command (which is part
+       * of the MMC-2 spec). */
+    } else {
+       if ((profile = buf[6]<<8|buf[7]) || !once) break;
     }

-    if ((profile = buf[6]<<8|buf[7]) || !once) break;

     // no media?
     cmd[0] = 0;        // TEST UNIT READY
@@ -233,6 +235,24 @@

   // see if it's blank media
   if ((disc_info[2]&3) == 0)   blank=0x10000;
+
+  if (!profile ) {
+    /* if the profile has not yet been set, we're dealing with an older
+     * CD-R or CD-RW burner (which doesn't know the GET CONFIGURATION
+     * command.  Do some digging into the disc type to figure out what's
+     * in the drive */
+    erasable = ((disc_info[2] & 16));
+    if (blank && !erasable) {
+      profile = 0x09;  /* CD-R                        */
+    } else if (erasable) {
+      profile = 0x0a;  /* CD-RW                       */
+    } else if (disc_info[8] == 0x00) {
+      profile = 0x08;  /* Commercial CDs and Audio CD */
+    } else {
+      fprintf (stderr, "Could not determine profile or type of media\n");
+      goto bail;
+    }
+  }

   if (profile != 0x1A && profile != 0x13 && profile != 0x12)
     return blank|profile;





More information about the Pkg-gnome-maintainers mailing list