graveman-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Graveman-cvs] Changes to graveman/current/src/cdrecord.c


From: sylvain cresto
Subject: [Graveman-cvs] Changes to graveman/current/src/cdrecord.c
Date: Mon, 16 May 2005 21:16:41 -0400

Index: graveman/current/src/cdrecord.c
diff -u graveman/current/src/cdrecord.c:1.29 
graveman/current/src/cdrecord.c:1.30
--- graveman/current/src/cdrecord.c:1.29        Sun May 15 17:37:21 2005
+++ graveman/current/src/cdrecord.c     Tue May 17 01:16:34 2005
@@ -52,7 +52,6 @@
 #define CDRECORD_WRITE_DVD "Does write DVD-R media"
 #define CDRECORD_NOT_WRITE_DVD "Does not write DVD-R media"
 #define CDRECORD_NOT_WRITE_DUMMY "Does not support test writing"
-#define CDRECORD_WRITE_DUMMY "Does support test writing"
 #define CDRECORD_MAX_CDREAD_SPEED "Maximum read  speed:"
 #define CDRECORD_MAX_CDREAD_SPEED_CD "(CD"
 #define CDRECORD_MAX_CDREAD_SPEED_DVD " DVD "
@@ -81,27 +80,27 @@
     { "dev=/dev/hdj", "/dev/hdj", "IDE", 100 },
 #endif
 #if LINUX_SCSI  /* SCSI alias with linux */
-    { "dev=/dev/scd0", "/dev/scd0", "SCSID", 90 },
-    { "dev=/dev/scd1", "/dev/scd1", "SCSID", 90 },
-    { "dev=/dev/scd2", "/dev/scd2", "SCSID", 90 },
-    { "dev=/dev/scd3", "/dev/scd3", "SCSID", 90 },
-    { "dev=/dev/scd4", "/dev/scd4", "SCSID", 90 },
-    { "dev=/dev/scd5", "/dev/scd5", "SCSID", 90 },
-    { "dev=/dev/scd6", "/dev/scd6", "SCSID", 90 },
-    { "dev=/dev/sr0", "/dev/sr0",  "SCSIS", 92 },
-    { "dev=/dev/sr1", "/dev/sr1",  "SCSIS", 92 },
-    { "dev=/dev/sr2", "/dev/sr2",  "SCSIS", 92 },
-    { "dev=/dev/sr3", "/dev/sr3",  "SCSIS", 92 },
-    { "dev=/dev/sr4", "/dev/sr4",  "SCSIS", 92 },
-    { "dev=/dev/sr5", "/dev/sr5",  "SCSIS", 92 },
-    { "dev=/dev/sr6", "/dev/sr6",  "SCSIS", 92 },
-    { "dev=/dev/sg0", "/dev/sg0",  "SCSIG", 94 },
-    { "dev=/dev/sg1", "/dev/sg1",  "SCSIG", 94 },
-    { "dev=/dev/sg2", "/dev/sg2",  "SCSIG", 94 },
-    { "dev=/dev/sg3", "/dev/sg3",  "SCSIG", 94 },
-    { "dev=/dev/sg4", "/dev/sg4",  "SCSIG", 94 },
-    { "dev=/dev/sg5", "/dev/sg5",  "SCSIG", 94 },
-    { "dev=/dev/sg6", "/dev/sg6",  "SCSIG", 94 },
+    { "dev=/dev/scd0", "/dev/scd0", "SCSI-D", 90 },
+    { "dev=/dev/scd1", "/dev/scd1", "SCSI-D", 90 },
+    { "dev=/dev/scd2", "/dev/scd2", "SCSI-D", 90 },
+    { "dev=/dev/scd3", "/dev/scd3", "SCSI-D", 90 },
+    { "dev=/dev/scd4", "/dev/scd4", "SCSI-D", 90 },
+    { "dev=/dev/scd5", "/dev/scd5", "SCSI-D", 90 },
+    { "dev=/dev/scd6", "/dev/scd6", "SCSI-D", 90 },
+    { "dev=/dev/sr0", "/dev/sr0",  "SCSI-S", 92 },
+    { "dev=/dev/sr1", "/dev/sr1",  "SCSI-S", 92 },
+    { "dev=/dev/sr2", "/dev/sr2",  "SCSI-S", 92 },
+    { "dev=/dev/sr3", "/dev/sr3",  "SCSI-S", 92 },
+    { "dev=/dev/sr4", "/dev/sr4",  "SCSI-S", 92 },
+    { "dev=/dev/sr5", "/dev/sr5",  "SCSI-S", 92 },
+    { "dev=/dev/sr6", "/dev/sr6",  "SCSI-S", 92 },
+    { "dev=/dev/sg0", "/dev/sg0",  "SCSI-G", 94 },
+    { "dev=/dev/sg1", "/dev/sg1",  "SCSI-G", 94 },
+    { "dev=/dev/sg2", "/dev/sg2",  "SCSI-G", 94 },
+    { "dev=/dev/sg3", "/dev/sg3",  "SCSI-G", 94 },
+    { "dev=/dev/sg4", "/dev/sg4",  "SCSI-G", 94 },
+    { "dev=/dev/sg5", "/dev/sg5",  "SCSI-G", 94 },
+    { "dev=/dev/sg6", "/dev/sg6",  "SCSI-G", 94 },
 
 #endif
     { "dev=ATA:", "ATA:", "ATA", 60 }, /* ide sg */
