Commit 02d31a74 authored by Philippe Rouquier's avatar Philippe Rouquier

Fix #581742 – port from HAL to DeviceKit-disks

Remove last bits and pieces for HAL support and only relies on GIO from now on
parent fb0f2298
......@@ -128,7 +128,6 @@ GSTREAMER_REQUIRED=0.10.15
GSTREAMER_BASE_REQUIRED=0.10.0
LIBXML2_REQUIRED=2.6.0
LIBUNIQUE_REQUIRED=1.0.0
HAL_REQUIRED=0.5
DBUS_REQUIRED=0.7.2
GTK_DOC_CHECK([1.3])
......@@ -199,13 +198,6 @@ PKG_CHECK_MODULES(BRASERO_DBUS, \
AC_SUBST(BRASERO_DBUS_CFLAGS)
AC_SUBST(BRASERO_DBUS_LIBS)
PKG_CHECK_MODULES(BRASERO_HAL, \
hal >= $HAL_REQUIRED \
dbus-glib-1 >= $DBUS_REQUIRED)
AC_SUBST(BRASERO_HAL_CFLAGS)
AC_SUBST(BRASERO_HAL_LIBS)
PKG_CHECK_MODULES(BRASERO_SM, \
sm)
......
......@@ -81,7 +81,6 @@ IGNORE_HFILES= scsi-base.h \
brasero-media-private.h \
brasero-medium-selection-priv.h \
burn-susp.h \
burn-hal-watch.h \
libbrasero-marshal.h \
brasero-gio-operation.h \
brasero-burn-dialog.h \
......@@ -149,9 +148,7 @@ INCLUDES= \
-I$(top_builddir) \
$(BRASERO_GLIB_CFLAGS) \
$(BRASERO_IO_CFLAGS) \
$(BRASERO_GTK_CFLAGS) \
$(BRASERO_DBUS_CFLAGS) \
$(BRASERO_HAL_CFLAGS)
$(BRASERO_GTK_CFLAGS)
GTKDOC_LIBS=$(top_builddir)/libbrasero-media/libbrasero-media.la
#$(top_builddir)/libbrasero-burn/libbrasero-burn.la
......
......@@ -1468,26 +1468,6 @@ brasero_job_get_action (BraseroJob *self, BraseroJobAction *action)
return BRASERO_BURN_OK;
}
BraseroBurnResult
brasero_job_get_bus_target_lun (BraseroJob *self, gchar **BTL)
{
BraseroBurnSession *session;
BraseroJobPrivate *priv;
BraseroDrive *drive;
BRASERO_JOB_DEBUG (self);
g_return_val_if_fail (BTL != NULL, BRASERO_BURN_ERR);
priv = BRASERO_JOB_PRIVATE (self);
session = brasero_task_ctx_get_session (priv->ctx);
drive = brasero_burn_session_get_burner (session);
*BTL = brasero_drive_get_bus_target_lun_string (drive);;
return BRASERO_BURN_OK;
}
BraseroBurnResult
brasero_job_get_device (BraseroJob *self, gchar **device)
{
......
......@@ -157,9 +157,6 @@ brasero_job_get_medium (BraseroJob *job, BraseroMedium **medium);
BraseroBurnResult
brasero_job_get_device (BraseroJob *job, gchar **device);
BraseroBurnResult
brasero_job_get_bus_target_lun (BraseroJob *job, gchar **BTL);
BraseroBurnResult
brasero_job_get_media (BraseroJob *job, BraseroMedia *media);
......
......@@ -10,9 +10,7 @@ INCLUDES = \
$(DISABLE_DEPRECATED) \
$(BRASERO_GLIB_CFLAGS) \
$(BRASERO_GIO_CFLAGS) \
$(BRASERO_GTK_CFLAGS) \
$(BRASERO_DBUS_CFLAGS) \
$(BRASERO_HAL_CFLAGS)
$(BRASERO_GTK_CFLAGS)
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
RECMARSHALFILES = libbrasero-marshal.h libbrasero-marshal.c
......@@ -40,8 +38,6 @@ libbrasero_media_la_LIBADD = \
$(BRASERO_GLIB_LIBS) \
$(BRASERO_GIO_LIBS) \
$(BRASERO_GTK_LIBS) \
$(BRASERO_DBUS_LIBS) \
$(BRASERO_HAL_LIBS) \
$(BRASERO_SCSI_LIBS)
libbrasero_media_la_LDFLAGS = \
......@@ -105,8 +101,6 @@ libbrasero_media_la_SOURCES = \
scsi-sbc.h \
scsi-test-unit-ready.c \
brasero-media.c \
burn-hal-watch.c \
burn-hal-watch.h \
brasero-medium-monitor.c \
burn-susp.c \
burn-susp.h \
......
......@@ -39,12 +39,10 @@
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <libhal.h>
#include <gio/gio.h>
#include "brasero-media-private.h"
#include "brasero-gio-operation.h"
#include "burn-hal-watch.h"
#include "brasero-medium.h"
#include "brasero-volume.h"
......@@ -59,12 +57,6 @@
#include "scsi-mode-pages.h"
#include "scsi-sbc.h"
#if defined(HAVE_STRUCT_USCSI_CMD)
#define BLOCK_DEVICE "block.solaris.raw_device"
#else
#define BLOCK_DEVICE "block.device"
#endif
typedef struct _BraseroDrivePrivate BraseroDrivePrivate;
struct _BraseroDrivePrivate
{
......@@ -76,14 +68,9 @@ struct _BraseroDrivePrivate
BraseroMedium *medium;
BraseroDriveCaps caps;
gchar *udi;
gchar *path;
gchar *block_path;
gint bus;
gint target;
gint lun;
GCancellable *cancel;
guint probed:1;
......@@ -235,23 +222,16 @@ brasero_drive_eject (BraseroDrive *drive,
* sometimes needed by some backends like cdrecord.
*
* Return value: a string or NULL. The string must be freed when not needed
*
* Deprecated since 2.27.3
**/
gchar *
brasero_drive_get_bus_target_lun_string (BraseroDrive *drive)
{
BraseroDrivePrivate *priv;
g_return_val_if_fail (drive != NULL, NULL);
g_return_val_if_fail (BRASERO_IS_DRIVE (drive), NULL);
priv = BRASERO_DRIVE_PRIVATE (drive);
if (!priv->gdrive)
return NULL;
if (priv->bus < 0)
return NULL;
return g_strdup_printf ("%i,%i,%i", priv->bus, priv->target, priv->lun);
return NULL;
}
/**
......@@ -728,60 +708,6 @@ brasero_drive_medium_gdrive_changed_cb (BraseroDrive *gdrive,
brasero_drive_check_medium_inside_gdrive (drive);
}
static void
brasero_drive_init_hal (BraseroDrive *drive)
{
BraseroDrivePrivate *priv;
BraseroHALWatch *watch;
LibHalContext *ctx;
char *parent;
priv = BRASERO_DRIVE_PRIVATE (drive);
watch = brasero_hal_watch_get_default ();
ctx = brasero_hal_watch_get_ctx (watch);
if (!priv->udi) {
priv->udi = g_drive_get_identifier (priv->gdrive, G_VOLUME_IDENTIFIER_KIND_HAL_UDI);
BRASERO_MEDIA_LOG ("Using HAL backend udi = %s", priv->udi);
}
if (!priv->udi)
return;
priv->path = libhal_device_get_property_string (ctx,
priv->udi,
BLOCK_DEVICE,
NULL);
if (priv->path && priv->path [0] == '\0') {
g_free (priv->path);
priv->path = NULL;
}
/* 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) {
/* 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_MEDIA_LOG ("Drive %s has bus,target,lun = %i %i %i",
priv->path,
priv->bus,
priv->target,
priv->lun);
libhal_free_string (parent);
}
}
static gboolean
brasero_drive_probed (gpointer data)
{
......@@ -793,9 +719,6 @@ brasero_drive_probed (gpointer data)
g_thread_join (priv->probe);
priv->probe = NULL;
/* Put HAL initialization first to make sure the device path is set */
brasero_drive_init_hal (drive);
/* If it's not a fake drive then connect to signal for any
* change and check medium inside */
g_signal_connect (priv->gdrive,
......@@ -1023,7 +946,6 @@ brasero_drive_set_property (GObject *object,
switch (prop_id)
{
case PROP_UDI:
priv->udi = g_strdup (g_value_get_string (value));
break;
case PROP_GDRIVE:
priv->gdrive = g_value_get_object (value);
......@@ -1057,7 +979,6 @@ brasero_drive_get_property (GObject *object,
switch (prop_id)
{
case PROP_UDI:
g_value_set_string (value, g_strdup (priv->udi));
break;
case PROP_GDRIVE:
g_value_set_object (value, priv->gdrive);
......@@ -1086,13 +1007,8 @@ brasero_drive_finalize (GObject *object)
priv->probe_id = 0;
}
if (priv->path) {
libhal_free_string (priv->path);
priv->path = NULL;
}
if (priv->block_path) {
libhal_free_string (priv->block_path);
g_free (priv->block_path);
priv->block_path = NULL;
}
......@@ -1109,11 +1025,6 @@ brasero_drive_finalize (GObject *object)
priv->gdrive = NULL;
}
if (priv->udi) {
g_free (priv->udi);
priv->udi = NULL;
}
if (priv->cancel) {
g_cancellable_cancel (priv->cancel);
g_object_unref (priv->cancel);
......@@ -1173,8 +1084,8 @@ brasero_drive_class_init (BraseroDriveClass *klass)
g_object_class_install_property (object_class,
PROP_UDI,
g_param_spec_string("udi",
"HAL udi",
"HAL udi as a string",
"Deprecated",
"HAL udi as a string (Deprecated)",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
......
......@@ -39,12 +39,6 @@
#include <gio/gio.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <libhal.h>
#include "brasero-media-private.h"
#include "scsi-device.h"
......
......@@ -21,8 +21,7 @@ INCLUDES = \
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DSHAREDIR=\""$(datadir)"\" \
-DDATADIR=\""$(datadir)/brasero"\" \
$(DISABLE_DEPRECATED) \
$(BRASERO_HAL_CFLAGS)
$(DISABLE_DEPRECATED)
@INTLTOOL_DESKTOP_RULE@
......
......@@ -342,13 +342,7 @@ brasero_cdrdao_set_argv_record (BraseroCdrdao *cdrdao,
brasero_job_get_current_track (BRASERO_JOB (cdrdao), &track);
drive = brasero_track_disc_get_drive (BRASERO_TRACK_DISC (track));
#ifdef HAVE_CAM_LIB_H
/* FreeBSD like that better */
g_ptr_array_add (argv, brasero_drive_get_bus_target_lun_string (drive));
#else
g_ptr_array_add (argv, g_strdup (brasero_drive_get_device (drive)));
#endif
}
else if (brasero_track_type_get_has_image (type)) {
gchar *cuepath;
......@@ -444,13 +438,7 @@ brasero_cdrdao_set_argv_image (BraseroCdrdao *cdrdao,
brasero_job_get_current_track (BRASERO_JOB (cdrdao), &track);
drive = brasero_track_disc_get_drive (BRASERO_TRACK_DISC (track));
#ifdef HAVE_CAM_LIB_H
/* FreeBSD like that better */
g_ptr_array_add (argv, brasero_drive_get_bus_target_lun_string (drive));
#else
g_ptr_array_add (argv, g_strdup (brasero_drive_get_device (drive)));
#endif
g_ptr_array_add (argv, g_strdup ("--read-raw"));
/* This is done so that if a cue file is required we first generate
......
......@@ -340,12 +340,7 @@ brasero_readcd_set_argv (BraseroProcess *process,
brasero_job_get_current_track (BRASERO_JOB (readcd), &track);
drive = brasero_track_disc_get_drive (BRASERO_TRACK_DISC (track));
#ifdef HAVE_CAM_LIB_H
/* FreeBSD like that better */
device = brasero_drive_get_bus_target_lun_string (drive);
#else
device = g_strdup (brasero_drive_get_device (drive));
#endif
if (!device)
return BRASERO_BURN_ERR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment