brasero r1450 - in trunk: . src



Author: philippr
Date: Fri Oct 31 13:00:28 2008
New Revision: 1450
URL: http://svn.gnome.org/viewvc/brasero?rev=1450&view=rev

Log:
	Try to improve debugging to catch error with drive/medium initialization

	* src/burn-drive.c (brasero_drive_init_real):
	* src/burn-medium-monitor.c (brasero_medium_monitor_init):


Modified:
   trunk/ChangeLog
   trunk/src/burn-drive.c
   trunk/src/burn-medium-monitor.c

Modified: trunk/src/burn-drive.c
==============================================================================
--- trunk/src/burn-drive.c	(original)
+++ trunk/src/burn-drive.c	Fri Oct 31 13:00:28 2008
@@ -538,13 +538,19 @@
 	watch = brasero_hal_watch_get_default ();
 	ctx = brasero_hal_watch_get_ctx (watch);
 
-	priv->path = libhal_device_get_property_string (ctx, priv->udi, BLOCK_DEVICE, NULL);
+	priv->path = libhal_device_get_property_string (ctx,
+							priv->udi,
+							BLOCK_DEVICE,
+							NULL);
 	if (priv->path [0] == '\0') {
 		g_free (priv->path);
 		priv->path = NULL;
 	}
 
-	priv->block_path = libhal_device_get_property_string (ctx, priv->udi, "block.device", NULL);
+	priv->block_path = libhal_device_get_property_string (ctx,
+							      priv->udi,
+							      "block.device",
+							      NULL);
 	if (priv->block_path [0] == '\0') {
 		g_free (priv->block_path);
 		priv->block_path = NULL;
@@ -568,32 +574,27 @@
 		priv->caps |= BRASERO_DRIVE_CAPS_DVDRW_PLUS_DL;
 
 	/* Also get its parent to retrieve the bus, host, lun values */
+	priv->bus = -1;
+	priv->lun = -1;
+	priv->target = -1;
 	parent = libhal_device_get_property_string (ctx, priv->udi, "info.parent", NULL);
-	if (!parent) {
-		priv->bus = -1;
-		priv->lun = -1;
-		priv->target = -1;
-		return;
-	}
-
-	/* Check it is a SCSI interface */
-	if (!libhal_device_property_exists (ctx, parent, "scsi.host", NULL)
-	||  !libhal_device_property_exists (ctx, parent, "scsi.lun", NULL)
-	||  !libhal_device_property_exists (ctx, parent, "scsi.target", NULL)) {
-		g_free (parent);
-
-		priv->bus = -1;
-		priv->lun = -1;
-		priv->target = -1;
-		return;
-	}
-
-	priv->bus = libhal_device_get_property_int (ctx, parent, "scsi.host", NULL);
-	priv->lun = libhal_device_get_property_int (ctx, parent, "scsi.lun", NULL);
-	priv->target = libhal_device_get_property_int (ctx, parent, "scsi.target", NULL);
+	if (parent) {
+		/* Check it is a SCSI interface */
+		if (libhal_device_property_exists (ctx, parent, "scsi.host", NULL)
+		&&  libhal_device_property_exists (ctx, parent, "scsi.lun", NULL)
+		&&  libhal_device_property_exists (ctx, parent, "scsi.target", NULL)) {
+			priv->bus = libhal_device_get_property_int (ctx, parent, "scsi.host", NULL);
+			priv->lun = libhal_device_get_property_int (ctx, parent, "scsi.lun", NULL);
+			priv->target = libhal_device_get_property_int (ctx, parent, "scsi.target", NULL);
+		}
 
-	BRASERO_BURN_LOG ("Drive %s has bus,target,lun = %i %i %i", priv->path, priv->bus, priv->target, priv->lun);
-	libhal_free_string (parent);
+		BRASERO_BURN_LOG ("Drive %s has bus,target,lun = %i %i %i",
+				  priv->path,
+				  priv->bus,
+				  priv->target,
+				  priv->lun);
+		libhal_free_string (parent);
+	}
 
 	/* Now check for the medium */
 	brasero_drive_check_medium_inside (drive);
@@ -601,7 +602,7 @@
 	dbus_error_init (&error);
 	libhal_device_add_property_watch (ctx, priv->udi, &error);
 	if (dbus_error_is_set (&error)) {
-		g_warning ("Hal is not running : %s\n", error.message);
+		g_warning ("Failed to watch property : %s\n", error.message);
 		dbus_error_free (&error);
 	}
 

Modified: trunk/src/burn-medium-monitor.c
==============================================================================
--- trunk/src/burn-medium-monitor.c	(original)
+++ trunk/src/burn-medium-monitor.c	Fri Oct 31 13:00:28 2008
@@ -289,6 +289,7 @@
 
 	/* Now we get the list and cache it */
 	dbus_error_init (&error);
+	BRASERO_BURN_LOG ("Polling for drives");
 	devices = libhal_find_device_by_capability (ctx,
 						    "storage.cdrom", &nb_devices,
 						    &error);
@@ -298,14 +299,13 @@
 		return;
 	}
 
-	BRASERO_BURN_LOG ("Polling for drives");
+	BRASERO_BURN_LOG ("Found %d drives", nb_devices);
 	for (i = 0; i < nb_devices; i++) {
 		/* create the drive */
+		BRASERO_BURN_LOG ("Probing %s", devices [i]);
 		drive = brasero_drive_new (devices [i]);
 		priv->drives = g_slist_prepend (priv->drives, drive);
 
-		BRASERO_BURN_LOG ("Found one drive");
-
 		g_signal_connect (drive,
 				  "medium-added",
 				  G_CALLBACK (brasero_medium_monitor_medium_added_cb),



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