[Goodies-commits] r6778 - in xfburn/trunk: . xfburn

David Mohr squisher at xfce.org
Wed Feb 25 02:52:55 CET 2009


Author: squisher
Date: 2009-02-25 01:52:55 +0000 (Wed, 25 Feb 2009)
New Revision: 6778

Modified:
   xfburn/trunk/NEWS
   xfburn/trunk/xfburn/xfburn-device-list.c
   xfburn/trunk/xfburn/xfburn-hal-manager.c
Log:
Falling back to libburn device detection if hal does not find any. Remove unecessary checks, and output to the console drives which are not burners

Modified: xfburn/trunk/NEWS
===================================================================
--- xfburn/trunk/NEWS	2009-02-24 23:31:26 UTC (rev 6777)
+++ xfburn/trunk/NEWS	2009-02-25 01:52:55 UTC (rev 6778)
@@ -8,7 +8,8 @@
 - Bump libburn version requirement to 0.5.6, since earlier versions might
   trigger a crash in libburn's fifo code. Version 0.4.2 or later will work,
   aside from this problem.
-- Correctly detect some burners for which HAL reported unexpected values
+- Correctly detect some burners for which HAL reported unexpected values.
+- Fall back to libburn-based burner detection if HAL does not find any.
 - A man page is now included.
 
 

Modified: xfburn/trunk/xfburn/xfburn-device-list.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-list.c	2009-02-24 23:31:26 UTC (rev 6777)
+++ xfburn/trunk/xfburn/xfburn-device-list.c	2009-02-25 01:52:55 UTC (rev 6778)
@@ -198,6 +198,9 @@
     if (can_burn) {
       devices = g_list_append (devices, device);
       n_burners++;
+    } else {
+      g_message ("Ignoring reader '%s' at '%s'", device->name, device->addr);
+      g_free (device);
     }
   }
 
@@ -310,8 +313,12 @@
 
 #ifdef HAVE_HAL
   n_drives = xfburn_hal_manager_get_devices (halman, &devices);
-  if (n_drives == -1) {
-    /* some error occurred while checking hal properties, so try libburn instead */
+  if (n_drives < 1) {
+    /* if some error occurred while checking hal properties,
+       or hal for some reason did not find a device, then just
+       fall back on libburn */
+    g_message ("HAL said there are %d burners, checking libburn if it can detect any", n_drives);
+
     n_drives = get_libburn_device_list ();
   }
 #else
@@ -337,13 +344,13 @@
 
   /* we need to try to grab several times, because
    * the drive might be busy detecting the disc */
-  for (i=0; i<max_checks; i++) {
+  for (i=1; i<=max_checks; i++) {
     ret = burn_drive_scan_and_grab (drive_info, drive_addr, 0);
     //DBG ("grab (%s)-> %d", drive_addr, ret);
     if (ret > 0)
       break;
-    else if  (i < (max_checks-1))
-      usleep((i+1)*100001);
+    else if  (i < max_checks)
+      usleep(i*100001);
   }
 
   if (ret <= 0) {

Modified: xfburn/trunk/xfburn/xfburn-hal-manager.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-hal-manager.c	2009-02-24 23:31:26 UTC (rev 6777)
+++ xfburn/trunk/xfburn/xfburn-hal-manager.c	2009-02-25 01:52:55 UTC (rev 6778)
@@ -331,7 +331,6 @@
     dbus_bool_t exists;
     char **cap_list, **caps;
     gboolean optical_drive = FALSE;
-    int write_speed;
 
     exists = libhal_device_property_exists (priv->hal_context, *devices, "info.capabilities", &error);
     if (dbus_error_is_set (&error)) {
@@ -362,13 +361,6 @@
         if (!exists)
           break;
 
-        write_speed = libhal_device_get_property_int (priv->hal_context, *devices, "storage.cdrom.write_speed", &error);
-        if (dbus_error_is_set (&error)) {
-          g_warning ("Error getting HAL property for %s: %s", *devices, error.message);
-          dbus_error_free (&error);
-          return -1;
-        }
-
         optical_drive = TRUE;
       }
     }
@@ -469,7 +461,7 @@
       }
 
       if (!XFBURN_DEVICE_LIST_CAN_BURN_CONDITION (device)) {
-        DBG ("Ignoring reader '%s' at '%s'", device->name, device->addr);
+        g_message ("Ignoring reader '%s' at '%s'", device->name, device->addr);
         g_free (device);
         continue;
       }




More information about the Goodies-commits mailing list