[brasero] Fix FreeBSD support
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Fix FreeBSD support
- Date: Tue, 4 Aug 2009 13:58:28 +0000 (UTC)
commit 2f751c27ec33f0c2375b78708ea3138691c1a9c5
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Tue Aug 4 15:31:43 2009 +0200
Fix FreeBSD support
Patches by Joe Marcus Clarke <marcus FreeBSD org>
libbrasero-burn/burn-job.c | 20 ++++++++++++++++++++
libbrasero-burn/burn-job.h | 3 +++
libbrasero-media/brasero-drive.c | 28 ++++++++++++++++++++++++++++
plugins/cdrdao/burn-cdrdao.c | 8 ++++++++
plugins/cdrtools/burn-readcd.c | 4 ++++
5 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/libbrasero-burn/burn-job.c b/libbrasero-burn/burn-job.c
index e6f098e..307c5c9 100644
--- a/libbrasero-burn/burn-job.c
+++ b/libbrasero-burn/burn-job.c
@@ -1469,6 +1469,26 @@ brasero_job_get_action (BraseroJob *self, BraseroJobAction *action)
}
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)
{
BraseroBurnSession *session;
diff --git a/libbrasero-burn/burn-job.h b/libbrasero-burn/burn-job.h
index 1db49a1..a87d039 100644
--- a/libbrasero-burn/burn-job.h
+++ b/libbrasero-burn/burn-job.h
@@ -155,6 +155,9 @@ BraseroBurnResult
brasero_job_get_medium (BraseroJob *job, BraseroMedium **medium);
BraseroBurnResult
+brasero_job_get_bus_target_lun (BraseroJob *job, gchar **BTL);
+
+BraseroBurnResult
brasero_job_get_device (BraseroJob *job, gchar **device);
BraseroBurnResult
diff --git a/libbrasero-media/brasero-drive.c b/libbrasero-media/brasero-drive.c
index 5aa7036..fd308c9 100644
--- a/libbrasero-media/brasero-drive.c
+++ b/libbrasero-media/brasero-drive.c
@@ -35,6 +35,13 @@
#include <unistd.h>
#include <string.h>
+#ifdef HAVE_CAM_LIB_H
+#include <errno.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <camlib.h>
+#endif
+
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
@@ -270,10 +277,31 @@ brasero_drive_cancel_current_operation (BraseroDrive *drive)
gchar *
brasero_drive_get_bus_target_lun_string (BraseroDrive *drive)
{
+#ifdef HAVE_CAM_LIB_H
+ struct cam_device *cam_dev;
+ char *addr;
+#endif
+
g_return_val_if_fail (drive != NULL, NULL);
g_return_val_if_fail (BRASERO_IS_DRIVE (drive), NULL);
+#ifdef HAVE_CAM_LIB_H
+ cam_dev = cam_open_device (brasero_drive_get_device (drive), O_RDWR);
+
+ if (cam_dev == NULL) {
+ BRASERO_MEDIA_LOG ("CAM: Failed to open %s: %s", brasero_drive_get_device (drive), g_strerror (errno));
+ return NULL;
+ }
+
+ addr = g_strdup_printf ("%i,%i,%i", cam_dev->path_id, cam_dev->target_id, cam_dev->target_lun);
+
+ cam_close_device (cam_dev);
+
+ return addr;
+#else
+
return NULL;
+#endif
}
/**
diff --git a/plugins/cdrdao/burn-cdrdao.c b/plugins/cdrdao/burn-cdrdao.c
index a92bdfe..e67e889 100644
--- a/plugins/cdrdao/burn-cdrdao.c
+++ b/plugins/cdrdao/burn-cdrdao.c
@@ -346,7 +346,11 @@ 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
+ 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;
@@ -442,7 +446,11 @@ 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
+ 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
diff --git a/plugins/cdrtools/burn-readcd.c b/plugins/cdrtools/burn-readcd.c
index b696686..03db3c2 100644
--- a/plugins/cdrtools/burn-readcd.c
+++ b/plugins/cdrtools/burn-readcd.c
@@ -344,7 +344,11 @@ 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
+ 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]