libcdio-devel
[Top][All Lists]
Advanced

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

[Libcdio-devel] Re: Burned CD-RW and DVD+RW via libcdio MMC interface


From: Thomas Schmitt
Subject: [Libcdio-devel] Re: Burned CD-RW and DVD+RW via libcdio MMC interface
Date: Sat, 19 Dec 2009 20:29:25 +0100

Hi,

> You are *not* annoying.

For now. :))

I include two patches:

------------------------------------------------
The fix for the obvious bug in
run_mmc_cmd_linux(). I deem this of value in any
case. (Although direction WRITE will not work on
Linux without open(O_RDWR).
------------------------------------------------

--- libcdio-0.82/lib/driver/gnu_linux.c 2009-07-03 01:31:58.000000000 +0200
+++ libcdio-0.82.ts/lib/driver/gnu_linux.c      2009-12-19 17:42:37.000000000 
+0100
@@ -1229,7 +1229,7 @@ run_mmc_cmd_linux( void *p_user_data, 
   memcpy(&cgc.cmd, p_cdb, i_cdb);
   cgc.buflen = i_buf;
   cgc.buffer = p_buf;
-  cgc.data_direction = (SCSI_MMC_DATA_READ == cgc.data_direction)
+  cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction)
     ? CGC_DATA_READ : CGC_DATA_WRITE;
 
 #ifdef HAVE_LINUX_CDROM_TIMEOUT

------------------------------------------------
The introduction of transfer direction NONE
and its implementation in gnu_linux.c.
Plus hardcoded usage of open(O_RDWR) in
gnu_linux.c
This is a very provisory patch and should only
be used for experiments with libburn on Linux.
On other systems one would first have to
implement direction NONE.
This patch assumes the first one was applied
(and overwrites its change by a new one).
------------------------------------------------

--- libcdio-0.82/include/cdio/mmc.h     2008-11-29 05:52:43.000000000 +0100
+++ libcdio-0.82.ts/include/cdio/mmc.h  2009-12-19 18:04:15.000000000 +0100
@@ -377,12 +377,16 @@ typedef struct mmc_cdb_s {
   } cdio_mmc_feature_list_header_t;
 
   /** An enumeration indicating whether an MMC command is sending
-    data or getting data.
+    data, or getting data, or does none of both.
   */
   typedef enum mmc_direction_s {
     SCSI_MMC_DATA_READ,
-    SCSI_MMC_DATA_WRITE
+    SCSI_MMC_DATA_WRITE,
+    SCSI_MMC_DATA_NONE
   } cdio_mmc_direction_t;
+  /** Indicate to applications that SCSI_MMC_DATA_NONE is available
+  */
+#define SCSI_MMC_HAS_DIR_NONE 1
   
   typedef struct mmc_subchannel_s
   {

--- libcdio-0.82/lib/driver/gnu_linux.c 2009-12-19 17:47:31.000000000 +0100
+++ libcdio-0.82.ts/lib/driver/gnu_linux.c      2009-12-19 18:07:32.000000000 
+0100
@@ -1229,8 +1229,10 @@ run_mmc_cmd_linux( void *p_user_data, 
   memcpy(&cgc.cmd, p_cdb, i_cdb);
   cgc.buflen = i_buf;
   cgc.buffer = p_buf;
-  cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction)
-    ? CGC_DATA_READ : CGC_DATA_WRITE;
+
+  cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction) ? CGC_DATA_READ :
+                       (SCSI_MMC_DATA_WRITE == e_direction) ? CGC_DATA_WRITE :
+                       CGC_DATA_NONE;
 
 #ifdef HAVE_LINUX_CDROM_TIMEOUT
   cgc.timeout = i_timeout_ms;
@@ -1641,7 +1643,7 @@ cdio_open_am_linux (const char *psz_orig
 
   ret->driver_id = DRIVER_LINUX;
 
-  if (cdio_generic_init(_data, O_RDONLY|O_NONBLOCK)) {
+  if (cdio_generic_init(_data, O_RDWR|O_NONBLOCK)) {
     return ret;
   } else {
     cdio_generic_free (_data);

------------------------------------------------

After applying both patches one may test the
newest SVN version of libburn:
  svn co http://svn.libburnia-project.org/libburn/trunk libburn
  cd libburn
For the next command one needs autotools >= 1.7
  ./bootstrap
(If SVN is inconvenient to you, ask me for a
tarball with ./bootstrap already applied.)

Now request that experimental adapter sg-libcdio
is used instead of normal adapter sg-linux:
  ./configure --enable-libcdio
and let
  make

Command
  cdrskin/cdrskin
should work without make install.
So if you have rw-access to the drive device file
you do not need to be superuser for a first test.

Remember: Only the Linux driver of libcdio is
          prepared yet.

Experiments:

Get an overview of drives
  $ cdrskin/cdrskin --devices
  cdrskin 0.7.5 : limited cdrecord compatibility wrapper for libburn
  ...
  cdrskin: Overview of accessible drives (6 found) :
  -----------------------------------------------------------------------------
  0  dev='/dev/cdrom'  rwrw-- :  'HL-DT-ST'  'DVD-ROM GDR8162B'
  1  dev='/dev/hdc'  rwrw-- :  'LITE-ON '  'LTR-48125S'
  2  dev='/dev/sr0'  rwrw-- :  'TSSTcorp'  'CDDVDW SH-S203B'
  3  dev='/dev/sr1'  rwrw-- :  'HL-DT-ST'  'BD-RE GGW-H20L'
  4  dev='/dev/sr2'  rwrw-- :  'HL-DT-ST'  'BDDVDRW GGC-H20L'
  5  dev='/dev/sr3'  rwrw-- :  'SanDisk '  'Cruzer'
  -----------------------------------------------------------------------------

Insert some media into one of the drives and let
cdrskin report about it:
  $ cdrskin/cdrskin dev=/dev/sr2 -v -minfo
  ...
  Identifikation : 'BDDVDRW GGC-H20L'
  ...
    1T speed low:  4 1T speed high: 10
  Product Id:    97m15s35f/79m59s74f
  Producer:      Nan-Ya Plastics Corporation
  Manufacturer: Nan-Ya Plastics Corporation

  Mounted media class:      CD
  Mounted media type:       CD-RW
  Disk Is erasable
  disk status:              complete
  session status:           complete
  ...
  Track  Sess Type   Start Addr End Addr   Size
  ==============================================
      1     1 Data   0          19732      19733     

Burn a CD-RW in TAO mode
  $ cdrskin/cdrskin -v dev=/dev/sr2 \
                    blank=as_needed \
                    -tao padsize=300k \
                    /my/test/image.iso
  ...
  Starting to write CD/DVD at speed MAX in real BLANK mode for single session.
  Last chance to quit, starting real write in   0 seconds. Operation starts.
  cdrskin: blanking done                                         
  Blanking time:   28.114s
  ...
  Track 01: data   125 MB        
  Total size:      125 MB (14:16.15) = 64062 sectors
  Lout start:      125 MB (14:18/15) = 64062 sectors

  Starting to write CD/DVD at speed MAX in real TAO mode for single session.
  Last chance to quit, starting real write in   0 seconds. Operation starts.
  Waiting for reader process to fill input buffer ... input buffer ready.
  ...
  Track 01: Total bytes read/written: 131198976/131198976 (64062 sectors).
  Writing  time:  117.206s
  Cdrskin: fifo had 64062 puts and 64062 gets.
  Cdrskin: fifo was 0 times empty and 14480 times full, min fill was 99%.
  Min drive buffer fill was 45%
  cdrskin: burning done

The same command may be applied to other media.
I tested only DVD+RW for now, but there is few
reason why DVD-RW, DVD-R, DVD+R, BD-R, BD-RE
should not work. (If all goes well, that is. In
case of renitent drive or media, there might
occur confusion. libburn is driving blindly
here.) 

For more see 
  $ man cdrskin/cdrskin.1
especially the EXAMPLES section.

Do not use option -eject for now or else the
program will not end voluntarily (it is ok
to end it by Ctrl+C after the tray is out).
CD burning without option -tao fail for now.

If possible use a drive at USB or eSATA for the
first tests. It might be that the drive gets
stuck if the burn program fails during certain
states of the drive or the Linux driver.
In that case one has to cycle power. With
built-in drives this means reboot.

If problems occur then it would be helpful to
compare with the normal Linux adapter:
  ./configure --disable-libcdio
  make clean
  make
  cdrskin/cdrskin ...


Have a nice day :)

Thomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]