@@ -132,7 +131,7 @@
 }
 
 /* recherche des lecteurs */
-gboolean extractlecteur(gchar *Achaine, gchar **Adev, gchar **Amarque, gchar 
**Amodel,
+gboolean cdrecord_extractlecteur(gchar *Achaine, gchar **Adev, gchar 
**Amarque, gchar **Amodel,
   gchar **Aquoi)
 {
   gchar *s = Achaine;
@@ -185,9 +184,9 @@
     
   g_strstrip(Lbuffer);  
 _DEB("scan lecteur = %s\n", Lbuffer);
-  if (extractlecteur(Lbuffer, &Ldev, &Lmarque, &Lmodel, &Lquoi) == TRUE) {
+  if (cdrecord_extractlecteur(Lbuffer, &Ldev, &Lmarque, &Lmodel, &Lquoi) == 
TRUE) {
 
-    insert_or_update_drive(Ldev, Lmarque, Lmodel, Lquoi, Ldrivedesc);
+    matos_insert_or_update_drive(Ldev, Lmarque, Lmodel, Lquoi, Ldrivedesc);
 
     _DEB("oui un lecteur");
     
@@ -215,7 +214,7 @@
   Tsearchdrive *Lcurentry;
   gint *Lcont = (gint *)sc_grave_get_data(Ag, "cont");
   gboolean *Labort = (gboolean *)sc_grave_get_data(Ag, "gabort");
-  
+
   free_drives(FALSE);
   for (Lcurentry = listesearchdrives; Lcurentry->detectline && *Labort == 
FALSE; Lcurentry++) {
     Lcommandline = g_strdup_printf("%s -scanbus %s", 
conf_get_string("cdrecord"), Lcurentry->detectline);
@@ -265,9 +264,18 @@
   gchar *scd = NULL, *sdvd = NULL, *f;
   gint Lexit = 0;
   gboolean Lstatus;
-  gint Ltype = 0;
 
-  Lcommandline = g_strdup_printf("%s -prcap dev=%s", 
conf_get_string("cdrecord"), Adev);
+  {
+    GSList *ab;
+gchar *abla;
+for (ab = Adrive->dev; ab; ab = g_slist_next(ab)) {
+  abla = ab->data;
+  fprintf(stderr, "==>%s\n", abla);
+}
+  }
+
+  Lcommandline = g_strdup_printf("%s -prcap dev=%s", 
conf_get_string("cdrecord"),
+      Adev ? Adev : DRIVE_DEV(Adrive));
 
 _DEB("==================%s\n", Lcommandline);  
   Lstatus = g_spawn_command_line_sync(Lcommandline, &Lout, &Lerr, &Lexit, 
Aerror);
@@ -278,12 +286,11 @@
     return FALSE;
   }
 
-  if (strstr(Lout, CDRECORD_READ_CD)) Ltype += _READ_CDR;
-  if (strstr(Lout, CDRECORD_WRITE_CDR)) Ltype += _WRITE_CDR;
-  if (strstr(Lout, CDRECORD_WRITE_CDRW)) Ltype += _WRITE_CDRW;
-  if (strstr(Lout, CDRECORD_WRITE_DUMMY)) Ltype += _WRITE_DUMMY;
-  if (strstr(Lout, CDRECORD_READ_DVD)) Ltype += _READ_DVD;
-  if (strstr(Lout, CDRECORD_WRITE_DVD)) Ltype += _WRITE_DVD;
+  if (strstr(Lout, CDRECORD_READ_CD)) Adrive->type |= _READ_CDR;
+  if (strstr(Lout, CDRECORD_WRITE_CDR)) Adrive->type |= _WRITE_CDR;
+  if (strstr(Lout, CDRECORD_WRITE_CDRW)) Adrive->type |= _WRITE_CDRW;
+  if (strstr(Lout, CDRECORD_READ_DVD)) Adrive->type |= _READ_DVD;
+  if (strstr(Lout, CDRECORD_WRITE_DVD)) Adrive->type |= _WRITE_DVD;
 
   /* vitesse de lecture maximum CD */
   if ((scd=strstr(Lout, CDRECORD_MAX_CDREAD_SPEED))) {
@@ -308,21 +315,21 @@
 
   if (!scd) return FALSE;
 
-  Adrive->type += Ltype; /* type: lecteur ou graveur */
   Adrive->vitesse = atoi(scd);  /* vitesse de lecture ou de gravure maximum */
   Adrive->vitessedvd = sdvd ? atoi(sdvd) : -1;
-  _DEB("== le type => %d\n", Ltype);
+  _DEB("== le type => %d\n", Adrive->type);
   _DEB("== donc la vitesse de lecture => %d\n", Adrive->vitesse  );
 
 
   /* ok maintenant on regarde si le lecteur supporte le burnfree, si oui on 
l'utilisera
    * lors des gravures */
-  Lcommandline = g_strdup_printf("%s -checkdrive dev=%s driveropts=help", 
conf_get_string("cdrecord"), Adev);
+  Lcommandline = g_strdup_printf("%s -checkdrive dev=%s driveropts=help", 
conf_get_string("cdrecord"),
+      Adev ? Adev : DRIVE_DEV(Adrive));
 _DEB("==================%s\n", Lcommandline);  
   Lstatus = g_spawn_command_line_sync(Lcommandline, &Lout, &Lerr, &Lexit, 
Aerror);
   g_free(Lcommandline);
   if (Lstatus == TRUE) {
-    if (strstr(Lout, CDRECORD_BURNFREE)) Ltype += _BURN_FREE;
+    if (strstr(Lout, CDRECORD_BURNFREE)) Adrive->type |= _BURN_FREE;
   }
   g_free(Lout);
   g_free(Lerr);
@@ -456,6 +463,10 @@
     g_free(Ltxt);
 
     Lblank = get_blank_type(Ag, Lmediadetect1);
+
+    /* try to umount device before device access */
+    matos_umount_device(Ldevice, NULL);
+
     Lcommandline = g_strdup_printf("%s dev=%s -v gracetime=2 %s%s %s %s %s %s 
%s %s %s %s '%s' %s",
         conf_get_string("cdrecord"), DRIVE_DEV(Ldevice),
         *Lbufvitesse != '0' ? "speed=" : "", *Lbufvitesse != '0' ? Lbufvitesse 
: "",  
@@ -883,6 +894,9 @@
       break;
     }
 
+    /* try to umount device before device access */
+    matos_umount_device(Ldevice, NULL);
+
     Lstatus = g_spawn_async_with_pipes(Lrepertoire, Lcmd, NULL, /* env 
argument */
         (GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD),
         NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror);
@@ -1036,6 +1050,9 @@
     return FALSE;
   }
 
+  /* try to umount device before device access */
+  matos_umount_device(Ldevice, NULL);
+
   Lstatus = g_spawn_async_with_pipes(NULL, Lcmd, NULL, /* env argument */
       (GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD),
        NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror);
@@ -1117,6 +1134,9 @@
     return FALSE;
   }
 
+  /* try to umount device before device access */
+  matos_umount_device(Ldevice, NULL);
+
   Lstatus = g_spawn_async_with_pipes(NULL, Lcmd, NULL, /* env argument */
       (GSpawnFlags ) (G_SPAWN_DO_NOT_REAP_CHILD),
        NULL, NULL, Lpid, NULL, &g_out, &g_err, Aerror);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]