Commit 6c247a76 authored by Philippe Rouquier's avatar Philippe Rouquier

Add a small SCSI library on top of ncb to fix 380204. Updated NEWS.

svn path=/trunk/; revision=165
parent c558292c
2007-03-07 Philippe Rouquier <bonfire-app@wanadoo.fr>
Added a small SCSI library to fix bug 380204.
Other benefits will be drawn from this library in later patches.
2007-03-07 Luis Medinas <lmedinas@svn.gnome.org>
* src/burn-caps.c:
......
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
Installation Instructions
*************************
This file is free documentation; the Free Software Foundation gives
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
......@@ -67,9 +70,9 @@ The simplest way to compile this package is:
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
......@@ -82,7 +85,7 @@ is an example:
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
......@@ -99,19 +102,19 @@ for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
......@@ -122,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
......@@ -137,11 +140,11 @@ you can use the `configure' options `--x-includes=DIR' and
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
......@@ -156,7 +159,7 @@ where SYSTEM can have one of these forms:
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
......@@ -167,9 +170,9 @@ eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
......@@ -178,7 +181,7 @@ A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
......@@ -186,14 +189,18 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
......
2007 : 0.5.90
First realease in the next unstable series
- backported patches/fixes from stable branch
- added real multi session support
- use libdvdcss to allow copy of protected DVDs
2006 : 0.5.2
Release from the stable series:
- Fixed log size to 1MB that was causing problems closing #377198
......
......@@ -9,6 +9,7 @@ DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED \
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir) \
-I./scsi \
-DBRASERO_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DBRASERO_PREFIX=\"$(prefix)\" \
-DBRASERO_SYSCONFDIR=\"$(sysconfdir)\" \
......@@ -183,10 +184,68 @@ brasero_SOURCES = \
burn-susp.c \
burn-susp.h \
burn-iso-field.c \
burn-iso-field.h
brasero_LDFLAGS =
burn-iso-field.h \
burn-medium.h \
burn-medium.c \
scsi/scsi-base.h \
scsi/scsi-command.c \
scsi/scsi-command.h \
scsi/scsi-error.h \
scsi/scsi-get-configuration.c \
scsi/scsi-get-configuration.h \
scsi/scsi-mmc1.h \
scsi/scsi-mmc2.h \
scsi/scsi-opcodes.h \
scsi/scsi-read-disc-info.c \
scsi/scsi-read-disc-info.h \
scsi/scsi-read-toc-pma-atip.c \
scsi/scsi-read-toc-pma-atip.h \
scsi/scsi-sense-data.c \
scsi/scsi-sense-data.h \
scsi/scsi-sg.c \
scsi/scsi-sg.h \
scsi/scsi-utils.h \
scsi/scsi-q-subchannel.h \
scsi/scsi-error.c
brasero_LDADD = $(BRASERO_LIBS)
......@@ -2,8 +2,8 @@
* multi-dnd.c
*
* Wed Sep 27 17:34:41 2006
* Copyright 2006 algernon
* <algernon@localhost.localdomain>
* Copyright 2006 Rouquier Philippe
* <Rouquier Philippe@localhost.localdomain>
****************************************************************************/
/*
......
......@@ -2,8 +2,8 @@
* multi-dnd.h
*
* Wed Sep 27 17:43:05 2006
* Copyright 2006 algernon
* <algernon@localhost.localdomain>
* Copyright 2006 Rouquier Philippe
* <Rouquier Philippe@localhost.localdomain>
****************************************************************************/
/*
......
......@@ -3,7 +3,7 @@
*
* Sat Sep 9 11:00:42 2006
* Copyright 2006 philippe
* <philippe@algernon.localdomain>
* <philippe@Rouquier Philippe.localdomain>
****************************************************************************/
/*
......@@ -44,9 +44,14 @@
#include <libgnomevfs/gnome-vfs-drive.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <nautilus-burn-drive-monitor.h>
#include "brasero-ncb.h"
#include "burn-basics.h"
#include "burn-volume.h"
#include "burn-medium.h"
#define BRASERO_MEDIUM_KEY "brasero-medium-key"
typedef struct {
gboolean timeout;
......@@ -643,3 +648,71 @@ NCB_DRIVE_MEDIA_GET_TYPE (NautilusBurnDrive *drive,
return media;
}
gint64
NCB_GET_LAST_DATA_TRACK_ADDRESS (NautilusBurnDrive *drive)
{
BraseroMedium *medium;
medium = g_object_get_data (G_OBJECT (drive), BRASERO_MEDIUM_KEY);
if (!medium)
return -1;
return brasero_medium_get_last_data_track_address (medium);
}
static void
brasero_ncb_inserted_medium_cb (NautilusBurnDriveMonitor *monitor,
NautilusBurnDrive *drive,
gpointer null_data)
{
BraseroMedium *medium;
medium = brasero_medium_new (drive);
g_object_set_data (G_OBJECT (drive), BRASERO_MEDIUM_KEY, medium);
}
static void
brasero_ncb_removed_medium_cb (NautilusBurnDriveMonitor *monitor,
NautilusBurnDrive *drive,
gpointer null_data)
{
BraseroMedium *medium;
medium = g_object_get_data (G_OBJECT (drive), BRASERO_MEDIUM_KEY);
g_object_set_data (G_OBJECT (drive), BRASERO_MEDIUM_KEY, NULL);
if (!medium)
return;
g_object_unref (medium);
}
void
NCB_INIT (void)
{
NautilusBurnDriveMonitor *monitor;
GList *iter, *list;
monitor = nautilus_burn_get_drive_monitor ();
list = nautilus_burn_drive_monitor_get_drives (monitor);
for (iter = list; iter; iter = iter->next) {
BraseroMedium *medium;
NautilusBurnDrive *drive;
drive = iter->data;
medium = brasero_medium_new (drive);
g_object_set_data (G_OBJECT (drive),
BRASERO_MEDIUM_KEY,
medium);
}
g_signal_connect (monitor,
"media-added",
G_CALLBACK (brasero_ncb_inserted_medium_cb),
NULL);
g_signal_connect (monitor,
"media-removed",
G_CALLBACK (brasero_ncb_removed_medium_cb),
NULL);
}
......@@ -3,7 +3,7 @@
*
* Sun Sep 3 11:03:26 2006
* Copyright 2006 philippe
* <philippe@algernon.localdomain>
* <philippe@Rouquier Philippe.localdomain>
****************************************************************************/
/*
......@@ -102,6 +102,12 @@ NCB_DRIVE_GET_MOUNT_POINT (NautilusBurnDrive *drive,
void
NCB_DRIVE_GET_MOUNT_POINT_CANCEL (BraseroMountHandle handle);
gint64
NCB_GET_LAST_DATA_TRACK_ADDRESS (NautilusBurnDrive *drive);
void
NCB_INIT (void);
#ifdef __cplusplus
}
#endif
......
......@@ -19,7 +19,7 @@
*
* Sat Feb 11 16:55:54 2006
* Copyright 2006 philippe
* <philippe@algernon.localdomain>
* <philippe@Rouquier Philippe.localdomain>
****************************************************************************/
#include <string.h>
......
......@@ -2,8 +2,8 @@
* burn-dvdcss-private.h
*
* Thu Nov 16 16:20:39 2006
* Copyright 2006 algernon
* <algernon@localhost.localdomain>
* Copyright 2006 Rouquier Philippe
* <Rouquier Philippe@localhost.localdomain>
****************************************************************************/
/*
......
......@@ -605,6 +605,7 @@ brasero_dvdcss_write_image_thread (gpointer data)
/* get the contents of the DVD */
drive = self->priv->source->contents.drive.disc;
files = brasero_volume_get_files (NCB_DRIVE_GET_DEVICE (drive),
0,
NULL,
NULL,
NULL,
......
......@@ -2,8 +2,8 @@
* burn-iso-field.c
*
* Mon Nov 27 17:31:40 2006
* Copyright 2006 algernon
* <algernon@localhost.localdomain>
* Copyright 2006 Rouquier Philippe
* <Rouquier Philippe@localhost.localdomain>
****************************************************************************/
/*
......
......@@ -2,8 +2,8 @@
* burn-iso-field.h
*
* Mon Nov 27 17:32:39 2006
* Copyright 2006 algernon
* <algernon@localhost.localdomain>
* Copyright 2006 Rouquier Philippe
* <Rouquier Philippe@localhost.localdomain>
****************************************************************************/
/*
......
......@@ -2,8 +2,8 @@
* burn-iso9660.h
*
* Sat Oct 7 17:10:09 2006
* Copyright 2006 algernon
* <algernon@localhost.localdomain>
* Copyright 2006 Rouquier Philippe
* <Rouquier Philippe@localhost.localdomain>
****************************************************************************/
/*
......
......@@ -256,4 +256,6 @@ brasero_job_set_run_slave (BraseroJob *job, gboolean run_slave);
void
brasero_job_set_relay_slave_signals (BraseroJob *job, gboolean relay);
G_END_DECLS
#endif /* JOB_H */
......@@ -3,7 +3,7 @@
*
* Sat Sep 9 17:16:16 2006
* Copyright 2006 philippe
* <philippe@algernon.localdomain>
* <bonfire-app@wanadoo.fr>
****************************************************************************/
/*
......
......@@ -3,7 +3,7 @@
*
* Sat Sep 9 17:16:43 2006
* Copyright 2006 philippe
* <philippe@algernon.localdomain>
* <philippe@Rouquier Philippe.localdomain>
****************************************************************************/
/*
......
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* brasero
* Copyright (C) Philippe Rouquier 2007 <bonfire-app@wanadoo.fr>
*
* brasero is free software.
*
* You may redistribute it and/or modify it under the terms of the
* GNU General Public License, as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* brasero is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with brasero. If not, write to:
* The Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <nautilus-burn-drive.h>
#include "burn-basics.h"
#include "burn-medium.h"
#include "scsi-mmc1.h"
#include "scsi-mmc2.h"
#include "scsi-utils.h"
#include "scsi-q-subchannel.h"
typedef struct _BraseroMediumPrivate BraseroMediumPrivate;
struct _BraseroMediumPrivate
{
GSList * tracks;
guint64 next_wr_add;
BraseroMediumInfo info;
NautilusBurnDrive * drive;
};
#define BRASERO_MEDIUM_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_MEDIUM, BraseroMediumPrivate))
enum
{
PROP_0,
PROP_DRIVE
};
static GObjectClass* parent_class = NULL;
BraseroMediumInfo
brasero_medium_get_status (BraseroMedium *medium)
{
BraseroMediumPrivate *priv;
priv = BRASERO_MEDIUM_PRIVATE (medium);
return priv->info;
}
GSList *
brasero_medium_get_tracks (BraseroMedium *medium)
{
BraseroMediumPrivate *priv;
priv = BRASERO_MEDIUM_PRIVATE (medium);
return g_slist_copy (priv->tracks);
}
gint64
brasero_medium_get_last_data_track_address (BraseroMedium *medium)
{
GSList *iter;
BraseroMediumPrivate *priv;
BraseroMediumTrack *track = NULL;
priv = BRASERO_MEDIUM_PRIVATE (medium);
for (iter = priv->tracks; iter; iter = iter->next) {
BraseroMediumTrack *current;
current = iter->data;
if (current->type & BRASERO_MEDIUM_TRACK_DATA)
track = current;
}
if (!track)
return -1;
return track->start;
}
gint64
brasero_medium_get_last_writable_address (BraseroMedium *medium)
{
BraseroMediumPrivate *priv;
priv = BRASERO_MEDIUM_PRIVATE (medium);
return priv->next_wr_add;
}
static BraseroBurnResult
brasero_medium_get_medium_type (BraseroMedium *self,
int fd,
BraseroScsiErrCode *code)
{
BraseroScsiGetConfigHdr *hdr = NULL;
BraseroMediumPrivate *priv;
BraseroScsiResult result;
int size;
priv = BRASERO_MEDIUM_PRIVATE (self);
result = brasero_mmc2_get_configuration_feature (fd,
BRASERO_SCSI_FEAT_PROFILES,
&hdr,
&size,
code);
if (result != BRASERO_SCSI_OK) {
g_free (hdr);
return BRASERO_BURN_ERR;
}
switch (BRASERO_GET_16 (hdr->current_profile)) {
case BRASERO_SCSI_PROF_CDROM:
priv->info = BRASERO_MEDIUM_CD;
break;
case BRASERO_SCSI_PROF_CDR:
priv->info = BRASERO_MEDIUM_CD|
BRASERO_MEDIUM_WRITABLE;
break;
case BRASERO_SCSI_PROF_CDRW:
priv->info = BRASERO_MEDIUM_CD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_REWRITABLE;
break;
case BRASERO_SCSI_PROF_DVD_ROM:
priv->info = BRASERO_MEDIUM_DVD;
break;
case BRASERO_SCSI_PROF_DVD_R:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE;
break;
case BRASERO_SCSI_PROF_DVD_RW_RESTRICTED:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_REWRITABLE|
BRASERO_MEDIUM_RESTRICTED;
break;
case BRASERO_SCSI_PROF_DVD_RW_SEQUENTIAL:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_REWRITABLE|
BRASERO_MEDIUM_SEQUENTIAL;
break;
case BRASERO_SCSI_PROF_DVD_R_DL_SEQUENTIAL:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_SEQUENTIAL|
BRASERO_MEDIUM_DL;
break;
case BRASERO_SCSI_PROF_DVD_R_DL_JUMP:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_JUMP|
BRASERO_MEDIUM_DL;
break;
case BRASERO_SCSI_PROF_DVD_RW_PLUS:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_REWRITABLE|
BRASERO_MEDIUM_PLUS;
break;
case BRASERO_SCSI_PROF_DVD_R_PLUS:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_PLUS;
break;
case BRASERO_SCSI_PROF_DVD_RW_PLUS_DL:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_REWRITABLE|
BRASERO_MEDIUM_PLUS|
BRASERO_MEDIUM_DL;
break;
case BRASERO_SCSI_PROF_DVD_R_PLUS_DL:
priv->info = BRASERO_MEDIUM_DVD|
BRASERO_MEDIUM_WRITABLE|
BRASERO_MEDIUM_PLUS|
BRASERO_MEDIUM_DL;
break;
case BRASERO_SCSI_PROF_NON_REMOVABLE:
case BRASERO_SCSI_PROF_REMOVABLE:
case BRASERO_SCSI_PROF_MO_ERASABLE:
case BRASERO_SCSI_PROF_MO_WRITE_ONCE:
case BRASERO_SCSI_PROF_MO_ADVANCED_STORAGE:
case BRASERO_SCSI_PROF_BD_ROM:
case BRASERO_SCSI_PROF_BR_R_SEQUENTIAL:
case BRASERO_SCSI_PROF_BR_R_RANDOM:
case BRASERO_SCSI_PROF_BD_RW:
case BRASERO_SCSI_PROF_DDCD_ROM:
case BRASERO_SCSI_PROF_DDCD_R:
case BRASERO_SCSI_PROF_DDCD_RW:
case BRASERO_SCSI_PROF_HD_DVD_ROM:
case BRASERO_SCSI_PROF_HD_DVD_R:
case BRASERO_SCSI_PROF_HD_DVD_RAM:
case BRASERO_SCSI_PROF_DVD_RAM:
g_free (hdr);
return BRASERO_BURN_NOT_SUPPORTED;
}
g_free (hdr);
return BRASERO_BURN_OK;
}
static BraseroBurnResult
brasero_medium_get_info (BraseroMedium *self,
int fd,
BraseroScsiErrCode *code)
{
int size;
BraseroScsiResult result;
BraseroMediumPrivate *priv;
BraseroScsiDiscInfoStd *info = NULL;
priv = BRASERO_MEDIUM_PRIVATE (self);
result = brasero_mmc1_read_disc_information_std (fd,
&info,
&size,
code);
if (result != BRASERO_SCSI_OK) {
g_free (info);
return BRASERO_BURN_ERR;
}
switch (info->status) {
case BRASERO_SCSI_DISC_EMPTY:
priv->info |= BRASERO_MEDIUM_BLANK;
break;
case BRASERO_SCSI_DISC_INCOMPLETE:
priv->info |= BRASERO_MEDIUM_APPENDABLE;
priv->next_wr_add = BRASERO_GET_32 (info->last_session_leadin);
break;