Compare commits

...

183 Commits

Author SHA1 Message Date
eea6c0fd96 Branching for libburn bugfix release 0.7.4.pl01 2009-12-26 10:32:02 +00:00
2a388cb443 libburn-0.7.2.pl01 : Workarounds for Pioneer DVR-216D rev 1.09 2009-11-13 09:49:10 +00:00
b641b5c570 Branching for libburn bugfix release 0.7.2.pl01 2009-11-13 09:25:07 +00:00
8b213ca0fe libburn release 0.7.2 is ready 2009-10-12 12:35:06 +00:00
9b3b479d98 Documented changes and release timestamp 2009-10-12 09:58:12 +00:00
19ff671a23 Updated cdrskin tarball generator 2009-10-12 09:56:46 +00:00
1192b252ec Made number transition and activated development documentation 2009-10-12 09:55:32 +00:00
29e20268d5 Branching for libburn release 0.7.2 2009-10-12 06:54:37 +00:00
96a5a2a28a Made -minfo subtract 2 from track size if "Data" and last 2 blocks unreadable 2009-10-09 20:06:25 +00:00
ca97df9798 Made read_capacity error message of burn_read_data() depending on flag bit1 2009-10-09 20:03:06 +00:00
22905f7349 Made -minfo stupidly report overwriteable media as "erasable" and "complete" 2009-10-09 12:37:38 +00:00
a318da9463 Determining read capacity for DVD-RAM 2009-10-09 12:35:42 +00:00
3c69b684a8 Fixed CD TAO multi-track -dummy bug reported by Philippe Rouquier 2009-10-04 15:11:35 +00:00
4457061656 Restricted retry to the timeout for single SCSI commands (200 seconds) 2009-09-22 19:26:57 +00:00
758f5a5c1e Revoked instruction to retry STOP UNIT 2009-09-22 19:24:41 +00:00
c8c4da8e8e Mentioned need for 2056 byte fifo chunks with burn_track_set_cdxa_conv() 2009-09-20 11:19:11 +00:00
4fdebcae9f Refusing to read beyond media_read_capacity 2009-09-18 16:18:37 +00:00
82ee4c8788 Fixing SIGSEGV with CD SAO introduced with revision 2808 2009-09-18 16:16:56 +00:00
ad4a286736 Evaluating read capacity with role 2 drives (regular files and block devices) 2009-09-13 09:49:50 +00:00
9017f0716f Updated cdrskin web page 2009-09-12 13:42:27 +00:00
7973546a4c Interpreting options -mode2, -xa, -xa1, -xa2 but producing CD-ROM Mode 1 tracks 2009-09-11 12:08:59 +00:00
2e6f83b3b3 New API call burn_track_set_cdxa_conv() 2009-09-11 11:53:36 +00:00
fdd190b65c Removed Media summary from -minfo because of incompatible counting rules 2009-09-10 07:11:54 +00:00
97ac17512f Silenced compiler warning 2009-09-09 17:42:31 +00:00
28a1b4dcba Emulation of some -minfo output 2009-09-09 17:33:48 +00:00
b724ab2130 New struct burn_toc_entry extension for Last Recorded Address 2009-09-09 15:38:47 +00:00
567beb1d9f Correction with erasable bit of burn_disc_get_cd_info() 2009-09-09 13:39:27 +00:00
eb62395e41 New API call burn_disc_get_cd_info() 2009-09-09 12:52:07 +00:00
1d6c97c79f Avoided to read third sixpack of manufacturer bytes with DVD-R media 2009-09-06 11:20:18 +00:00
5e4c1cf967 Corrected misformatted manufacturer strings of DVD- media 2009-09-06 09:37:23 +00:00
719096b0a7 Changed new API call burn_get_media_product_id() to burn_disc_get_media_id() 2009-09-06 09:25:52 +00:00
75dca6c6e9 Made recognition of CD media codes work in burn_guess_manufacturer() 2009-09-06 09:22:26 +00:00
1ef3a24885 "Manufacturer:", "Media type:" as cdrecord, own "Product Id:" and "Producer:" 2009-09-05 16:51:57 +00:00
790b4f31ee Introduced flag bit0 for API call burn_get_media_product_id() 2009-09-05 16:50:41 +00:00
9362a0240b Re-enabled output of product id and manufacturer 2009-09-05 13:19:01 +00:00
82e884c432 Made cdrskin/compile_cdrskin.sh -libburn_0_7_0 work again 2009-09-05 12:08:43 +00:00
f6d6dcfad0 Closed a small memory leak with drive inquiry 2009-09-05 11:50:09 +00:00
970ae46cfa Silenced a valgrind warning caused by not recognizing side effects of a ioctl 2009-09-05 11:42:25 +00:00
693784cbf5 Made product ID surely a single printable word 2009-09-05 11:29:44 +00:00
3a98bc52f9 Adjusted column width of media summary message 2009-09-05 07:24:06 +00:00
6038928fe4 Adjusted column width of media info messages 2009-09-04 20:43:29 +00:00
2e547b0bba Updated media info documentation 2009-09-04 20:41:08 +00:00
e968e81409 Option -atip now reports Product Id and Manufacturer for most CD, DVD, BD types 2009-09-04 20:22:54 +00:00
557299d350 New API calls burn_get_media_product_id() and burn_guess_manufacturer() 2009-09-04 20:21:55 +00:00
6642342274 New API call burn_guess_cd_manufacturer() 2009-09-02 13:32:17 +00:00
40b3380d4d Removed lec.c from libburn 2009-09-02 13:14:23 +00:00
3b018684c7 New option --long_toc, now printing media summary at end of TOC 2009-09-01 13:34:23 +00:00
96beb44455 Aligned the output columns of cdrskin --devices 2009-09-01 11:38:57 +00:00
9805ce7534 Disabled code using libburn/lec.c, removed lec.c from libburn 2009-09-01 09:57:14 +00:00
407471898c Disabled code using libburn/lec.c, removed lec.c from libburn 2009-09-01 09:56:51 +00:00
cf9a2031a4 Disabled write mode -raw96r 2009-09-01 08:25:01 +00:00
d9fc6cc275 Documented changes and release timestamp 2009-08-27 14:41:38 +00:00
78713d8912 Updated cdrskin tarball generator 2009-08-27 14:39:33 +00:00
169963eced Made number transition to development version 0.7.1 2009-08-27 14:38:24 +00:00
22c187cd61 Implemented automatic START UNIT after STOP UNIT before any other SCSI command 2009-08-24 20:24:39 +00:00
b900831914 Made burn_drive_snooze() safe for emulated drives 2009-08-24 16:15:46 +00:00
654d71ef07 New API call burn_drive_snooze() 2009-08-24 13:10:53 +00:00
0571f4dc2e Adapted to pitfalls of U3 memory sticks which appear as CD-ROM drives 2009-08-23 13:08:19 +00:00
ff23614200 Listing all profiles with cdrskin -v -atip 2009-08-15 13:36:51 +00:00
c59300b27a New API calls burn_drive_get_all_profiles(), burn_obtain_profile_name() 2009-08-15 13:32:56 +00:00
635996a327 Added test code about output blocks size as comment. 2009-08-15 13:30:42 +00:00
93287896a6 Documented changes and release timestamp 2009-07-14 13:39:08 +00:00
4da88193fa Updated cdrskin tarball generator 2009-07-14 13:38:19 +00:00
3091eeb9c9 Made number transition and activated development documentation 2009-07-14 13:37:11 +00:00
19a668a48e Timestamp for revision 2691 2009-07-07 19:17:40 +00:00
6ceabaff32 configure options --enable-libdir-pkgconfig and --enable-pkgconfig-path=DIR 2009-07-07 19:12:18 +00:00
b65b852c15 Retrying 3 times on EBUSY drives with generous usleep intervals 2009-06-14 09:49:47 +00:00
1ccedd5572 Bug fix: No usable media was detected with old MMC-1 drives 2009-06-03 18:53:57 +00:00
473e205c9e Bug fix: Old MMC-1 drives were rejected because of mode page 2Ah length 2009-06-03 08:58:18 +00:00
2522bebfbd Avoided to enumerate faulty drive objects 2009-06-02 17:21:43 +00:00
8276611468 Avoided SIGSEGV if no drives were found by scan 2009-06-02 16:30:06 +00:00
38994b62c0 Rectified use of burn_drive.mdata->valid 2009-06-02 16:28:33 +00:00
474c4cddd7 Made -scanbus work with SCSI bus numbers like 85 (USB, kernel 2.6.18.2) 2009-05-17 14:42:52 +00:00
b0b4bc57f8 Documented changes and release timestamp 2009-05-07 18:17:54 +00:00
b97fa7a451 Updated cdrskin tarball generator 2009-05-07 18:16:55 +00:00
8aca8e9921 Made number transition and activated development documentation 2009-05-07 18:15:47 +00:00
15b31b121a Mentioned BD were it was missing 2009-05-07 18:12:32 +00:00
e5632de786 Bug fix: Device scan stalled on FreeBSD. Ticket 148 jwele 2009-04-30 07:08:23 +00:00
91e3a2f3f7 Replaced 8 blanks by a tab 2009-04-30 06:59:35 +00:00
0ffc4bd19b Marked alleged use of uninitialized memory reported by valgrind 2009-04-30 06:56:47 +00:00
9cb4e4281e Bug fix: burn_abort() did not work with broken output pipe (since rev 2514) 2009-03-18 17:25:00 +00:00
f87747802a Human readable error messages for asc=08 "Logical unit communication failure" 2009-03-18 12:45:59 +00:00
4626304e39 Get on FreeBSD pkgconfigdir=.../libdata , on Linux and others: .../lib 2009-03-16 19:07:45 +00:00
d19abc1940 Documented changes and release timestamp 2009-03-13 14:15:46 +00:00
5ef7b4b445 Updated cdrskin tarball generator 2009-03-13 14:10:09 +00:00
033107b436 Made libburn number transition to 0.6.5 2009-03-13 14:03:13 +00:00
635405da8f Reacted on compiler warnings of SchilliX-0.6.7 (based on Solaris 5.11) 2009-03-08 14:01:10 +00:00
aafa543391 Lifted the ban on operating systems other than Linux and FreeBSD 2009-03-05 14:53:00 +00:00
8594cd96bc Making optional use of statvfs() in sg-dummy 2009-03-03 09:20:53 +00:00
b07c83ed86 Added a dummy function with loud compiler warning to sg.c dummy case 2009-03-02 20:01:37 +00:00
d74b1a2008 Fixed a race condition on abort with stdio writing which could cause SIGSEGV 2009-03-02 19:33:47 +00:00
8c56ca131f New operating system adapter "dummy" for stdio on POSIX-like systems 2009-03-02 17:01:21 +00:00
53e4483460 New stream_recording mode with start number 2009-02-27 21:17:05 +00:00
591c385489 New API function burn_drive_set_stream_recording() 2009-02-27 14:30:57 +00:00
b0f1f67495 Forgotten version leap to 0.6.3 in libburn.h 2009-02-20 13:23:57 +00:00
6139fb32dd Updated cdrskin tarball generator 2009-02-20 12:52:15 +00:00
01ed4729bd Made number transition to 0.6.3 2009-02-20 12:50:12 +00:00
350ac05bfd Human readable error messages with asynchronous SCSI errors 2009-02-19 19:28:16 +00:00
5f55a436e8 Mentioned hald as possibly conflicting service 2009-02-04 10:56:11 +00:00
3baaa886be Linking with $LIBBURN_ARCH_LIBS to get -lcam on FreeBSD 2009-02-04 10:28:26 +00:00
d4147e72f0 Mentioned the need for 64 bit file i/o 2009-01-27 12:10:39 +00:00
116798e081 Updated cookbook about BD-R media 2009-01-11 13:45:09 +00:00
7cc43c44e9 Prepared eventual closing of spoiled BD-R media by a pseudo write run 2009-01-11 10:28:05 +00:00
de0b3dd469 Preventing a possible bug with a burn run of more than one session at once 2009-01-09 16:17:25 +00:00
596d5bc5b0 Recognizing BD-R media spoiled by the close bug and handling them as appendable 2009-01-09 09:59:59 +00:00
867093d7d4 Mentioned bug fix and pl01 2009-01-07 15:50:05 +00:00
47dd4d8c09 Bug fix: BD-R were not correctly finalized 2009-01-07 15:44:30 +00:00
01a825310e Clarification about one-time DVD and BD media 2009-01-07 15:36:51 +00:00
96043eddf5 Complaining and refusing more early with unformatted BD-RE 2009-01-06 13:53:01 +00:00
5a65d6fa07 Complaining and refusing more early with unformatted BD-RE 2009-01-06 12:28:20 +00:00
aca01b88f3 Error texts for ASC 73 : power calibration and program memory 2009-01-06 12:25:53 +00:00
6d667880e5 Documented changes and release timestamp 2009-01-04 11:37:05 +00:00
1a667c86bc Updated cdrskin tarball generator 2009-01-04 11:36:33 +00:00
7c64d4bc13 Made number transition to 0.6.1 2009-01-04 11:35:19 +00:00
6fea3d0a9b Updated copyright claims to year 2009 2009-01-04 11:29:37 +00:00
687bde257c Cosmetic changes 2008-12-29 10:53:58 +00:00
1de41908a8 Fixed denial of fast formatting with BD-RE introduced by revision 2280 2008-12-22 13:05:51 +00:00
8af33586e8 Clarified blank, appendable, closed burn_disc_status 2008-12-19 20:35:43 +00:00
3ea5106d68 Removed project overview and references to libisofs and libisoburn 2008-12-17 11:12:19 +00:00
0ca643d0a4 Removed project overview and references to libisofs and libisoburn 2008-12-17 09:34:53 +00:00
d50c90b7be New API function burn_get_read_capacity() 2008-12-17 09:19:34 +00:00
1b5ab0834e Updated cdrskin web page 2008-12-14 14:39:40 +00:00
147cb430d1 Updated libburner to BD-R 2008-12-14 10:45:04 +00:00
1cbe3afdcc Now producing libburn.so.4.24.0 2008-12-13 14:49:39 +00:00
817edbaeea Interpreting feature 0023h for BD-R formatting capabilities 2008-12-12 21:40:34 +00:00
6552c8267c Making format size of BD-RE and BD-R quite freely adjustable 2008-12-12 11:22:14 +00:00
82fcf62309 Catching BD-R zero spare formatting with NOTE rather than SORRY 2008-12-11 09:22:33 +00:00
c1572c271f Rejecting unformattable BD-R more early 2008-12-11 07:23:29 +00:00
83ed108298 Mentioning BD-R in documentation 2008-12-10 17:16:19 +00:00
0d669b4369 Formatting of BD-R SRM to default size and by index 2008-12-10 11:43:28 +00:00
22554efe4f Formatting of BD-R SRM to default size and by index 2008-12-10 09:26:09 +00:00
eb7e20a02c Beginning to implement write code for BD-R SRM without POW 2008-12-09 12:36:28 +00:00
a5e2729604 Beginning to implement write code for BD-R SRM without POW 2008-12-09 12:35:13 +00:00
d52ea49eb6 Documented changes and release timestamp 2008-12-07 16:04:38 +00:00
96e1cc451c Updated cdrskin tarball generator 2008-12-07 16:02:30 +00:00
bfba58b0fa 2008-12-07 16:00:45 +00:00
175061615e Defaulting sessions without leadout entry 2008-12-03 08:52:44 +00:00
717ad0f412 Circumventing BD-RE Quick Certification refusal of LG GGW-H20L YL03 2008-11-29 14:04:31 +00:00
f3ea35b9b8 Translating ASC=0x31 formatting error messages, reporting command names 2008-11-29 14:01:41 +00:00
bb9ef6b988 Changed error severity with TOC truncation to MISHAP 2008-11-27 17:21:54 +00:00
aa606552eb Truncating eventually detected damaged CD table-of-content 2008-11-27 08:11:03 +00:00
9d99e7874a Added tests against the SIGSEGV of ticket 146 2008-11-26 21:06:37 +00:00
d1483a15da Mentioned FreeBSD peculiarities in our docs 2008-11-21 21:45:23 +00:00
ed60d9a644 Removed remark that use of statvfs() was untested with FreeBSD 2008-11-15 22:07:24 +00:00
bd5d8e8991 Documented changes and release timestamp 2008-11-12 12:54:21 +00:00
bf64271c67 Updated cdrskin tarball generator 2008-11-12 12:52:22 +00:00
b0c8bbd48d Made number transition to 0.5.7 2008-11-12 12:51:07 +00:00
2fb19dd08e Avoiding warning message about implicitely declared burn_fifo_abort() 2008-11-12 07:53:01 +00:00
2ce3199241 Disabling the sigsegv provoking new debug message 2008-11-08 20:25:38 +00:00
6fe53827da Cancelling libburn fifo thread before freeing the fifo object 2008-11-08 14:18:14 +00:00
6053f3a6e3 Clarified behavior of burn_source with pipes 2008-11-08 13:48:59 +00:00
de274ddaff Bug fix: Unsuitable write modes were caught silently and later than desired 2008-11-01 12:13:26 +00:00
92b0e145d5 Fixed incomplete sentence in man cdrskin 2008-10-15 10:35:06 +00:00
4a5083739d A clarification in comment about burn_disc_format() 2008-10-15 10:33:09 +00:00
7a8040fe9f Documented changes and release timestamp 2008-10-05 12:45:10 +00:00
57df15054f Updated cdrskin tarball generator 2008-10-05 12:43:18 +00:00
a57cf121d8 Made number transition to next development cycle 2008-10-05 12:41:44 +00:00
935239b4f9 Incremented LT_CURRENT and LT_AGE to get libburn.so.4.18.0 2008-10-04 07:39:22 +00:00
e50cc04374 Mentioned new xorriso capabilities in man cdrskin 2008-10-04 07:29:28 +00:00
89c12404d0 Prevented SIGSEGV after illegal drive operations during sync write 2008-10-04 07:27:43 +00:00
78642d08ae Bug fix: /dev/sr0 was accepted as enumerable address on Linux 2.4 2008-09-29 07:35:30 +00:00
c2c2499862 Bug fix: Potential buffer overflow introduced with revision 2024 2008-09-28 19:39:00 +00:00
32252122b8 Mentioned recent releases of libisofs and libisoburn 2008-09-24 20:34:01 +00:00
63a48571af Corrected pacifier text (Ticket 141) 2008-09-16 06:04:08 +00:00
006fb98aee Gave up problematic and unused version.h 2008-09-14 17:45:11 +00:00
afded80e10 Hopefully made out-of-tree building possible 2008-09-12 19:51:19 +00:00
fb3d2de5df Described ISO 9660 multi-session on overwriteable media 2008-09-12 10:04:41 +00:00
c640c7954b Trying to avoid unnecessary access to sibling device objects 2008-09-09 13:20:08 +00:00
bc30c4201a Issueing many SCSI error messages in cleartext now 2008-08-30 10:44:45 +00:00
50b587a22c Mentioned release of libisoburn-0.2.4 2008-08-30 10:39:46 +00:00
cd99716ab5 Documented changes and release timestamp 2008-08-20 10:09:35 +00:00
13bdbd3555 Updated cdrskin tarball generator 2008-08-20 10:08:16 +00:00
711c055730 Made number transition to 0.5.3 2008-08-20 10:06:01 +00:00
f64ed23a98 Reacted on harmless compiler warning 2008-08-19 12:36:10 +00:00
730c1555ab API clarification about CD burn_toc_entries 2008-08-19 12:26:48 +00:00
acd7dbc5c6 New flag bit2 with burn_read_data() 2008-08-09 07:19:54 +00:00
6dc9ecbcad CD burn_toc_entries now bear extension_valid data 2008-08-09 07:18:53 +00:00
5a99f9c4d8 Updated for next 0.5.1 cycle 2008-08-05 18:11:09 +00:00
ea17318e18 Taking into respect drive list from /proc/sys/dev/cdrom/info 2008-08-05 18:00:37 +00:00
98d742a4ef Avoiding drive scan if single drive is given 2008-08-01 10:10:13 +00:00
332a92ac78 Documented changes and release timestamp 2008-07-16 09:14:28 +00:00
6c50416d3c Updated cdrskin tarball generator 2008-07-16 09:13:36 +00:00
91d678a503 Made number transition to 0.5.1 and activated development documentation 2008-07-16 09:12:22 +00:00
54 changed files with 7866 additions and 1319 deletions

View File

@ -1,7 +1,7 @@
Derek Foreman <derek@signalmarketing.com> and Ben Jansens <xor@orodu.net>
Copyright (C) 2002-2006 Derek Foreman and Ben Jansens
Mario Danic <mario.danic@gmail.com>, Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2006-2008 Mario Danic, Thomas Schmitt
Copyright (C) 2006-2009 Mario Danic, Thomas Schmitt
This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,8 @@
pkgconfigdir=$(libdir)/pkgconfig
# ts A90315 : LIBBURNIA_PKGCONFDIR is defined OS specific in acinclude.m4
# was: pkgconfigdir=$(libdir)/pkgconfig
pkgconfigdir=$(LIBBURNIA_PKGCONFDIR)
libincludedir=$(includedir)/libburn
lib_LTLIBRARIES = libburn/libburn.la
@ -26,8 +30,6 @@ libburn_libburn_la_SOURCES = \
libburn/file.h \
libburn/init.c \
libburn/init.h \
libburn/lec.c \
libburn/lec.h \
libburn/libburn.h \
libburn/libdax_audioxtr.h \
libburn/libdax_audioxtr.c \
@ -63,6 +65,9 @@ libburn_libburn_la_SOURCES = \
libburn/write.h \
version.h
## libburn/lec.c \
## libburn/lec.h \
## libburn/sg-@ARCH@.c \
libinclude_HEADERS = \
@ -82,32 +87,34 @@ noinst_PROGRAMS = \
bin_PROGRAMS = \
cdrskin/cdrskin
LIBBURN_EXTRALIBS = $(LIBBURN_ARCH_LIBS) $(THREAD_LIBS)
test_libburner_CPPFLAGS = -Ilibburn
test_libburner_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
test_libburner_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS)
test_libburner_SOURCES = test/libburner.c
test_telltoc_CPPFLAGS = -Ilibburn
test_telltoc_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
test_telltoc_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS)
test_telltoc_SOURCES = test/telltoc.c
test_dewav_CPPFLAGS = -Ilibburn
test_dewav_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
test_dewav_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS)
test_dewav_SOURCES = test/dewav.c
test_fake_au_CPPFLAGS =
test_fake_au_LDADD =
test_fake_au_SOURCES = test/fake_au.c
test_poll_CPPFLAGS = -Ilibburn
test_poll_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
test_poll_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS)
test_poll_SOURCES = test/poll.c
test_structest_CPPFLAGS = -Ilibburn
test_structest_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
test_structest_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS)
test_structest_SOURCES = test/structest.c
## cdrskin construction site - ts A60816 - A80517
## cdrskin construction site - ts A60816 - A91012
cdrskin_cdrskin_CPPFLAGS = -Ilibburn
cdrskin_cdrskin_CFLAGS = -DCdrskin_libburn_0_4_9
cdrskin_cdrskin_CFLAGS = -DCdrskin_libburn_0_7_2
# cdrskin_cdrskin_LDADD = $(libburn_libburn_la_OBJECTS) $(THREAD_LIBS)
# cdrskin_cdrskin_LDADD = $(libburn_libburn_la_OBJECTS) $(LIBBURN_EXTRALIBS)
# ts A80123, change proposed by Simon Huggins to cause dynamic libburn linking
cdrskin_cdrskin_LDADD = libburn/libburn.la $(THREAD_LIBS)
cdrskin_cdrskin_LDADD = libburn/libburn.la $(LIBBURN_EXTRALIBS)
cdrskin_cdrskin_SOURCES = cdrskin/cdrskin.c cdrskin/cdrfifo.c cdrskin/cdrfifo.h cdrskin/cdrskin_timestamp.h
##

237
README
View File

@ -4,49 +4,60 @@
This all is under GPL.
(See GPL reference, our clarification and commitment at the end of this text)
------------------------------------------------------------------------------
libburnia-project.org
libburn-project.org
By Mario Danic <mario.danic@gmail.com> and Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2006-2008 Mario Danic, Thomas Schmitt
Still containing parts of
Libburn. By Derek Foreman <derek@signalmarketing.com> and
Ben Jansens <xor@orodu.net>
Copyright (C) 2006-2009 Mario Danic, Thomas Schmitt
Still containing parts of Libburn. By Derek Foreman <derek@signalmarketing.com>
and Ben Jansens <xor@orodu.net>
Copyright (C) 2002-2006 Derek Foreman and Ben Jansens
These parts are to be replaced by own code of above libburnia-project.org
copyright holders and then libburnia-project.org is to be their sole copyright.
This is done to achieve the right to issue the clarification and the
commitment as written at the end of this text.
The rights and merits of the Libburn-copyright holders Derek Foreman and
Ben Jansens will be duely respected.
This libburnia-project.org toplevel README (C) 2006-2008 Thomas Schmitt
http://files.libburnia-project.org/releases/libburn-0.7.2.pl00.tar.gz
------------------------------------------------------------------------------
Build and Installation
Our build system is based on autotools. For preparing the build of a SVN
snapshot you will need autotools of at least version 1.7.
Check out from SVN by
svn co http://svn.libburnia-project.org/libburn/trunk libburn
go into directory libburn and apply autotools by
./bootstrap
From tarball
Alternatively you may unpack a release tarball for which you do not need
autotools installed.
Obtain libburn-0.7.2.pl00.tar.gz, take it to a directory of your choice and do:
To build a libburnia-project.org subproject it should be sufficient to go
into its toplevel directory (here: "libburn") and execute
tar xzf libburn-0.7.2.pl00.tar.gz
cd libburn-0.7.2
./configure --prefix=/usr
make
To make libburn accessible for running resp. application development,
and to install the cdrecord compatibility binary cdrskin, do:
and to install the cdrecord compatibility binary cdrskin, do
(as Superuser):
make install
Above procedure installs cdrskin depending on libburn.so.4 .
This procedure installs libburn.so.4 and cdrskin depending on it.
For a standalone cdrskin binary, see cdrskin/README.
A behavioral conflict is known between any burn software and demons like hald
which probe CD drives. This can spoil burn runs for CD-R or CD-RW.
You may have to keep your hald away from the drive. See for example
http://www.freebsd.org/gnome/docs/halfaq.html
From SVN
Our build system is based on autotools. For preparing the build of a SVN
snapshot you will need autotools of at least version 1.7.
Do in a directory of your choice:
svn co http://svn.libburnia-project.org/libburn/trunk libburn-svn
cd libburn-svn
./bootstrap
./configure --prefix=/usr
make
make install
Warning: The trunk might contain experimental features which might not
persist until next release.
------------------------------------------------------------------------------
An important part of the project, libisofs, is hosted in a bzr repository at
launchpad.net :
@ -57,7 +68,6 @@ Another part the project, libisoburn, is hosted in the libburnia SVN, too:
See README files there.
------------------------------------------------------------------------------
@ -65,24 +75,27 @@ See README files there.
libburnia-project.org is an open-source software project for reading, mastering
and writing optical discs.
For now this means only CD media and all single layer DVD media except DVD+R.
For now this means CD media, all DVD media except DVD-R DL, all BD media.
The project comprises of several more or less interdependent parts which
together strive to be a usable foundation for application development.
These are libraries, language bindings, and middleware binaries which emulate
classical (and valuable) Linux tools.
Currently it is supported on Linux with kernels >= 2.4 and on FreeBSD versions
with ATAPI/CAM support enabled in the kernel, see atapicam(4).
On other X/Open compliant systems there will only be pseudo drives, but no
direct MMC operation on real CD/DVD/BD drives.
Our scope is currently Linux 2.4 and 2.6 only. For ports to other systems
we would need : login on a development machine resp. a live OS on CD or DVD,
advise from a system person about the equivalent of Linux sg or FreeBSD CAM,
volunteers for testing of realistic use cases.
For full ports to other systems we would need : login on a development machine
resp. a live OS on CD or DVD, advise from a system person about the equivalent
of Linux sg or FreeBSD CAM, volunteers for testing of realistic use cases.
We have a well tested code base for burning data and audio CDs and many DVD
types. The burn API is quite comprehensively documented and can be used to
build a presentable application.
We have a functional binary which emulates the core use cases of cdrecord in
order to prove that usability, and in order to allow you to explore libburn's
scope by help of existing cdrecord frontends.
We have a well tested code base for burning data and audio CDs, DVDs and BDs.
The burn API is quite comprehensively documented and can be used to build a
presentable application.
We have a functional application which emulates the core use cases of cdrecord
in order to prove that usability, and in order to allow you to explore
libburn's scope by help of existing cdrecord frontends.
ISO 9660 filesystems with Rock Ridge and Joliet extensions can be created
and manipulated quite freely. This capability together with our burn capability
@ -122,8 +135,9 @@ The project components (list subject to growth, hopefully):
- xorriso is an application of all three libraries which creates, loads,
manipulates and writes ISO 9660 filesystem images with
Rock Ridge extensions. Manipulation is not only adding or
overwriting of files but also deletion, renaming, and attribute
changing.
overwriting of files but also deleting, renaming, attribute
changing, incremental backups, activating boot images, and
extracting of files from ISO images to disk.
See xorriso/README for more.
- "test" is a collection of application gestures and examples given by the
@ -142,10 +156,17 @@ any way and even may revoke such new features before the next release of
x.y.*[02468]. As soon as it is released, a feature is promised to persist.
SONAMES:
libburn.so.4 (since 0.3.4, March 2007),
libisofs.so.6 (since 0.6.2, February 2008),
libburn.so.4 (since 0.3.4, March 2007),
libisofs.so.6 (since 0.6.2, February 2008),
libisoburn.so.1 (since 0.1.0, February 2008).
Applications must use 64 bit off_t. E.g. by defining
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
or take special precautions to interface with the libraries by 64 bit integers
where the .h files prescribe off_t. Not to use 64 bit file i/o will keep the
application from producing and processing ISO images of more than 2 GB size.
------------------------------------------------------------------------------
Project history as far as known to me:
@ -173,7 +194,7 @@ Project history as far as known to me:
discontent.
The situation first caused me to publically regret it and then - after i
got the opportunity to move in with cdrskin - gave me true reason to
personally apologize to Derek Foreman, Ben Jansens and the contibutors at
personally apologize to Derek Foreman, Ben Jansens and the contributors at
icculus.org/burn. Posted to both projects:
http://lists.freedesktop.org/archives/libburn/2006-August/000446.html
http://mailman-mail1.webfaction.com/pipermail/libburn-hackers/2006-August/000024.html
@ -277,7 +298,7 @@ Project history as far as known to me:
image tree nodes. It now depends on libisofs-0.6.4 and libburn-0.4.4.
xorriso makes use of new libisofs features by performing incremental
updates of directory trees and by cutting oversized data files into
pieces. A primitive single session emulation of cdrcord and mkisofs is
pieces. A primitive single session emulation of cdrecord and mkisofs is
provided.
- 10th May 2008 libburn-0.4.6 supports formatting and writing of BD-RE,
@ -294,6 +315,134 @@ Project history as far as known to me:
- 3rd Jun 2008 libisoburn-0.1.8 fixes a bug with overwriteable media.
- 23rd Jun 2008 libisoburn-0.2.0 introduces extraction of files from
ISO images.
- 16th Jul 2008 libburn-0.5.0 handles systems with no /dev/sr* but only
/dev/scd*.
- 19th Jul 2008 libisoburn/xorriso-0.2.2 can do multi-session in mkisofs
and cdrecord style. xorriso now can serve underneath growisofs.
- 20th Aug 2008 libburn-0.5.2 revokes the necessity that a drive must be
enumerable in order to be adressable. Enumeration is enhanced by examining
/proc/sys/dev/cdrom/info.
- 24th Aug 2008 libisoburn/xorriso-0.2.4 introduces a media readability check
with data retrieval option.
- 18th Sep 2008 libisofs-0.6.8 supports ISO 9660 Level 3 which allows very
large data files in the image.
- 20th Sep 2008 libisoburn/xorriso-0.2.6 takes into respect the new Level 3
capabilities of libisofs.
- 6th Oct 2008 libburn-0.5.4 adjusts the changes of 0.5.2 to the needs of
Linux kernel 2.4 and introduces human readable SCSI error messages.
- 6th Oct 2008 libisofs-0.6.10 fixes two bugs which prevented adding and
manipulation of ISOLINUX boot images.
- 15th Oct 2008 libisoburn/xorriso-0.2.8 can activate and maintain an
ISOLINUX boot image by an EL Torito boot record.
- 12th Nov 2008 libburn-0.5.6 fixes usage of freed memory by the fifo thread
of an aborted burn run.
- 26th Nov 2008 libisofs-0.6.12 can produce a ISOLINUX isohybrid MBR on the fly
and allows to produce ISO images which resemble old mkisofs images.
- 2nd Dec 2008 libisoburn-0.3.0. xorriso now is ready for exotic character
sets, for legacy FreeBSD systems which expect an outdated Rock Ridge
signature, and for producing ISO images with MBR which boot from hard disk
or USB stick. Three minor bugs were fixed.
- 7th Dec 2008 libburn-0.5.8 prevents a SIGSEGV with wierd CD table-of-content
and improves BD-RE formatting.
- 9th Dec 2008 Our project received a donation from Thomas Weber.
- 2nd Jan 2009 libburn-0.6.0 allows to format BD-R and to write to either
formatted or unformatted BD-R.
- 6th Jan 2009 libisoburn-0.3.2. xorriso can produce and execute commands for
mounting older sessions from all kinds of media. Pseudo-drives outside the
/dev/ tree can be addressed without prefix "stdio:".
- 20th Feb 2009 libburn-0.6.2 source release now compiles out of the box
on FreeBSD.
- 28 Feb 2009 libisofs-0.6.14 can record ACLs and Extended Attributes xattr
in its ISO images.
- 01 Mar 2009 libisoburn-0.3.4. xorriso makes use of the ACL and xattr
capabilities provided by libisofs for xorriso backup features.
- 11 Mar 2009 libisofs-0.6.16 of libisofs fixes two bugs which on Solaris
prevented to navigate the ISO images by ".." and to recognize the Rock Ridge
extensions of ISO images. The ban to build libisofs on operating systems
other than Linux and FreeBSD has been lifted.
- 13 Mar 2009 libburn-0.6.4 got a dummy adapter for SCSI/MMC command transport.
It will show no drives and thus libburn will only be able to perform
operations on "stdio:" pseudo drives. Nevertheless this allowed to lift the
ban to build libburn on operating systems other than Linux and FreeBSD.
- 16 Mar 2009 libisoburn-0.3.6: xorriso uses RRIP version 1.10 as default
in order to be mountable where mkisofs images are mountable.
- 17 Apr 2009 libisofs-0.6.18 introduces content filtering of data files.
Built-in filters allow compression to formats gzip and zisofs. External
filter processes allow arbitrary data conversions like encryption.
- 19 Apr 2009 libisoburn-0.3.8 makes use of the new libisofs capability to
perform content filtering of data files.
- 08 May 2009 libburn-0.6.6 fixes a bug with aborting on broken output pipe
and a bug with device scan on FreeBSD.
- 31 May 2009 libisofs-0.6.20 can record hard link relations in ISO images
and offers support with restoring them to disk. Current Linux kernels will
mount images with such hard links but will attribute a unique inode number
to each file.
- 28 Jun 2009 libisoburn-0.4.0: xorriso can record and restore hard link
relations of files. Performance of data reading has been improved. Option
-find now supports logical operators with its tests.
- 14 Jul 2009 libburn-0.6.8 fixes bugs and shortcommings with old MMC-1 drives
and with large SCSI bus numbers as handed out by Linux for USB drives.
- 20 Jul 2009 libisoburn-0.4.0.pl01 fixes a regression in xorriso which caused
data loss in older sessions if xorriso was used underneath growisofs.
Affected are releases since libisoburn-0.3.2 in january 2009.
- 25 Aug 2009 libisofs-0.6.22 can record MD5 checksums for the whole session
and for each single data file. Checksum tags allow to verify superblock and
directory tree before importing them.
- 27 Aug 2009 libburn-0.7.0 allows to calm down a drive and to inquire its
supported profiles. It works around some pitfalls with U3 enhanced memory
sticks which emulate a CD-ROM.
- 27 Aug 2009 libisoburn-0.4.0.pl00 can record MD5 checksums by which one may
verify the session or single data files in the image. When comparing image
files with files in the local filesystem, the MD5 sums avoid the need for
reading file content from the image.
- 22 Sep 2009 libisoburn-0.4.0.pl01 fixes a bug in xorriso option -cut_out.
- 08 Oct 2009 libisofs-0.6.24 fixes a bug which could cause the loss of blanks
in file names when a new session got added to an ISO image. With names
shorter than 251 characters this happened only to trailing blanks.
- 08 Oct 2009 libisoburn-0.4.0.pl02 fixes bugs with xorriso option -for_backup,
with xorrisofs -help, and with xorrecord -help.
- 12 Oct 2009 libburn-0.7.2 fixes a bug with CD TAO multi-track dummy sessions.
It can retrieve media product info and can process track input which was
prepared for CD-ROM XA Mode 2 Form 1. cdrskin now performs option -minfo.
------------------------------------------------------------------------------

View File

@ -1,9 +1,11 @@
AC_DEFUN([TARGET_SHIZZLE],
[
ARCH=""
LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
AC_MSG_CHECKING([target operating system])
case $target in
*-*-linux*)
ARCH=linux
@ -12,11 +14,66 @@ AC_DEFUN([TARGET_SHIZZLE],
*-*-freebsd*)
ARCH=freebsd
LIBBURN_ARCH_LIBS=-lcam
LIBBURNIA_PKGCONFDIR=$(echo "$libdir" | sed 's/\/lib$/\/libdata/')/pkgconfig
;;
*)
AC_ERROR([You are attempting to compile for an unsupported platform])
ARCH=
LIBBURN_ARCH_LIBS=
# AC_ERROR([You are attempting to compile for an unsupported platform])
;;
esac
AC_MSG_RESULT([$ARCH])
])
dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file.
dnl Important: Must be performed _after_ TARGET_SHIZZLE
dnl
AC_DEFUN([LIBBURNIA_SET_PKGCONFIG],
[
### for testing --enable-libdir-pkgconfig on Linux
### LIBBURNIA_PKGCONFDIR="$libdir"data/pkgconfig
if test "x$LIBBURNIA_PKGCONFDIR" = "x$libdir"/pkgconfig
then
dummy=dummy
else
AC_ARG_ENABLE(libdir-pkgconfig,
[ --enable-libdir-pkgconfig Install to $libdir/pkgconfig on any OS, default=no],
, enable_libdir_pkgconfig="no")
AC_MSG_CHECKING([for --enable-libdir-pkgconfig])
if test "x$enable_libdir_pkgconfig" = xyes
then
LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
fi
AC_MSG_RESULT([$enable_libdir_pkgconfig])
fi
libburnia_pkgconfig_override="no"
AC_ARG_ENABLE(pkgconfig-path,
[ --enable-pkgconfig-path=DIR Absolute path of directory for libisofs-*.pc],
libburnia_pkgconfig_override="yes" , enable_pkgconfig_path="none")
AC_MSG_CHECKING([for overridden pkgconfig directory path])
if test "x$enable_pkgconfig_path" = xno
then
libburnia_pkgconfig_override="no"
fi
if test "x$enable_pkgconfig_path" = x -o "x$enable_pkgconfig_path" = xyes
then
libburnia_pkgconfig_override="invalid argument"
fi
if test "x$libburnia_pkgconfig_override" = xyes
then
LIBBURNIA_PKGCONFDIR="$enable_pkgconfig_path"
AC_MSG_RESULT([$LIBBURNIA_PKGCONFDIR])
else
AC_MSG_RESULT([$libburnia_pkgconfig_override])
fi
AC_SUBST(LIBBURNIA_PKGCONFDIR)
dnl For debugging only
### AC_MSG_RESULT([LIBBURNIA_PKGCONFDIR = $LIBBURNIA_PKGCONFDIR])
])

View File

@ -4,15 +4,19 @@
cdrskin. By Thomas Schmitt <scdbackup@gmx.net>
Integrated sub project of libburnia-project.org but also published via:
http://scdbackup.sourceforge.net/cdrskin_eng.html
http://scdbackup.sourceforge.net/cdrskin-0.4.9.tar.gz
Copyright (C) 2006-2008 Thomas Schmitt, provided under GPL version 2.
http://scdbackup.sourceforge.net/cdrskin-0.7.2.pl00.tar.gz
Copyright (C) 2006-2009 Thomas Schmitt, provided under GPL version 2.
------------------------------------------------------------------------------
cdrskin is a limited cdrecord compatibility wrapper which allows to use
most of the libburn features from the command line.
Currently it is only supported on Linux with kernels >= 2.4.
Currently it is supported on Linux with kernels >= 2.4 and on FreeBSD versions
with ATAPI/CAM support enabled in the kernel, see atapicam(4).
On other X/Open compliant systems there will only be emulated drives, but no
direct MMC operation on real CD/DVD/BD drives.
By using this software you agree to the disclaimer at the end of this text
"This software is provided as is. There is no warranty implied and ..."
@ -20,10 +24,10 @@ By using this software you agree to the disclaimer at the end of this text
Compilation, First Glimpse, Installation
Obtain cdrskin-0.4.9.tar.gz, take it to a directory of your choice and do:
Obtain cdrskin-0.7.2.pl00.tar.gz, take it to a directory of your choice and do:
tar xzf cdrskin-0.4.9.tar.gz
cd cdrskin-0.4.9
tar xzf cdrskin-0.7.2.pl00.tar.gz
cd cdrskin-0.7.2
Within that directory execute:
@ -118,6 +122,11 @@ as listed device files. This addressing via e.g. /dev/sr0 or /dev/scd1 is
compatible with generic read programs like dd and with write program growisofs.
For finding /dev/sg1 from /dev/sr0, the program needs rw-access to both files.
A behavioral conflict is known between any burn software and demons like hald
which probe CD drives. This can spoil burn runs for CD-R or CD-RW.
You may have to keep your hald away from the drive. See for example
http://www.freebsd.org/gnome/docs/halfaq.html
Usage examples
@ -273,13 +282,16 @@ behavior.
BD-RE media need formatting before first use. cdrskin option "blank=as_needed"
recognizes unformatted BD-RE and applies a lengthy formatting run.
During write operations DVD-RAM and BD-RE automatically apply defect
management. This usually slows them down to half nominal speed. If drive
During write operations DVD-RAM and BD-RE automatically apply Defect
Management. This usually slows them down to half nominal speed. If drive
and media produce flawless results anyway, then one can try to reach full
nominal speed by option "stream_recording=on".
In this case bad blocks are not detected during write and not even previously
known bad blocks are avoided. So you have to make your own readability tests
and go back to half speed as soon as the first read errors show up.
Instead of "on" one may also set a start address for stream recording.
Like "stream_recording=100m". This will write slowly to the first 100 MB of
the media and accelerate when writing to higher addresses.
Option --grow_overwriteable_iso allows -multi (although unneeded), enables
-msinfo and -toc, and makes blank=fast an invalidator for ISO filesystems
@ -349,14 +361,24 @@ Incremental Streaming afterwards. So blank=fast will do full blanking.
blank=deformat_sequential_quickest is faster but might yield DAO-only media.
DVD+R and DVD+R DL
DVD+R , DVD+R DL , BD-R
From the view of cdrskin they behave much like DVD-R. Each track gets wrapped
into an own session, though.
DVD+R DL appear as extra large DVD+R. cdrskin does not allow to set the address
of the layer break where a reading drive might show some delay while switching
between both media layers.
BD-R are sold unformatted blank. If used without initial formatting then the
drive is supposed to format them to maximum payload size with no Defect
Management (see also above with BD-RE).
If Defect Management is desired then BD-R need to be formatted before the
first attempt to write a session to them.
blank=format_if_needed will detect the situation and eventually apply
default sized Defect Management formatting.
blank=format_defectmgt_* will apply non-default parameters to formatting.
Emulated Drives
@ -407,7 +429,7 @@ are the cause. Any mistake of the burn program is supposed to be caught
by the drive's firmware and to lead to mere misburns.
The worst mishaps which hit the author imposed the need to reboot the
system because of drives gnawing endlessly on ill media. Permanent hardware
damage did not occur in 2.5 years of development. But one never knows ...
damage did not occur in 3.5 years of development. But one never knows ...
------------------------------------------------------------------------------
@ -435,7 +457,7 @@ contributions in a due way.
Based on and sub project of:
libburnia-project.org
By Mario Danic <mario.danic@gmail.com> and Thomas Schmitt <scdbackup@gmx.net>
Copyright (C) 2006-2008 Mario Danic, Thomas Schmitt
Copyright (C) 2006-2009 Mario Danic, Thomas Schmitt
libburnia-project.org is inspired by and in other components still containing
parts of

View File

@ -38,7 +38,7 @@ original="./libburn_svn_release.tgz"
# My changes are in $changes , mainly in $changes/cdrskin
changes="./libburn-release"
skin_release="0.4.8"
skin_release="0.7.2"
patch_level=".pl00"
skin_rev="$skin_release""$patch_level"
@ -117,6 +117,7 @@ cp -a "$cdrskin_dir" "$cdrskin_target"
# Remove copied vim.swp and binaries
rm "$cdrskin_target"/.*.swp
rm "$cdrskin_target"/.*.swo
rm "$cdrskin_target"/*.o
rm "$cdrskin_target"/cdrfifo
rm "$cdrskin_target"/cdrskin

View File

@ -38,7 +38,7 @@ original="./libburn_svn.tgz"
# My changes are in $changes , mainly in $changes/cdrskin
changes="./libburn-develop"
skin_release="0.4.9"
skin_release="0.7.3"
patch_level=""
skin_rev="$skin_release""$patch_level"
@ -116,6 +116,7 @@ cp -a "$cdrskin_dir" "$cdrskin_target"
# Remove copied vim.swp and binaries
rm "$cdrskin_target"/.*.swp
rm "$cdrskin_target"/.*.swo
rm "$cdrskin_target"/*.o
rm "$cdrskin_target"/cdrfifo
rm "$cdrskin_target"/cdrskin
@ -239,7 +240,7 @@ rm -rf "$target"
./"$bintarget_dynamic" -version
./"$bintarget_static" -version
ls -l "$cdrskin_tarball"
ls -l "$bintarget_dynamic"*
ls -l "$bintarget_dynamic"
ls -l "$bintarget_static"
ls -l $(basename "$man_page_html")

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH CDRSKIN 1 "May 17, 2008"
.TH CDRSKIN 1 "Sep 10, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -16,7 +16,7 @@
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
cdrskin \- burns preformatted data to CD, DVD, and BD-RE via libburn.
cdrskin \- burns preformatted data to CD, DVD, and BD via libburn.
.SH SYNOPSIS
.B cdrskin
.RI [ options | track_source_addresses ]
@ -28,14 +28,14 @@ cdrskin \- burns preformatted data to CD, DVD, and BD-RE via libburn.
.\" respectively.
.PP
\fBcdrskin\fP is a program that provides some of cdrecord's options
in a compatible way for CD media. With DVD and BD-RE it has its own ways.
in a compatible way for CD media. With DVD and BD it has its own ways.
You do not need to be superuser for its daily usage.
.SS
.B Overview of features:
.br
Blanking of CD-RW and DVD-RW.
.br
Formatting of DVD-RW, DVD+RW, DVD-RAM, BD-RE.
Formatting of DVD-RW, DVD+RW, DVD-RAM, BD.
.br
Burning of data or audio tracks to CD,
.br
@ -45,7 +45,7 @@ or in Session at Once mode for seamless tracks.
.br
Multi session on CD (follow-up sessions in TAO only)
.br
or on DVD-R[W] (in Incremental mode) or on DVD+R[/DL].
or on DVD-R[W] (in Incremental mode) or DVD+R[/DL] or BD-R.
.br
Single session on DVD-RW or DVD-R (Disk-at-once).
.br
@ -67,7 +67,7 @@ Write mode selection
.br
Recordable CD Media
.br
Sequentially Recordable DVD Media
Sequentially Recordable DVD or BD Media
.br
Overwriteable DVD or BD Media
.br
@ -108,8 +108,9 @@ While audio tracks just contain a given time span of acoustic vibrations,
data tracks may have an arbitray meaning. Nevertheless, ISO-9660 filesystems
are established as a format which can represent a tree of directories and
files on all major operating systems. Such filesystem images can be
produced by programs mkisofs or genisoimage. They can also be extended by
follow-up tracks if prepared properly. See the man pages of said programs.
produced by programs mkisofs or genisoimage or xorriso.
They can also be extended by follow-up tracks if prepared properly.
See the man pages of said programs.
cdrskin is able to fulfill the needs about their option -C.
.br
Another type of data track content are archive formats which originally
@ -160,14 +161,16 @@ round of overwriting. Usually
is the appropriate option.
Blanking damages the previous content but does not
make it completely unreadable. It is no effective privacy precaution.
Multiple cycles of blanking and overwriting with random numbers might be.
Multiple cycles of blanking and overwriting with random numbers might be
needed.
.SS
.B Sequentially Recordable DVD Media:
.B Sequentially Recordable DVD or BD Media:
.br
Currently DVD-RW, DVD-R and DVD+R[/DL] can be used for the Sequential recording
model.
Currently DVD-RW, DVD-R , DVD+R[/DL], and BD-R can be used for the Sequential
recording model. It resembles the model of CD media. Only DVD-RW can be
blanked and re-used from scratch.
.br
This applies to DVD-RW only if they are in state "Sequential Recording".
DVD-RW are sequential media if they are in state "Sequential Recording".
The media must be either blank or appendable.
Newly purchased DVD-RW and DVD-R media are in this state.
Used DVD-RW get into blank sequential state by option
@ -199,14 +202,18 @@ unpredicted length and to keep media appendable by option
The only restriction towards CD-R[W] is the lack of support for -audio tracks.
Multiple tracks per session are permissible.
.br
The write modes for DVD+R[/DL] resemble those with DVD-R except that with +R
each track gets wrapped in an own session. There is no -dummy writing with
DVD+R[/DL].
The write modes for DVD+R[/DL] and BD-R resemble those with DVD-R except that
each track gets wrapped in an own session. There is no -dummy writing
with DVD+R[/DL] or BD-R.
.br
Quite deliberately write mode -sao insists in the tradition of a predicted
track size and blank media, whereas -tao writes the tracks open ended and
allows appendable media.
.br
BD-R may be formatted before first use to enable the Defect Management which
might catch and repair some bad spots at the expense of slow speed
even with flawless media.
.br
.B Note:
Option -multi might make DVD media unreadable in some DVD-ROM drives.
Best reader compatibility is achieved without it
@ -247,7 +254,7 @@ that it has to be formatted again. If in doubt, just give it a try.
.SS
.B Drive preparation and addressing:
.br
The drives, either CD burners or DVD burners, are accessed via addresses which
The drives, CD, DVD, or BD burners, are accessed via addresses which
are specific to libburn and the operating system. Those addresses get listed
by a run of \fBcdrskin --devices\fP.
.br
@ -351,7 +358,7 @@ audio track. Same is done for suffix ".au" and SUN Audio.
Option -audio may be used only with CD media and not with DVD or BD.
.TP
.BI blank= type
Blank a CD-RW, DVD-RW, or format a DVD-RW, DVD+RW, DVD-RAM, BD-RE.
Blank a CD-RW, DVD-RW, or format a DVD-RW, DVD+RW, DVD-RAM, BD.
This is combinable with burning in the same run of cdrskin.
The type given with blank= selects the particular behavior:
.RS
@ -363,7 +370,7 @@ It is a reason to abort if the media cannot assume thoroughly writeable state,
e.g. if it is non-blank write-once.
.br
This leaves unformatted DVD-RW in unformatted blank state. To format DVD-RW use
blank=format_overwriteable.
blank=format_overwriteable. Blank unformatted BD-R stay unformatted.
.br
(Note: blank=as_needed is not an original cdrecord option.)
.TP
@ -392,10 +399,11 @@ This is faster than full blanking but may yield media incapable of
Incremental Streaming (-tao).
.TP
format_if_needed
Format a media if it is not overwriteably formatted yet,
Format a media if it is not formatted yet,
and if cdrskin supports formatting for the media type,
and if formatting will not happen automatically during write.
This currently applies to unformatted DVD-RW, DVD-RAM and BD-RE.
This currently applies to unformatted DVD-RW, DVD-RAM, BD-RE,
and blank unformatted BD-R.
Eventually the appropriate default formatting is chosen.
If other media or states are encountered then nothing happens.
.br
@ -425,7 +433,7 @@ For DVD+RW this is the only supported explicit formatting type. It provides
complete "de-icing" so no reader slips on unwritten data areas.
.TP
format_defectmgt
Format DVD-RAM or BD-RE to reserve the default amount of spare blocks for
Format DVD-RAM or BD to reserve the default amount of spare blocks for
defect management.
.br
The following format_defectmgt_* allow to submit user wishes which
@ -449,25 +457,25 @@ Whether there happens certification at all depends much on the media state
and the actually selected format descriptor.
.TP
format_defectmgt_max
Format DVD-RAM or BD-RE to reserve a maximum number of spare blocks.
Format DVD-RAM or BD to reserve a maximum number of spare blocks.
.TP
format_defectmgt_min
Format DVD-RAM or BD-RE to reserve a minimum number of spare blocks.
Format DVD-RAM or BD to reserve a minimum number of spare blocks.
It might be necessary to format format_defectmgt_none first in order to get
offered the most minmal spare blocks sizes for format_defectmgt_min.
.TP
format_defectmgt_none
Format DVD-RAM or BD-RE to the largest available payload in the hope to disable
defect management at all. This seems not to have a speed increasing effect,
though.
defect management at all. This may or may not have a speed increasing effect.
Unformatted blank BD-R will be left unformatted.
.TP
format_defectmgt_payload_<size>
Format DVD-RAM or BD-RE. The text after "format_defectmgt_payload_" gives a
Format DVD-RAM or BD. The text after "format_defectmgt_payload_" gives a
number of bytes, eventually with suffixes "s", "k", "m". The largest number
of spare blocks will be chosen which allows at least the given payload size.
.TP
format_by_index_<number>
Format DVD-RW, DVD+RW, DVD-RAM or BD-RE.
Format DVD-RW, DVD+RW, DVD-RAM or BD.
The number after "format_by_index_" is used as index to the list of available
format descriptors. This list can be obtained by option --list_formats.
The numbers after text "Format idx" are the ones to be used with
@ -489,7 +497,15 @@ or DVD-R[W] in Disc-at-once mode.
.TP
.BI \-data
Subsequent tracks are data tracks. This option is default and only needed
to mark the end of the range of an eventual option -audio.
to mark the end of the range of an eventual option -audio or -xa1.
.br
Options -mode2, -xa, and -xa2 get mapped to -data, not using the desired CD
sector formats and thus not taking advantage of eventual higher payload.
.BI \-xa1
Subsequent tracks are data tracks with input suitable for CD-ROM XA mode 2
form 1. This differs from -data input by 8 additional header bytes per block.
cdrskin will not write CD-ROM XA but rather strip the header bytes and write as
-data tracks.
.TP
.BI dev= target
Set the address of the drive to use. Valid are at least the
@ -608,6 +624,10 @@ modesty_on_drive=1:min_percent=<percentage>:max_percent=95
.br
Percentage is permissible between 25 and 95.
.TP
.BI -minfo
Print information about the loaded media. This includes media type, writability
state, and a quite readable table of content.
.TP
.BI msifile= path
Run option -msinfo and copy the result line into the file given by path.
Unlike -msinfo this option does not redirect all normal output away from
@ -617,7 +637,8 @@ Note: msifile=path is actually an option of wodim and not of cdrecord.
.TP
.BI \-msinfo
Retrieve multi-session info for preparing a follow-up session by option -C
of programs mkisofs or genisoimage. Print result to standard output.
of programs mkisofs, genisoimage, or xorriso -as mkisofs.
Print result to standard output.
This option redirects to stderr all message output except the one of option
--tell_media_space and its own result string, which consists of two numbers.
The result string shall be used as argument of option -C with said programs.
@ -629,8 +650,8 @@ To have a chance for working on overwriteable media, this option has to be
accompanied by option --grow_overwriteable_iso.
.TP
.BI \-multi
This option keeps the CD or unformatted DVD-R[W] appendable after the current
session has been written.
This option keeps CD, unformatted DVD-R[W], DVD+R, or BD-R appendable
after the current session has been written.
Without it the disc gets closed and may not be written any more - unless it
is a -RW and gets blanked which causes loss of its content.
.br
@ -670,16 +691,9 @@ Add the given amount of trailing zeros to the next data track. This option
gets reset to padsize=0 after that next track is written. It may be set
again before the next track argument. About size specifiers, see option fs=.
.TP
.BI \-raw96r
Write CD in RAW/RAW96R mode. This mode allows to put more payload bytes
into a CD sector but obviously at the cost of error correction. It can only
be used for tracks of fixely predicted size. Some drives allow this mode but
then behave strange or even go bad for the next few attempts to burn a CD.
One should use it only if inavoidable.
.TP
.BI \-sao
Write CD in Session At Once mode, a sequential DVD-R[W] in Disc-at-once
(DAO) mode, or a DVD+R[/DL].
Write CD in Session At Once mode or sequential DVD-R[W] in Disc-at-once
(DAO) mode.
.br
With CD this mode is able to put several audio tracks on media without
producing audible gaps between them.
@ -687,7 +701,7 @@ producing audible gaps between them.
With DVD-R[W] this mode can only write a single track.
No -multi is allowed with DVD-R[W] -sao.
.br
-sao is permissible with overwriteable DVD, BD or DVD+R[/DL] but actually
-sao is permissible with overwriteable DVD, or DVD+R[/DL], or BD but actually
only imposes restrictions without providing known advantages.
.br
-sao can only be used for tracks of fixely predicted size. This implies that
@ -972,6 +986,10 @@ List all ignored cdrecord options. The "-" options cannot be used as addresses
of track sources. No track source address may begin with a text equal to an
option which ends by "=". The list is ended by an empty line.
.TP
.BI \--long_toc
Like option -toc but marking each session start by a line "first: X last: Y"
and each session end by "track:lout ...".
.TP
.BI \--no_rc
Only if used as first command line argument this option prevents reading and
interpretation of eventual startup files. See section FILES below.
@ -1080,8 +1098,9 @@ Linux specific: Do not ask the operating system to prevent opening busy drives.
Wether this leads to senseful behavior depends on operating system and kernel.
.TP
.BI drive_scsi_dev_family= sr | scd | sg
Linux specific: Select a SCSI device file family to be used for drive command
transactions. Normally this is /dev/sgN on kernel versions < 2.6 and /dev/srN
Linux specific: Select a SCSI device file family to be scanned for by
options --devices and -scanbus.
Normally this is /dev/sgN on kernel versions < 2.6 and /dev/srN
on kernels >= 2.6 . This option allows to explicitely override that default
in order to meet other programs at a common device file for each drive.
On kernel 2.4 families sr and scd will find no drives.
@ -1176,13 +1195,19 @@ Use and report literal Bus,Target,Lun addresses rather than real SCSI and
pseudo ATA addresses. This method is outdated and was never compatible with
original cdrecord.
.TP
.BI stream_recording="on"|"off"
.BI stream_recording="on"|"off"|number
By setting "on" request that compliance to the desired speed setting is
preferred over management of write errors. With DVD-RAM and BD-RE this can
preferred over management of write errors. With DVD-RAM and BD this can
bring effective write speed near to the nominal write speed of the media.
But it will also disable the automatic use of replacement blocks
if write errors occur. It might as well be disliked or ignored by the drive.
.br
If a number is given, then error management stays enabled for all byte
addresses below that number. Any number below 16s is the same as "off".
.TP
.BI --xa1-ignore
Silently interpret option -xa1 as -data. This may be necessary if a frontent
does not prepare -xa1 block headers but insists in using option -xa1.
.SH EXAMPLES
.SS
.B Get an overview of drives and their addresses:
@ -1227,15 +1252,15 @@ cdrskin -v dev=0,1,0 fs=32m speed=8 \\
.br
blank=as_needed padsize=300k -
.SS
.B Write multi-session to the same CD, DVD-R[W] or DVD+R[/DL]:
.B Write multi-session to the same CD, DVD-R[W], DVD+R[/DL], or BD-R:
.br
cdrskin dev=/dev/hdc -v padsize=300k -multi 1.iso
cdrskin dev=/dev/sr0 -v padsize=300k -multi 1.iso
.br
cdrskin dev=/dev/hdc -v padsize=300k -multi 2.iso
cdrskin dev=/dev/sr0 -v padsize=300k -multi 2.iso
.br
cdrskin dev=/dev/hdc -v padsize=300k -multi 3.iso
cdrskin dev=/dev/sr0 -v padsize=300k -multi 3.iso
.br
cdrskin dev=/dev/hdc -v padsize=300k 4.iso
cdrskin dev=/dev/sr0 -v padsize=300k 4.iso
.SS
.B Get multi-session info for option -C of program mkisofs:
.br

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
<HEAD>
<META NAME="description" CONTENT="cdrskin, a limited cdrecord compatibility wrapper for libburn">
<META NAME="keywords" CONTENT="cdrskin, libburn, libburnia, burn, CD, DVD, linux, recording, burning, CD-R, CD-RW, DVD-R, DVD-RW, DVD+RW, DVD+R, DVD+R/DL, DVD-RAM, BD-RE, cdrecord, compatible, scdbackup">
<META NAME="keywords" CONTENT="cdrskin, libburn, libburnia, burn, CD, DVD, linux, recording, burning, CD-R, CD-RW, DVD-R, DVD-RW, DVD+RW, DVD+R, DVD+R/DL, DVD-RAM, BD-RE, BD-R, cdrecord, compatible, scdbackup">
<META NAME="robots" CONTENT="follow">
<TITLE>cdrskin homepage english</TITLE>
</HEAD>
@ -24,7 +24,7 @@
<P>
<H2>Purpose:</H2>
Burns preformatted data to CD, DVD, and BD media:<BR>
CD-R, DVD-R, DVD+R, DVD+R/DL, CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE
CD-R, DVD-R, DVD+R, DVD+R/DL, BD-R, CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE
</P>
<P>
@ -34,10 +34,12 @@ CD-R, DVD-R, DVD+R, DVD+R/DL, CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE
<P>
<H2>Hardware requirements:</H2>
A CD/DVD/BD recorder suitable for
<A HREF="http://libburnia-project.org">http://libburnia-project.org</A> <BR>
(SCSI , ATA , USB , or SATA writers compliant to standard MMC-3 for CD
and to MMC-5 for DVD or BD).
About any CD, DVD, or BD recorder produced in the recent ten years.
<BR>
<A HREF="http://libburnia-project.org">libburn</A>
supports recorders which are compliant to standards MMC-1 for CD and
MMC-5 for DVD or BD. Linux and FreeBSD allow to access drives connected
via SCSI, PATA (aka IDE, ATA), USB, or SATA.
<BR>
</P>
@ -47,6 +49,8 @@ and to MMC-5 for DVD or BD).
<DT>Linux with kernel 2.4 or higher (and libc, of course) :</DT>
<DD>With kernel 2.4 an ATA drive has to be under ide-scsi emulation.</DD>
<DD>With kernel 2.6 the drive should not be under ide-scsi.</DD>
<DT>or FreeBSD (with libc, of course) :</DT>
<DD>ATAPI/CAM support has to be enabled in the kernel, see atapicam(4).</DD>
<DT>libpthread</DT>
<DD>is supposed to be a standard system component.</DD>
</DL>
@ -57,15 +61,18 @@ and to MMC-5 for DVD or BD).
GPL software included:<BR>
</H2>
<DL>
<DT>libburn-0.4.8</DT>
<DT>libburn-0.7.2</DT>
<DD>(founded by Derek Foreman and Ben Jansens,
furthered by team of libburnia-project.org)</DD>
<DD>transfers data to CD, DVD, BD-RE</DD>
developed and maintained since August 2006 by
Thomas Schmitt from team of libburnia-project.org)
</DD>
<DD>transfers data to CD, DVD, BD</DD>
</DL>
</P>
<P>
This program system has been tested on Intel/AMD Linux systems only.<BR>
This program system has been tested on Intel/AMD Linux and FreeBSD systems
only.<BR>
Ports to other usable systems are appreciated. Reports are welcome.
</P>
@ -88,7 +95,7 @@ are provided in a compatible way.<BR>
On all DVD media except DVD-R DL, cdrskin is able to perform any recording job
which is possible with cdrecord.
Other than with cdrecord, option -multi is supported with many DVD types and
write mode -tao works with anything but quickly blanked DVD-RW.
BD-R. Write mode -tao works with anything but quickly blanked DVD-RW.
</DT>
<BR><BR>
<DT>Get an overview of drives and their addresses</DT>
@ -104,7 +111,7 @@ as listed by option --devices.</DT>
<DT>Get info about a particular drive or loaded media:</DT>
<DD>$<KBD>&nbsp;cdrskin dev=0,1,0 -checkdrive</KBD></DD>
<DD>$<KBD>&nbsp;cdrskin dev=ATA:1,0,0 -v -atip</KBD></DD>
<DD>$<KBD>&nbsp;cdrskin dev=/dev/hdc -toc</KBD></DD>
<DD>$<KBD>&nbsp;cdrskin dev=/dev/hdc -minfo</KBD></DD>
<DT>Prepare CD-RW or DVD-RW for re-use, DVD-RAM or BD-RE for first use:</DT>
<DD>$<KBD>&nbsp;cdrskin -v dev=/dev/sg1 blank=as_needed -eject</KBD></DD>
@ -143,6 +150,9 @@ as listed by option --devices.</DT>
<DD><KBD>&nbsp;&nbsp;--tell_media_space 2>/dev/null)</KBD></DD>
<DD>$<KBD>&nbsp;echo "Available: $x blocks of 2048 data bytes"</KBD></DD>
<DT>Accelerate BD-RE writing to full nominal speed after the first 250 MB</DT>
<DD>$<KBD>&nbsp;cdrskin ... stream_recording=250m ...</KBD>
<DT>Write audio tracks to CD:</DT>
<DD>$<KBD>&nbsp;cdrskin -v dev=ATA:1,0,0 speed=48 -sao \</KBD></DD>
<DD><KBD>&nbsp;&nbsp;track1.wav track2.au -audio -swab track3.raw</KBD></DD>
@ -169,14 +179,11 @@ man cdrecord</A></KBD></DD>
<DL>
<DT>Learn to know a more versatile way to burn ISO 9660 formatted data</DT>
<DD>
Standalone ISO 9660 multi-session CD/DVD tool
Standalone ISO 9660 multi-session CD/DVD/BD tool
<A HREF="http://scdbackup.sourceforge.net/xorriso_eng.html">xorriso</A>.
</DD>
</DL>
Testers wanted who are willing to risk some DVD-R DL media
or to do experiments on BD-R media.
</P>
<HR>
@ -186,8 +193,8 @@ or to do experiments on BD-R media.
<P>
<DL>
<DT>Download as source code (see README):</DT>
<DD><A HREF="cdrskin-0.4.8.pl00.tar.gz">cdrskin-0.4.8.pl00.tar.gz</A>
(730 KB).
<DD><A HREF="cdrskin-0.7.2.pl00.tar.gz">cdrskin-0.7.2.pl00.tar.gz</A>
(780 KB).
</DD>
<DD>
The cdrskin tarballs are source code identical with libburn releases
@ -236,38 +243,52 @@ cdrskin_0.4.2.pl00-x86-suse9_0-static.tar.gz</A>, (310 KB), -static compiled,
<HR>
<P>
Enhancements towards previous stable version cdrskin-0.4.6.pl00:
Enhancements towards previous stable version cdrskin-0.7.0.pl00:
<UL>
<LI>none</LI>
</UL>
<LI>Better interpretation of options -mode2, -xa, -xa1, -xa2</LI>
<LI>New option --xa1-ignore</LI>
<LI>New -atip report lines "Product Id:" and "Producer:"</LI>
<LI>Emulation of some -minfo output</LI>
<!--
<LI>none</LI>
-->
Bug fixes towards cdrskin-0.4.6.pl00:
<UL>
<LI>Random access addressing for DVD-RAM and BD-RE did not work</LI>
</UL>
</P>
Bug fixes towards cdrskin-0.7.0.pl00:
<UL>
<LI>CD TAO sessions with multiple tracks did not work in -dummy mode</LI>
<!--
<LI>none</LI>
-->
</UL>
<HR>
<P>
<DL>
<DT><H3>Development snapshot, version 0.4.9 :</H3></DT>
<DD>Enhancements towards current stable version 0.4.8.pl00:
<DT><H3>Development snapshot, version 0.7.3 :</H3></DT>
<DD>Enhancements towards current stable version 0.7.2.pl00:
<UL>
<LI>none yet</LI>
<!--
-->
<LI>none yet</LI>
</UL>
</DD>
<DD>Bug fixes towards cdrskin-0.7.2.pl00:
<UL>
<LI>none yet</LI>
<!--
-->
</UL>
</DD>
<DD>&nbsp;</DD>
<DD><A HREF="README_cdrskin_devel">README 0.4.9</A>
<DD><A HREF="cdrskin__help_devel">cdrskin_0.4.9 --help</A></DD>
<DD><A HREF="cdrskin_help_devel">cdrskin_0.4.9 -help</A></DD>
<DD><A HREF="man_1_cdrskin_devel.html">man cdrskin (as of 0.4.9)</A></DD>
<DD><A HREF="README_cdrskin_devel">README 0.7.3</A>
<DD><A HREF="cdrskin__help_devel">cdrskin_0.7.3 --help</A></DD>
<DD><A HREF="cdrskin_help_devel">cdrskin_0.7.3 -help</A></DD>
<DD><A HREF="man_1_cdrskin_devel.html">man cdrskin (as of 0.7.3)</A></DD>
<DD>&nbsp;</DD>
<DT>Maintainers of cdrskin unstable packages please use SVN of
<A HREF="http://libburnia-project.org"> libburnia-project.org</A></DT>
@ -287,8 +308,8 @@ admins with full system souvereignty.</DT>
<A HREF="README_cdrskin_devel">upcoming README</A> ):
</DD>
<DD>
<A HREF="cdrskin-0.4.9.tar.gz">cdrskin-0.4.9.tar.gz</A>
(730 KB).
<A HREF="cdrskin-0.7.3.tar.gz">cdrskin-0.7.3.tar.gz</A>
(780 KB).
</DD>
<!-- This is not offered any more since spring 2008
@ -321,7 +342,7 @@ Historic versions based on Derek's and Ben's
<BR>
Very special thanks to Andy Polyakov whose
<A HREF="http://fy.chalmers.se/~appro/linux/DVD+RW/tools">dvd+rw-tools</A>
provide libburn with invaluable examples on how to deal with DVD media.
provide libburn with invaluable examples on how to deal with DVD and BD media.
</P>
<HR>
@ -329,14 +350,33 @@ provide libburn with invaluable examples on how to deal with DVD media.
<A NAME="examples">
<P>
<DL>
<DT>Example for a setup of device permissions. To be done by the superuser:</DT>
<DT>(CD devices which offer no rw-permission are invisible to normal users.)
<DT>Example for a setup of device permissions.</DT>
<DT>
Newer Linux distros enable rw-access for the desktop user automatically.
So try as normal user whether all your drives are found.
CD devices which offer no rw-permission will stay invisible.
</DT>
<DD>$ <KBD><B>cdrskin --devices</B></KBD></DD>
<DT>If not all desired drives show up, become superuser and do again:</DT>
</DT>
<DD># <KBD><B>cdrskin --devices</B></KBD></DD>
<DD><KBD>...</KBD></DD>
<DD><KBD>0&nbsp; dev='/dev/sr0'&nbsp; rwrwr- :&nbsp; 'TEAC' 'CD-ROM CD-532S'</KBD></DD>
<DD><KBD>0&nbsp; dev='/dev/sr0'&nbsp; rwr-r- :&nbsp; 'TEAC' 'CD-ROM CD-532S'</KBD></DD>
<DD><KBD>1&nbsp; dev='/dev/hdc'&nbsp; rwrw-- :&nbsp; 'LITE-ON' 'LTR-48125S'</KBD></DD>
<DT>Most simple and most insecure is this equivalent
of the usual cdrecord permissions u+s,a+x:</DT>
<DD># <KBD><B>chmod a+rw /dev/sr0 /dev/hdc</B></KBD></DD>
<DT>
More secure is to put the permitted users into a group like
"floppy", to assign /dev/sr0 /dev/hdc to this group,
and to allow rw-access only to group members.
</DT>
<DD># <KBD><B>vi /etc/group</B></KBD></DD>
<DD><KBD>...</KBD></DD>
<DD><KBD>floppy:x:19:thomas,scdbackup</KBD></DD>
<DD><KBD>...</KBD></DD>
<DD># <KBD><B>chgrp floppy /dev/sr0 /dev/hdc</B></KBD></DD>
<DD># <KBD><B>chmod g+rw /dev/sr0 /dev/hdc</B></KBD></DD>
</DL>
</P>
@ -464,12 +504,17 @@ and by <A HREF="http://sourceforge.net">sourceforge.net</A><BR>
<A href="http://sourceforge.net">
<IMG src="sflogo-88-1.png" BORDER="0" ALT="SourceForge Logo"></A>
<!-- on sourceforge use : <IMG src="http://sourceforge.net/sflogo.php?group_id=16010" width="88" height="31" border="0" alt="SourceForge Logo"></A> -->
<P>
Enjoying a FreeBSD shell account with the opportunity to
build and install cdrskin at<BR>
<A HREF="http://www.en.free-shells.com.ar">free-shells.com.ar</A>
</P>
</FONT></CENTER>
<HR>
<DL>
<DT>Links to my other published software projects :
<DD><A HREF="http://scdbackup.webframe.org/xorriso_eng.html">
xorriso, a standalone ISO 9660 multi-session CD/DVD burn tool.
xorriso, a standalone ISO 9660 multi-session CD/DVD/BD burn tool.
No mkisofs needed.
<DL>
<DD>

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2008.07.14.164528"
#define Cdrskin_timestamP "2009.10.12.080001"

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
#!/bin/sh
# compile_cdrskin.sh
# Copyright 2005 - 2008 Thomas Schmitt, scdbackup@gmx.net, GPL version 2
# Copyright 2005 - 2009 Thomas Schmitt, scdbackup@gmx.net, GPL version 2
# to be executed within ./libburn-* resp ./cdrskin-*
debug_opts="-O2"
def_opts=
largefile_opts="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1"
libvers="-DCdrskin_libburn_0_4_9"
libvers="-DCdrskin_libburn_0_7_2"
cleanup_src_or_obj="libburn/cleanup.o"
libdax_msgs_o="libburn/libdax_msgs.o"
libdax_audioxtr_o="libburn/libdax_audioxtr.o"
@ -33,15 +33,15 @@ do
libdax_audioxtr_o=
libdax_msgs_o="libburn/message.o"
cleanup_src_or_obj="-DCleanup_has_no_libburn_os_H cdrskin/cleanup.c"
elif test "$i" = "-libburn_0_4_8"
elif test "$i" = "-libburn_0_7_2"
then
libvers="-DCdrskin_libburn_0_4_8"
libvers="-DCdrskin_libburn_0_7_2"
libdax_audioxtr_o="libburn/libdax_audioxtr.o"
libdax_msgs_o="libburn/libdax_msgs.o"
cleanup_src_or_obj="libburn/cleanup.o"
elif test "$i" = "-libburn_svn"
then
libvers="-DCdrskin_libburn_0_4_9"
libvers="-DCdrskin_libburn_0_7_3"
libdax_audioxtr_o="libburn/libdax_audioxtr.o"
libdax_msgs_o="libburn/libdax_msgs.o"
cleanup_src_or_obj="libburn/cleanup.o"
@ -75,10 +75,8 @@ do
echo "Options:"
echo " -compile_cdrfifo compile program cdrskin/cdrfifo."
echo " -compile_dewav compile program test/dewav without libburn."
echo " -cvs_A60220 set macro to match libburn-CVS of 20 Feb 2006."
echo " -libburn_0_4_8 set macro to match libburn-0.4.8."
echo " -libburn_0_7_2 set macro to match libburn-0.7.2"
echo " -libburn_svn set macro to match current libburn-SVN."
echo " -no_largefile do not use 64 bit off_t (must match libburn)."
echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin."
echo " -experimental use newly introduced libburn features."
echo " -oldfashioned use pre-0.2.2 libburn features only."
@ -142,7 +140,6 @@ then
libburn/toc.o \
\
libburn/crc.o \
libburn/lec.o \
\
-lpthread

View File

@ -10,8 +10,8 @@ Schilling's cdrtools. cdrskin strives to be a second source for the services
traditionally provided by cdrecord. Currently it does CD-R and CD-RW this way.
Overwriteable media DVD-RAM, DVD+RW, DVD-RW, and BD-RE are handled differently
than with cdrecord-ProDVD in order to offer TAO-like single track recording.
Sequential DVD-R[W], DVD+R, DVD+R DL are handled like CD-R[W] with TAO and
multi-session. Additionally cdrskin offers cdrecord-ProDVD-like mode DAO
Sequential DVD-R[W], DVD+R, DVD+R DL, BD-R are handled like CD-R[W] with TAO
and multi-session. Additionally cdrskin offers cdrecord-ProDVD-like mode DAO
with DVD-R[W].
cdrskin does not contain any bytes copied from cdrecord's sources.

View File

@ -1,4 +1,4 @@
AC_INIT([libburn], [0.4.9], [http://libburnia-project.org])
AC_INIT([libburn], [0.7.2], [http://libburnia-project.org])
AC_PREREQ([2.50])
dnl AC_CONFIG_HEADER([config.h])
@ -7,7 +7,7 @@ AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([subdir-objects])
dnl Notes by ts A71207 - A80126 :
dnl Notes by ts A71207 - A91012 :
dnl
dnl Regrettably the meaning of the various version types was misunderstood
dnl before version 0.4.1.
@ -42,7 +42,8 @@ dnl So this is a superspace of the SONAME version space. To avoid
dnl ill SONAME, the value of CURRENT must be larger than AGE.
dnl See also http://www.gnu.org/software/libtool/manual.html#Interfaces
dnl
dnl The name of the dynamic library will be libburn.so.$SONAME.$AGE.$REV .
dnl On Linux the name of the dynamic library will be
dnl libburn.so.$SONAME.$AGE.$REV
dnl In the terminology of this file:
dnl CURRENT = LT_CURRENT
dnl AGE = LT_AGE
@ -62,6 +63,18 @@ dnl 0.4.2 = libburn.so.4.7.0
dnl 0.4.4 = libburn.so.4.9.0
dnl 0.4.6 = libburn.so.4.11.0
dnl 0.4.8 = libburn.so.4.13.0
dnl 0.5.0 = libburn.so.4.15.0
dnl 0.5.2 = libburn.so.4.17.0
dnl 0.5.4 = libburn.so.4.19.0
dnl 0.5.6 = libburn.so.4.21.0
dnl 0.5.8 = libburn.so.4.23.0
dnl 0.6.0 = libburn.so.4.25.0
dnl 0.6.2 = libburn.so.4.27.0
dnl 0.6.4 = libburn.so.4.29.0
dnl 0.6.6 = libburn.so.4.31.0
dnl 0.6.8 = libburn.so.4.33.0
dnl 0.7.0 = libburn.so.4.35.0
dnl 0.7.2 = libburn.so.4.37.0
dnl
dnl So LT_CURRENT, LT_REVISION and LT_AGE get set directly here.
dnl SONAME of the emerging library is LT_CURRENT - LT_AGE.
@ -86,8 +99,8 @@ dnl If BURN_*_VERSION changes, be sure to change AC_INIT above to match.
dnl
dnl As said: Only copies. Original in libburn/libburn.h : burn_header_version_*
BURN_MAJOR_VERSION=0
BURN_MINOR_VERSION=4
BURN_MICRO_VERSION=9
BURN_MINOR_VERSION=7
BURN_MICRO_VERSION=2
BURN_VERSION=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
AC_SUBST(BURN_MAJOR_VERSION)
@ -98,15 +111,15 @@ AC_SUBST(BURN_VERSION)
dnl Libtool versioning
LT_RELEASE=$BURN_MAJOR_VERSION.$BURN_MINOR_VERSION.$BURN_MICRO_VERSION
dnl
dnl ts A80713
dnl ### This is the release version libburn-0.4.8 = libburn.so.4.13.0
dnl ts A91012
dnl ### This is the release version libburn-0.7.2 = libburn.so.4.37.0
dnl This is the development version after above release version
dnl ### LT_CURRENT++, LT_AGE++ has not yet happened.
dnl LT_CURRENT++, LT_AGE++ has happened meanwhile.
dnl LT_CURRENT++, LT_AGE++ has not yet happened.
dnl ### LT_CURRENT++, LT_AGE++ has happened meanwhile.
dnl
dnl SONAME = 18 - 14 = 4 . Library name = libburn.so.4.14.0
LT_CURRENT=18
LT_AGE=14
dnl SONAME = 41 - 37 = 4 . Linux library name = libburn.so.4.37.0
LT_CURRENT=41
LT_AGE=37
LT_REVISION=0
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
@ -153,8 +166,19 @@ AC_SUBST(THREAD_LIBS)
TARGET_SHIZZLE
AC_SUBST(ARCH)
AC_SUBST(LIBBURNIA_PKGCONFDIR)
AC_SUBST(LIBBURN_ARCH_LIBS)
dnl ts A90303
dnl Check the preconditions for using statvfs() in sg-dummy
dnl (sg-linux and sg-freebsd use statvfs() unconditionally)
STATVFS_DEF=-DLibburn_os_has_statvfS
AC_CHECK_HEADER(sys/statvfs.h, X=, STATVFS_DEF=)
AC_CHECK_FUNC([statvfs], X=, STATVFS_DEF=)
dnl If this would be done more specifically in Makefile.am
dnl via libburn_libburn_la_CFLAGS then undesired .o file names would emerge
CFLAGS="$CFLAGS $STATVFS_DEF"
dnl Add compiler-specific flags
dnl See if the user wants aggressive optimizations of the code
@ -174,6 +198,13 @@ else
CFLAGS="$CFLAGS -DDEBUG"
fi
dnl Determine target directory for libburn-*.pc
dnl Important: Must be performed _after_ TARGET_SHIZZLE
dnl
LIBBURNIA_SET_PKGCONFIG
AC_CONFIG_FILES([
Makefile
doc/doxygen.conf

View File

@ -1,106 +1,51 @@
/**
@author Mario Danic, Thomas Schmitt
@mainpage Libburnia Documentation Index
@mainpage Libburn Documentation Index
@section intro Introduction
Libburnia is an open-source project for reading, mastering and writing
optical discs.
optical discs. This page is about its capability to handle optical media.
For now this means CD-R, CD-RW, DVD-RAM, DVD+RW, DVD+R, DVD+R/DL, DVD-RW,
DVD-R, BD-RE.
DVD-R, BD-R, BD-RE.
Not supported yet are DVD-R/DL, HD-DVD, BD-R (blue ray). Testers for
DVD-R/DL are wanted, though. BD-R programming efforts would be made
if an interested tester contacts us.
Not supported yet are DVD-R/DL. Testers wanted.
The project comprises of several more or less interdependent parts which
together strive to be a usable foundation for application development.
These are libraries, language bindings, and middleware binaries which emulate
classical (and valuable) Linux tools.
Our scope is currently Linux 2.4 and 2.6, or FreeBSD . For ports to other
systems we would need : login on a development machine resp. a live OS on CD
or DVD, advise from a system person about the equivalent of Linux sg or FreeBSD
CAM, volunteers for testing of realistic use cases.
Our scope is currently Linux 2.4 and 2.6 only. For ports to other systems
we would need : login on a development machine resp. a live OS on CD or DVD,
advise from a system person about the equivalent of Linux sg or FreeBSD CAM,
volunteers for testing of realistic use cases.
libburn is the library by which preformatted data get onto optical media.
Its code is independent of cdrecord. Its DVD capabilities are learned from
studying the code of dvd+rw-tools and MMC-5 specs. No code but only the pure
SCSI knowledge has been taken from dvd+rw-tools, though.
We have a well tested code base for burning data and audio CDs and many DVD
types. The burn API is quite comprehensively documented and can be used to
build a presentable application.
We have a functional binary which emulates the core use cases of cdrecord in
order to prove that usability, and in order to allow you to explore libburn's
scope by help of existing cdrecord frontends.
cdrskin is a limited cdrecord compatibility wrapper for libburn.
cdrecord is a powerful GPL'ed burn program included in Joerg Schilling's
cdrtools. cdrskin strives to be a second source for the services traditionally
provided by cdrecord. Additionally it provides libburn's DVD/BD capabilities,
where only -sao is compatible with cdrecord.
cdrskin does not contain any bytes copied from cdrecord's sources.
Many bytes have been copied from the message output of cdrecord runs, though.
See cdrskin/README for more.
ISO 9660 filesystems with Rock Ridge and Joliet extensions can be created
and manipulated quite freely. This capability together with our burn capability
makes possible a single binary application which covers all steps of image
composition, updating and writing. Quite unique in the Linux world.
The burn API example of libburn is named test/libburner.c . The API for media
information inquiry is demonstrated in test/telltoc.c .
Explore these examples if you look for inspiration.
@subsection components The project components (list subject to growth, hopefully):
- libburn is the library by which preformatted data get onto optical media.
It uses either /dev/sgN (e.g. on kernel 2.4 with ide-scsi) or
/dev/srM or /dev/hdX (e.g. on kernel 2.6).
libburn is the foundation of our cdrecord emulation. Its code is
independent of cdrecord. Its DVD capabilities are learned from
studying the code of dvd+rw-tools and MMC-5 specs. No code but only
the pure SCSI knowledge has been taken from dvd+rw-tools, though.
- libisofs is the library to pack up hard disk files and directories into a
ISO 9660 disk image. This may then be brought to CD via libburn.
libisofs is to be the foundation of our upcoming mkisofs emulation.
- libisoburn is an add-on to libburn and libisofs which coordinates both and
also allows to grow ISO-9660 filesystem images on multi-session
media as well as on overwriteable media via the same API.
All media peculiarities are handled automatically.
- cdrskin is a limited cdrecord compatibility wrapper for libburn.
cdrecord is a powerful GPL'ed burn program included in Joerg
Schilling's cdrtools. cdrskin strives to be a second source for
the services traditionally provided by cdrecord. Additionally it
provides libburn's DVD/BD capabilities, where only -sao is
compatible with cdrecord.
cdrskin does not contain any bytes copied from cdrecord's sources.
Many bytes have been copied from the message output of cdrecord
runs, though.
See cdrskin/README for more.
- xorriso is an application of all three libraries which creates, loads,
manipulates and writes ISO 9660 filesystem images with
Rock Ridge extensions. Manipulation is not only adding or
overwriting of files but also deletion, renaming, and attribute
changing. An incremental backup feature is provided.
See xorriso/README for more
- "test" is a collection of application gestures and examples given by the
authors of the library features. The burn API example of libburn
is named test/libburner.c . The API for media information inquiry is
demonstrated in test/telltoc.c .
Explore these examples if you look for inspiration.
We strive to be a responsive upstream.
Our libraries are committed to maintain older feature sets in newer versions.
This applies to source code headers (API) as well as to linkable objects (ABI).
The only exception from this rule is about non-release versions x.y.*[13579]
which are allowed to introduce new features, change those new features in
any way and even may revoke such new features before the next release of
x.y.*[02468]. As soon as it is released, a feature is promised to persist.
SONAMES:
SONAME:
libburn.so.4 (since 0.3.4, March 2007),
libisofs.so.6 (since 0.6.2, February 2008),
libisoburn.so.1 (since 0.1.0, February 2008).
@section using Using the libraries
@section using Using libburn
Our build system is based on autotools.
User experience tells us that you will need at least autotools version 1.7.
To build libburn and its subprojects it should be sufficient to go into
its toplevel directory and execute
To build libburn and its companion applications go into its toplevel directory
and execute
- ./bootstrap (needed if you downloaded from SVN)
@ -112,29 +57,24 @@ To make the libraries accessible for running resp. developing applications
- make install
Both libraries are written in C language and get built by autotools.
Thus we expect them to be useable by a wide range of Linux-implemented
languages and development tools.
@section libburner Libburner
libburner is a minimal demo application for the library libburn
(see: libburn/libburn.h) as provided on http://libburnia-project.org .
It can list the available devices, can blank a CD-RW or DVD-RW and
can burn to recordable CD and recordable single layer DVD.
It can list the available devices, can burn to recordable CD, DVD, or BD,
can blank a CD-RW or DVD-RW, and can format unformatted DVD-RW, BD-R, or BD-RE.
It's main purpose, nevertheless, is to show you how to use libburn and also
to serve the libburnia team as reference application. libburner does indeed
define the standard way how above three gestures can be implemented and
stay upward compatible for a good while.
define the standard way how above gestures can be implemented and stay upward
compatible for a good while.
@subsection libburner-help Libburner --help
<pre>
Usage: test/libburner
[--drive <address>|<driveno>|"-"] [--audio]
[--blank_fast|--blank_full|--format_overwrite]
[--try_to_simulate]
[--blank_fast|--blank_full|--format] [--try_to_simulate]
[--multi] [<one or more imagefiles>|"-"]
Examples
A bus scan (needs rw-permissions to see a drive):
@ -147,8 +87,8 @@ Blank a used CD-RW (is combinable with burning in one run):
test/libburner --drive /dev/hdc --blank_fast
Blank a used DVD-RW (is combinable with burning in one run):
test/libburner --drive /dev/hdc --blank_full
Format a DVD-RW to avoid need for blanking before re-use:
test/libburner --drive /dev/hdc --format_overwrite
Format a DVD-RW, BD-RE or BD-R:
test/libburner --drive /dev/hdc --format
Burn two audio tracks (to CD only):
lame --decode -t /path/to/track1.mp3 track1.cd
test/dewav /path/to/track2.wav -o track2.cd

View File

@ -1,4 +1,4 @@
libburnia-project.org Optical Media Rotisserie Recipes as of April 2008
libburnia-project.org Optical Media Rotisserie Recipes as of January 2009
Content:
- TAO Multi-Session CD Cookbook (CD-R, CD-RW)
@ -6,6 +6,7 @@ Content:
- Overwriteable DVD Cookbook (DVD-RAM, DVD+RW, DVD-RW, BD-RE)
- Sequential DVD-R[W] Cookbook
- DVD+R[/DL] Cookbook
- BD-R Cookbook
-------------------------------------------------------------------------------
TAO Multi-Session CD Cookbook
@ -404,7 +405,7 @@ correctness of Pre-gap and Post-gap would become evident.
Inspired by Andy Polyakov's http://fy.chalmers.se/~appro/linux/DVD+RW/tools ,
backed by reading mmc5r03c.pdf from http://www.t10.org/ftp/t10/drafts/mmc5/
by own experiments with drives NEC ND-4570A, LG GSA-4082B, PHILIPS SPD3300L,
and by BD-RE experiments done by Giulio Orsero on LG BE06LU10.
LG GGW H20L, and by BD-RE experiments done by Giulio Orsero on LG BE06LU10.
For libburnia-project.org by Thomas Schmitt <scdbackup@gmx.net>
@ -432,6 +433,10 @@ The recipes described here are depending on formatting state:
- DVD-RAM and BD-RE formatting
- DVD-RAM and BD-RE speed tuning
Slightly off topic are
- ISO 9660 multi-session emulation on overwriteable media
- ISO 9660 based TOC emulation on overwriteable media
-------------------------------------------------------------------------------
Overwriting in general :
@ -522,7 +527,7 @@ with Close Function 010b despite there is no session open in this scenario.)
-------------------------------------------------------------------------------
Unformatted DVD+RW
Unformatted DVD+RW :
This is the state of previously unused DVD+RW media.
@ -693,9 +698,14 @@ managment. There is no way to increase payload capacity by format 01h.
(mmc5r03c.pdf 6.5.4.2.2.1)
With BD-RE there are three format types : 00h, 30h and 31h.
00h offers the default size format.
00h offers the default size format. This may be the only fast formatting
mode that is offered by the drive.
Feature 0023h tells whether format 31h and certain 30h subtypes are available.
(mmc5r03c.pdf 5.3.13)
30h offers several sizes with defect management. Usually there are three
size to choose: #1: default size, #2: maximum spare area, #3: minimal spare.
sizes given: #1: default size, #2: maximum spare area, #3: minimal spare.
One may demand any spare size between maximum and minimum. There may be quick
certification and full certification. See feature 0023h.
31h offers a single size and disables defect management. This has the side
effect to speed up writing to nominal speed.
(mmc5r03c.pdf 6.5.4.2.15, 6.24.3.3, Table 472)
@ -734,7 +744,7 @@ DVD-RAM and BD-RE tuning :
A special aspect of DVD-RAM and BD-RE is their low speed with write operations,
which usually is only half than the nominal speed of media and drive.
This is blamed to the automatic checkreading which happens ifor managing
This is blamed to the automatic checkreading which happens for managing
eventual defects.
Defect management of BD-RE can be disabled by format type 31h. See above.
@ -745,7 +755,7 @@ The only known way to get full speed from DVD-RAM or BD-RE with enabled defect
management is the use of AAh WRITE12 with Streaming Bit set to 1.
(mmc5r03c.pdf 6.45)
With some DVD-RAM drives this fails if a write buffer is not full 32 kB.
With the tested BD-RE ione has to write write full 64 kB buffers.
With the tested BD-RE one has to write full 64 kB buffers.
Although it seems not optimal, this is specified not only to disable the
cumbersome checkread but also to ignore known defects and to write data
@ -756,10 +766,80 @@ incorrectable errors.
Caveat:
MMC-5 does not guarantee AAh WRITE12 to work on DVD-RAM or BD-RE at all.
None of the features of profiles 0012h and 0043 promises the existence of
None of the features of profiles 0012h and 0043h promises the existence of
AAh WRITE12.
Nevertheless it worked on all tested drives is proper alignment was observed.
(mmc5r03c.pdf 5.4.13, 6.45)
Nevertheless it worked on all tested drives if proper alignment was observed.
-------------------------------------------------------------------------------
ISO 9660 multi-session emulation on overwriteable media :
Overwriteable media provide a single overwriteable track which may grow up to
the full media capacity. There is no builtin table-of-content which records
the history of write sessions.
mount -t iso9660 will use sbsector=0 as default.
The term "superblock" shall depict the first 64 KiB after the sbsector address.
ISO 9660 multi-session depends on typical TOC information in two ways:
It needs the superblock address MSC1 of the most recently recorded session and
it needs the Next Writeable Address NWA for which to prepare the adress offset.
The following is learned from growisofs and from ECMA-119:
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-119.pdf
ISO 9660 filesystems provide information about the number of sectors which
is also the lowest unused block address and thus a suitable NWA.
This block address is stored in the Primary Volume Descriptor which is supposed
to be stored in block 16 (eventually relative to MSC1).
The bytes 0 to 5 of a PVD block are
0x01 'C' 'D' '0' '0' '1'
The sector count can then be read from byte 80 to 83
sectors= pvd[80] | (pvd[81] << 8) | (pvd[82] << 16) | (pvd[83] << 24);
(Ecma-119.pdf 8.4)
To support CD, DVD and BD media alike, it is advisable to round the NWA
to the next multiple of 32 (= 64 KiB).
So one can use 0 as MSC1 and prepare a new ISO session for the computed NWA.
After writing the session it is necessary to patch the PVD at LBA 16.
The minimal change would be to update the number of image sectors.
It is stored in both notations LSB and MSB:
for(i= 0; i < 4; i++)
pvd[87 - i]= pvd[80 + i]= (sectors >> (8 * i)) & 0xff;
cdrskin --grow_overwriteable_iso not only patches the sector fields of the
PVD block but also the blocks up to LBA 31 which begin with
0xff 'C' 'D' '0' '0' '1'
libisoburn submits 64 KiB data buffer to libisofs before image generation and
afterwards writes these 64 KiB as new superblock to LBA 0.
-------------------------------------------------------------------------------
ISO 9660 based TOC emulation on overwriteable media :
Above method of multi-session emulation yields a single session image after
each add-on session. No reliable session history can be read because the
sector size of the existing session gets overwritten by the new one.
A TOC with session history is nevertheless desirable with incremental backups
in order to access older backup states by mounting older superblocks at the
start addresses of older sessions.
All usual ISO 9660 formatter programs write a complete superblock to the
start of each session.
With a uniform NWA rounding rule it is possible to compute the address of
superblock N+1 as the NWA after session N. The only problem is N=1
because it gets overwritten by later sessions.
libisoburn preserves the information of session 1 by writing the first session
to LBA 32 rather than LBA 0. Afterwards it writes the overall superblock to
LBA 0 (up to 31).
So with all further add-on sessions the superblock at LBA 0 will enclose the
overall image, while the superblocks of the sessions form a chain beginning
at LBA 32. Each session superblock points to the next one by its sector count
rounded up to 32. The chain end is marked by the overall image size.
This chain gives the start addresses of sessions. The sector count minus start
address gives the size of a particular session. ECMA-119 explains how to
retrieve more info from the PVD (e.g. the volume id).
-------------------------------------------------------------------------------
@ -1199,3 +1279,118 @@ in http://libburnia-project.org/ticket/13 .
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
BD-R Cookbook
-------------------------------------------------------------------------------
Inspired by reading mmc5r03c.pdf from http://www.t10.org/ftp/t10/drafts/mmc5/
backed by experiments iwith drive LG GGW H20L.
For libburnia-project.org by Thomas Schmitt <scdbackup@gmx.net>
-------------------------------------------------------------------------------
Media type can be recognized by Current Profile from 46h GET CONFIGURATION.
(mmc5r03c.pdf 6.6.2.1)
BD-R 0042h
There are two basic recording modes defined: Sequential Recording Mode SRM and
Random Recording Mode RRM. The latter is optional and for now not topic of this
text.
(mmc5r03c.pdf 4.5.3.5)
- SRM Formatting
- Writing a session in SRM-POW
(- Pseudo-OverWrite SRM+POW)
-------------------------------------------------------------------------------
SRM Formatting:
Despite being write-once media BD-R can optionally carry some formatting.
SRM has a disc structure model with tracks and sessions.
Several tracks may be open at the same time, each having its own NWA.
(mmc5r03c.pdf 4.5.3.5.2.2)
This structure is formatted onto blank media automatically as soon as the
first serious write attempt occurs.
(mmc5r03c.pdf 4.5.3.5)
Before such a write attempt, blank media may be explicitely formatted with
spares, which provide defect management.
(mmc5r03c.pdf 4.5.3.5.3)
Tracks get created from other tracks via RESERVE TRACK splitting.
(mmc5r03c.pdf 4.5.3.5.2.5)
On top of defect management there may be Pseudo-OverWrite SRM+POW, a costly
way to write several times to the same LBA. See below.
Fully sequential states are called SRM-POW.
(mmc5r03c.pdf 4.5.3.5.4)
Explicite formatting is done by 04h FORMAT UNIT. Its data payload consists
of a Format List Header and a Format Descriptor. It is advisable to set
the Immed bit and the FOV bit in header byte number 1. The descriptor should
be a copy of a descriptor from 23h READ FORMAT CAPACITIES but the size may be
adjusted within a certain range.
(mmc5r03c.pdf 6.5, 6.5.3.2, 6.5.3.3)
Format type 00h creates SRM layouts with a default number of spares (or
eventually RRM) chosen by the format sub-type:
00b = SRM with support for POW
01b = SRM without POW (but with some spares for defect management)
10b = (RRM)
(mmc5r03c.pdf 6.5.4.2.1.6)
Format type 32h uses the same sub-types but allows to allocate non-default
amounts of spares. Similar to BD-RE format 31h, three format descriptors are
offered: #1: default size, #2: maximum spare area, #3: minimal spare.
The size may be chosen within that range.
The sense behind the Type Dependent Parameters is obscure
to me. Best will be to set ISA_V and TDMA_V to 0.
(mmc5r03c.pdf 6.5.4.2.1.17)
-------------------------------------------------------------------------------
Writing a session in SRM:
The procedure and constraints for writing BD-R SRM-POW are very similar to
DVD+R. libburn flatly re-uses its DVD+R code except the Close Function for
finalizing a disc.
In short:
If all written sessions are closed, then there is exactly one NWA.
In the beginning there is an empty session and track. A new track can be
written either with pre-announced size (by RESERVE TRACK) or open-end by
simply starting to write to the NWA. When done the track gets closed by
close function 001b. Then either session or disc gets closed depending on
the Close Function used:
- Close Function 010b closes the session and keeps the media appendable
(same as with DVD+R)
- Close Function 110b finalizes the media and makes it read-only.
(differs from libburn DVD+R procedure which uses 101b)
-------------------------------------------------------------------------------
Pseudo-OverWrite POW: (no used yet by libburn)
This enhancement of SRM emulates overwriting of existing data blocks.
(mmc5r03c.pdf 4.5.3.5.4)
POW establishes a virtual vLBA space on top of the real address space rLBA.
All read and write commands deal with vLBA. It seems that track NWAs are
assumed to be identical in vLBA space and in rLBA space.
It is not clear whether one may write to vLBA blocks which are neither written
yet nor at one of the track NWAs. Probably not, or else one could make NWAs run
into vLBAs which are associated with older rLBAs.
Replacing invalidated blocks consumes addresses in rLBA space at the NWA of
some track. I.e. no spares are consumed by POW. Nevertheless it is costly by
a special map called Orphanage. It covers rLBA which have been consumed
by differing vLBAs. It never shrinks and can grow with each write to remapped
addresses.
To avoid heavy Orphanage growth it is advised to write mostly to vLBA which
still coincide with their rLBA. E.g. those addresses which have neither been
written as rLBA nor as vLBA yet. So one should begin the vLBA of new sessions
at the NWA of a sufficiently sized track.
(mmc5r03c.pdf 4.5.3.5.4.2 , 4.5.3.6.9)
-------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY =
OUTPUT_DIRECTORY = @abs_top_builddir@
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@ -104,7 +104,7 @@ INLINE_INHERITED_MEMB = NO
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = YES
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
@ -113,7 +113,7 @@ FULL_PATH_NAMES = YES
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH = @top_srcdir@
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells

1198
doc/mediainfo.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,9 +25,9 @@
#include "drive.h"
#include "write.h"
#include "options.h"
#include "file.h"
#include "async.h"
#include "init.h"
#include "file.h"
#include "back_hacks.h"
#include <pthread.h>
@ -376,7 +376,7 @@ static void *format_worker_func(struct w_list *w)
void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
{
struct format_opts o;
int ok = 0;
int ok = 0, ret;
char msg[160];
if ((SCAN_GOING()) || find_worker(drive) != NULL) {
@ -409,8 +409,82 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
flag |= 4; /* format up to maximum size */
} else if (drive->current_profile == 0x12) {
ok = 1; /* DVD-RAM */
} else if (drive->current_profile == 0x41) {
/* BD-R SRM */
ok= 1;
ret = drive->read_format_capacities(drive, 0x00);
if (ret > 0 &&
drive->format_descr_type == BURN_FORMAT_IS_FORMATTED)
ok = 0;
if (drive->status != BURN_DISC_BLANK)
ok = 0;
if (!ok) {
libdax_msgs_submit(libdax_messenger,
drive->global_index, 0x00020162,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"BD-R not unformatted blank any more. Cannot format.",
0, 0);
drive->cancel = 1;
return;
}
if (flag & 32) {
libdax_msgs_submit(libdax_messenger,
drive->global_index, 0x00020163,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
"Blank BD-R left unformatted for zero spare capacity.",
0, 0);
return;
}
} else if (drive->current_profile == 0x43) {
ok = 1; /* BD-RE */
if ((flag & 32) && !(drive->current_feat23h_byte4 & 8)) {
libdax_msgs_submit(libdax_messenger,
drive->global_index, 0x00020164,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive does not format BD-RE without spares.",
0, 0);
drive->cancel = 1;
return;
}
if ((flag & 6) != 6 || (flag & 128)) {
if ((flag & 64) && !(drive->current_feat23h_byte4 & 2)) {
if (drive->current_feat23h_byte4 & 1) {
libdax_msgs_submit(libdax_messenger,
drive->global_index, 0x00020165,
LIBDAX_MSGS_SEV_WARNING,
LIBDAX_MSGS_PRIO_HIGH,
"Drive does not support fast formatting",
0, 0);
flag &= ~64;
} else {
no_non_default_bd_re:;
libdax_msgs_submit(libdax_messenger,
drive->global_index, 0x00020167,
LIBDAX_MSGS_SEV_SORRY,
LIBDAX_MSGS_PRIO_HIGH,
"Drive does not support non-default formatting",
0, 0);
drive->cancel = 1;
return;
}
}
if ((!(flag & 64)) && !(drive->current_feat23h_byte4 & 1)){
if (drive->current_feat23h_byte4 & 2) {
libdax_msgs_submit(libdax_messenger,
drive->global_index, 0x00020166,
LIBDAX_MSGS_SEV_WARNING,
LIBDAX_MSGS_PRIO_HIGH,
"Drive does not support full formatting",
0, 0);
flag |= 64;
} else
goto no_non_default_bd_re;
}
}
}
if (!ok) {
@ -453,12 +527,15 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
{
struct write_opts o;
char reasons[BURN_REASONS_LEN+80];
struct burn_drive *d;
d = opts->drive;
/* ts A61006 */
/* a ssert(!SCAN_GOING()); */
/* a ssert(!find_worker(opts->drive)); */
if ((SCAN_GOING()) || find_worker(opts->drive) != NULL) {
libdax_msgs_submit(libdax_messenger, opts->drive->global_index,
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020102,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"A drive operation is still going on (want to write)",
@ -467,14 +544,14 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
}
/* For the next lines any return indicates failure */
opts->drive->cancel = 1;
d->cancel = 1;
/* ts A70203 : people have been warned in API specs */
if (opts->write_type == BURN_WRITE_NONE)
return;
if (opts->drive->drive_role == 0) {
libdax_msgs_submit(libdax_messenger, opts->drive->global_index,
if (d->drive_role == 0) {
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020146,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Drive is a virtual placeholder (null-drive)", 0, 0);
@ -482,9 +559,9 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
}
/* ts A61007 : obsolete Assert in spc_select_write_params() */
if (opts->drive->drive_role == 1 && !opts->drive->mdata->valid) {
if (d->drive_role == 1 && d->mdata->valid <= 0) {
libdax_msgs_submit(libdax_messenger,
opts->drive->global_index, 0x00020113,
d->global_index, 0x00020113,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Drive capabilities not inquired yet", 0, 0);
return;
@ -495,29 +572,47 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
*/
strcpy(reasons, "Write job parameters are unsuitable:\n");
if (burn_precheck_write(opts, disc, reasons + strlen(reasons), 1)
== BURN_WRITE_NONE) {
<= 0) {
libdax_msgs_submit(libdax_messenger,
opts->drive->global_index, 0x00020139,
d->global_index, 0x00020139,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
reasons, 0, 0);
return;
}
opts->drive->cancel = 0; /* End of the return = failure area */
/* ts A90106 : early catching of unformatted BD-RE */
if (d->current_profile == 0x43)
if (d->read_format_capacities(d, 0x00) > 0 &&
d->format_descr_type != BURN_FORMAT_IS_FORMATTED) {
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020168,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
"Media not properly formatted. Cannot write.",
0, 0);
return;
}
o.drive = opts->drive;
d->cancel = 0; /* End of the return = failure area */
o.drive = d;
o.opts = opts;
o.disc = disc;
opts->refcount++;
add_worker(Burnworker_type_writE, opts->drive,
add_worker(Burnworker_type_writE, d,
(WorkerFunc) write_disc_worker_func, &o);
}
static void *fifo_worker_func(struct w_list *w)
{
int old;
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old);
/* Note: Only burn_fifo_abort() shall cancel the fifo thread */
burn_fifo_source_shoveller(w->u.fifo.source, w->u.fifo.flag);
remove_worker(pthread_self());
return NULL;
@ -547,6 +642,27 @@ int burn_fifo_start(struct burn_source *source, int flag)
}
int burn_fifo_abort(struct burn_source_fifo *fs, int flag)
{
int ret;
pthread_t pt;
if (fs->thread_is_valid <= 0 || fs->thread_handle == NULL)
return(2);
#ifdef NIX
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
"Aborting running burn_source_fifo thread", 0, 0);
#endif /* NIX */
pt= *((pthread_t *) fs->thread_handle);
remove_worker(pt);
ret = pthread_cancel(pt);
return (ret == 0);
}
#ifdef Libburn_has_burn_async_join_alL
/* ts A71019 : never used */

View File

@ -10,5 +10,9 @@ struct burn_write_opts;
/* To be called when the first read() call comes to a fifo */
int burn_fifo_start(struct burn_source *source, int flag);
/* ts A81108 */
/* To abort a running fifo thread before the fifo object gets deleted */
int burn_fifo_abort(struct burn_source_fifo *fs, int flag);
#endif /* BURN__ASYNC_H */

View File

@ -97,8 +97,8 @@ static int Cleanup_handler_exit(int exit_value, int signum, int flag)
return(2);
}
if(cleanup_exiting) {
fprintf(stderr,"cleanup: ABORT : repeat by pid=%d, signum=%d\n",
getpid(),signum);
fprintf(stderr,"cleanup: ABORT : repeat by pid=%.f, signum=%d\n",
(double) getpid(), signum);
return(0);
}
cleanup_exiting= 1;

View File

@ -40,6 +40,9 @@
/* A70903 : for burn_scsi_setup_drive() */
#include "spc.h"
/* A90815 : for mmc_obtain_profile_name() */
#include "mmc.h"
#include "libdax_msgs.h"
extern struct libdax_msgs *libdax_messenger;
@ -62,6 +65,7 @@ int burn_setup_drive(struct burn_drive *d, char *fname)
d->stdio_fd = -1;
d->status = BURN_DISC_UNREADY;
d->do_stream_recording = 0;
d->stream_recording_start= 0;
return 1;
}
@ -196,6 +200,31 @@ unsigned int burn_drive_count(void)
}
/* ts A80801 */
int burn_drive_is_listed(char *path, struct burn_drive **found, int flag)
{
int i, ret;
char drive_adr[BURN_DRIVE_ADR_LEN], off_adr[BURN_DRIVE_ADR_LEN];
ret = burn_drive_convert_fs_adr(path, off_adr);
if (ret <= 0)
strcpy(off_adr, path);
for (i = 0; i <= drivetop; i++) {
if (drive_array[i].global_index < 0)
continue;
ret = burn_drive_d_get_adr(&(drive_array[i]), drive_adr);
if (ret <= 0)
continue;
if(strcmp(off_adr, drive_adr) == 0) {
if (found != NULL)
*found= &(drive_array[i]);
return 1;
}
}
return 0;
}
/* ts A61125 : media status aspects of burn_drive_grab() */
int burn_drive_inquire_media(struct burn_drive *d)
{
@ -206,7 +235,7 @@ int burn_drive_inquire_media(struct burn_drive *d)
/* ts A61020 : d->status was set to BURN_DISC_BLANK as pure guess */
/* ts A71128 : run read_disc_info() for any recognizeable profile */
if (d->current_profile > 0 ||
if (d->current_profile > 0 || d->current_is_guessed_profile ||
d->mdata->cdr_write || d->mdata->cdrw_write ||
d->mdata->dvdr_write || d->mdata->dvdram_write) {
@ -392,6 +421,9 @@ int burn_drive_unregister(struct burn_drive *d)
struct burn_drive *burn_drive_finish_enum(struct burn_drive *d)
{
struct burn_drive *t;
char msg[BURN_DRIVE_ADR_LEN + 160];
int ret;
/* ts A60821
<<< debug: for tracing calls which might use open drive fds */
int mmc_function_spy(struct burn_drive *d, char * text);
@ -404,13 +436,19 @@ struct burn_drive *burn_drive_finish_enum(struct burn_drive *d)
mmc_function_spy(NULL, "enumerate_common : -------- doing grab");
/* try to get the drive info */
if (t->grab(t)) {
ret = t->grab(t);
if (ret) {
burn_print(2, "getting drive info\n");
t->getcaps(t);
t->unlock(t);
t->released = 1;
} else {
burn_print(2, "unable to grab new located drive\n");
/* ts A90602 */
d->mdata->valid = -1;
sprintf(msg, "Unable to grab scanned drive %s", d->devname);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002016f, LIBDAX_MSGS_SEV_DEBUG,
LIBDAX_MSGS_PRIO_LOW, msg, 0, 0);
burn_drive_unregister(t);
t = NULL;
}
@ -483,6 +521,7 @@ int burn_drive_release_fl(struct burn_drive *d, int flag)
d->unlock(d);
if ((flag & 7) == 1)
d->eject(d);
burn_drive_snooze(d, 0);
d->release(d);
}
@ -495,6 +534,22 @@ int burn_drive_release_fl(struct burn_drive *d, int flag)
}
/* API */
/* ts A90824
@param flag bit0= wake up (else start snoozing)
*/
int burn_drive_snooze(struct burn_drive *d, int flag)
{
if (d->drive_role != 1)
return 0;
if (flag & 1)
d->start_unit(d);
else
d->stop_unit(d);
return 1;
}
/* API */
void burn_drive_release(struct burn_drive *d, int le)
{
@ -599,7 +654,7 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
int ret, buf_secs, err, i, stages = 1, pbase, pfill, pseudo_sector;
off_t num_bufs;
char msg[80];
struct buffer buf;
struct buffer buf, *buf_mem = d->buffer;
/* reset the progress */
d->progress.session = 0;
@ -681,7 +736,7 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
ex:;
d->progress.sector = 0x10000;
d->busy = BURN_DRIVE_IDLE;
d->buffer = NULL;
d->buffer = buf_mem;
}
@ -767,6 +822,18 @@ enum burn_drive_status burn_drive_get_status(struct burn_drive *d,
return d->busy;
}
int burn_drive_set_stream_recording(struct burn_drive *d, int recmode,
int start, int flag)
{
if (recmode == 1)
d->do_stream_recording = 1;
else if (recmode == -1)
d->do_stream_recording = 0;
d->stream_recording_start = start;
return(1);
}
void burn_drive_cancel(struct burn_drive *d)
{
pthread_mutex_lock(&d->access_lock);
@ -817,7 +884,7 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
a ssert(d->mdata);
#endif
if (!d->idata->valid || !d->mdata->valid)
if(d->idata->valid <= 0 || d->mdata->valid <= 0)
return 0;
id = (struct burn_scsi_inquiry_data *)d->idata;
@ -883,7 +950,7 @@ int burn_drive_scan_sync(struct burn_drive_info *drives[],
*/
unsigned char scanned[32];
unsigned count = 0;
int i;
int i, ret;
/* ts A61007 : moved up to burn_drive_scan() */
/* a ssert(burn_running); */
@ -940,13 +1007,22 @@ int burn_drive_scan_sync(struct burn_drive_info *drives[],
if (drive_array[i].global_index < 0)
continue; /* invalid device */
while (!drive_getcaps(&drive_array[i],
&(*drives)[*n_drives])) {
/* ts A90602 : This old loop is not plausible. See A70907.
while (!drive_getcaps(&drive_array[i],
&(*drives)[*n_drives])) {
sleep(1);
}
(*n_drives)++;
}
*/
/* ts A90602 : A single call shall do (rather than a loop) */
ret = drive_getcaps(&drive_array[i], &(*drives)[*n_drives]);
if (ret > 0)
(*n_drives)++;
scanned[i / 8] |= 1 << (i % 8);
}
if (*drives != NULL && *n_drives == 0) {
free ((char *) *drives);
*drives = NULL;
}
return(1);
}
@ -1102,14 +1178,14 @@ void burn_sectors_to_msf(int sectors, int *m, int *s, int *f)
int burn_drive_get_read_speed(struct burn_drive *d)
{
if(!d->mdata->valid)
if(d->mdata->valid <= 0)
return 0;
return d->mdata->max_read_speed;
}
int burn_drive_get_write_speed(struct burn_drive *d)
{
if(!d->mdata->valid)
if(d->mdata->valid <= 0)
return 0;
return d->mdata->max_write_speed;
}
@ -1117,7 +1193,7 @@ int burn_drive_get_write_speed(struct burn_drive *d)
/* ts A61021 : New API function */
int burn_drive_get_min_write_speed(struct burn_drive *d)
{
if(!d->mdata->valid)
if(d->mdata->valid <= 0)
return 0;
return d->mdata->min_write_speed;
}
@ -1166,6 +1242,20 @@ int burn_drive_is_banned(char *device_address)
}
/* ts A80731 */
int burn_drive_whitelist_count(void)
{
return enumeration_whitelist_top + 1;
}
char *burn_drive_whitelist_item(int idx, int flag)
{
if (idx < 0 || idx > enumeration_whitelist_top)
return NULL;
return enumeration_whitelist[idx];
}
/* ts A70924 */
int burn_drive__fd_from_special_adr(char *adr)
{
@ -1190,6 +1280,7 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
int ret = -1, fd = -1, role = 0;
/* divided by 512 it needs to fit into a signed long integer */
off_t size = ((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048);
off_t read_size = -1;
struct burn_drive *d= NULL, *regd_d;
struct stat stbuf;
@ -1202,6 +1293,16 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
ret = fstat(fd, &stbuf);
else
ret = stat(fname, &stbuf);
if (ret != -1) {
if (S_ISREG(stbuf.st_mode))
read_size = stbuf.st_size;
else if (S_ISBLK(stbuf.st_mode)) {
ret = burn_os_stdio_capacity(fname,
&read_size);
if (ret <= 0)
read_size = -1;
}
}
if (ret == -1 || S_ISBLK(stbuf.st_mode) ||
S_ISREG(stbuf.st_mode)) {
ret = burn_os_stdio_capacity(fname, &size);
@ -1260,6 +1361,10 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
d->current_is_supported_profile = 1;
d->block_types[BURN_WRITE_TAO] = BURN_BLOCK_MODE1;
d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_SAO;
if (read_size >= 0)
/* despite its name : last valid address, not size */
d->media_read_capacity =
read_size / 2048 - !(read_size % 2048);
burn_drive_set_media_capacity_remaining(d, size);
/* >>> ? open file for a test ? (>>> beware of "-" = stdin) */;
@ -1690,6 +1795,10 @@ int burn_abort(int patience,
unsigned long wait_grain= 100000;
time_t start_time, current_time, pacifier_time, end_time;
#ifndef NIX
time_t stdio_patience = 3;
#endif
current_time = start_time = pacifier_time = time(0);
end_time = start_time + patience;
@ -1705,10 +1814,38 @@ int burn_abort(int patience,
occup = burn_drive_is_occupied(&(drive_array[i]));
if(occup == -2)
continue;
if(drive_array[i].drive_role != 1) {
#ifdef NIX
/* ts A90302
<<< this causes a race condition with drive
usage and drive disposal.
*/
drive_array[i].busy = BURN_DRIVE_IDLE;
burn_drive_forget(&(drive_array[i]), 1);
} else if(occup <= 10) {
continue;
#else /* NIX */
/* ts A90318
>>> but if a pipe breaks then the drive
never gets idle.
So for now with a short patience timespan
and eventually a deliberate memory leak.
*/
if (current_time - start_time >
stdio_patience) {
drive_array[i].global_index = -1;
continue;
}
#endif /* ! NIX */
}
if(occup <= 10) {
burn_drive_forget(&(drive_array[i]), 1);
} else if(occup <= 100) {
if(first_round)
@ -1787,11 +1924,16 @@ int burn_disc_read_atip(struct burn_drive *d)
}
if(d->drive_role != 1)
return 0;
if (d->current_profile == -1 || d->current_is_cd_profile) {
if ((d->current_profile == -1 || d->current_is_cd_profile)
&& (d->mdata->cdrw_write || d->current_profile != 0x08)) {
d->read_atip(d);
/* >>> some control of success would be nice :) */
} else {
/* mmc5r03c.pdf 6.26.3.6.3 : ATIP is undefined for non-CD */;
/* mmc5r03c.pdf 6.26.3.6.3 : ATIP is undefined for non-CD
(and it seems meaningless for non-burners).
ts A90823: Pseudo-CD U3 memory stick stalls with ATIP.
It is !cdrw_write and profile is 0x08.
*/
return 0;
}
return 1;
@ -1899,6 +2041,30 @@ int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80])
}
/* ts A90815 : New API function */
int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles,
int profiles[64], char is_current[64])
{
int i;
*num_profiles = d->num_profiles;
for (i = 0; i < d->num_profiles; i++) {
profiles[i] = (d->all_profiles[i * 4] << 8) |
d->all_profiles[i * 4 + 1];
is_current[i] = d->all_profiles[i * 4 + 2] & 1;
}
return 1;
}
/* ts A90815 : New API function */
int burn_obtain_profile_name(int profile_number, char name[80])
{
strcpy(name, mmc_obtain_profile_name(profile_number));
return(name[0] != 0);
}
/* ts A61223 : New API function */
int burn_drive_wrote_well(struct burn_drive *d)
{
@ -1998,7 +2164,7 @@ int burn_drive_get_speedlist(struct burn_drive *d,
struct burn_speed_descriptor *sd, *csd = NULL;
(*speed_list) = NULL;
if(!d->mdata->valid)
if(d->mdata->valid <= 0)
return 0;
for (sd = d->mdata->speed_descriptors; sd != NULL; sd = sd->next) {
ret = burn_speed_descriptor_new(&csd, NULL, csd, 0);
@ -2023,7 +2189,7 @@ int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal,
if (speed_goal < 0)
best_speed = 2000000000;
*best_descr = NULL;
if(!d->mdata->valid)
if(d->mdata->valid <= 0)
return 0;
for (sd = d->mdata->speed_descriptors; sd != NULL; sd = sd->next) {
if (flag & 1)
@ -2207,8 +2373,9 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
o->might_do_sao = 4;
o->might_do_tao = 2;
o->advised_write_mode = BURN_WRITE_TAO;
} else if (d->current_profile == 0x1b || d->current_profile == 0x2b) {
/* DVD+R , DVD+R/DL */
} else if (d->current_profile == 0x1b || d->current_profile == 0x2b ||
d->current_profile == 0x41) {
/* DVD+R , DVD+R/DL , BD-R SRM */
o->multi_session = o->multi_track = 1;
o->might_do_tao = 2;
o->might_do_sao = 1;
@ -2467,3 +2634,61 @@ int burn_drive_set_media_capacity_remaining(struct burn_drive *d, off_t value)
return 1;
}
/* ts A81215 : API */
int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag)
{
*capacity = d->media_read_capacity + 1;
return (d->media_read_capacity != 0x7fffffff);
}
/* ts A90903 : API */
int burn_disc_get_media_id(struct burn_drive *d,
char **product_id, char **media_code1, char **media_code2,
char **book_type, int flag)
{
int ret;
*product_id = *media_code1 = *media_code2 = *book_type = NULL;
if (burn_drive_get_drive_role(d) != 1)
return 0;
ret = mmc_get_media_product_id(d,
product_id, media_code1, media_code2, book_type,
flag & 1);
return ret;
}
/* ts A90909 : API */
/**
@param valid Replies bits which indicate the validity of other reply
parameters or the state of certain CD info bits:
bit0= disc_type valid
bit1= disc_id valid
bit2= bar_code valid
bit3= disc_app_code valid
bit4= Disc is unrestricted (URU bit)
bit5= Disc is nominally erasable (Erasable bit)
This will be set with overwriteable media which
libburn normally considers to be unerasable blank.
*/
int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
unsigned int *disc_id, char bar_code[9], int *app_code,
int *valid)
{
if (d->disc_type == 0x00) {
strcpy(disc_type, "CD-DA or CD-ROM");
} else if (d->disc_type == 0x10) {
strcpy(disc_type, "CD-I");
} else if (d->disc_type == 0x20) {
strcpy(disc_type, "CD-ROM XA");
} else {
strcpy(disc_type, "undefined");
}
*disc_id = d->disc_id;
memcpy(bar_code, d->disc_bar_code, 8);
bar_code[9]= 0;
*app_code = d->disc_app_code;
*valid = d->disc_info_valid;
return 1;
}

View File

@ -125,4 +125,14 @@ int burn_drive__fd_from_special_adr(char *adr);
int burn_drive_find_by_thread_pid(struct burn_drive **d, pid_t pid);
/* ts A51221 - A80731 : Whitelist inquiry functions */
int burn_drive_is_banned(char *device_address);
int burn_drive_whitelist_count(void);
char *burn_drive_whitelist_item(int idx, int flag);
/* ts A80801 */
int burn_drive_is_listed(char *path, struct burn_drive **found, int flag);
#endif /* __DRIVE */

View File

@ -9,6 +9,8 @@
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <pthread.h>
#include "source.h"
#include "libburn.h"
#include "file.h"
@ -307,6 +309,7 @@ static void fifo_free(struct burn_source *source)
{
struct burn_source_fifo *fs = source->data;
burn_fifo_abort(fs, 0);
if (fs->inp != NULL)
burn_source_free(fs->inp);
if (fs->buf != NULL)
@ -320,9 +323,12 @@ int burn_fifo_source_shoveller(struct burn_source *source, int flag)
struct burn_source_fifo *fs = source->data;
int ret, bufsize, diff, wpos, rpos, trans_end, free_bytes;
char *bufpt;
pthread_t thread_handle_storage;
fs->thread_handle= &thread_handle_storage;
*((pthread_t *) fs->thread_handle)= pthread_self();
fs->thread_pid = getpid();
fs->thread_pid_valid = 1;
fs->thread_is_valid = 1;
bufsize = fs->chunksize * fs->chunks;
while (!fs->end_of_consumption) {
@ -430,6 +436,8 @@ int burn_fifo_source_shoveller(struct burn_source *source, int flag)
free(fs->buf); /* Give up fifo buffer. Next fifo might start soon. */
fs->buf = NULL;
fs->thread_handle= NULL;
fs->thread_is_valid = 0;
return (fs->input_error == 0);
}
@ -465,8 +473,9 @@ struct burn_source *burn_fifo_source_new(struct burn_source *inp,
if (fs == NULL)
return NULL;
fs->is_started = 0;
fs->thread_handle = NULL;
fs->thread_pid = 0;
fs->thread_pid_valid = 0;
fs->thread_is_valid = 0;
fs->inp = NULL; /* set later */
fs->chunksize = chunksize;
fs->chunks = chunks;

View File

@ -29,8 +29,9 @@ struct burn_source_fifo {
*/
int is_started;
void *thread_handle; /* actually a pointer to a thread_t */
int thread_pid;
int thread_pid_valid;
int thread_is_valid;
/* the burn_source for which this fifo is acting as proxy */
struct burn_source *inp;

View File

@ -1,451 +0,0 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* borrowed HEAVILY from cdrdao */
#include <string.h>
#include "lec.h"
#define LEC_HEADER_OFFSET 12
#define LEC_MODE1_P_PARITY_OFFSET 2076
#define LEC_MODE1_Q_PARITY_OFFSET 2248
static unsigned char gf8_ilog[255] = {
1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, 76,
152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96,
192, 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119,
238, 193, 159, 35, 70, 140, 5, 10, 20, 40, 80, 160, 93, 186,
105, 210, 185, 111, 222, 161, 95, 190, 97, 194, 153, 47, 94,
188, 101, 202, 137, 15, 30, 60, 120, 240, 253, 231, 211, 187,
107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, 217,
175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103,
206, 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197,
151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79,
158, 33, 66, 132, 21, 42, 84, 168, 77, 154, 41, 82, 164, 85,
170, 73, 146, 57, 114, 228, 213, 183, 115, 230, 209, 191, 99,
198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, 227,
219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87,
174, 65, 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224,
221, 167, 83, 166, 81, 162, 89, 178, 121, 242, 249, 239, 195,
155, 43, 86, 172, 69, 138, 9, 18, 36, 72, 144, 61, 122, 244,
245, 247, 243, 251, 235, 203, 139, 11, 22, 44, 88, 176, 125,
250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142,
};
static unsigned char gf8_log[256] = {
0, 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, 4, 100,
224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113,
5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18,
130, 69, 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9,
120, 77, 228, 114, 166, 6, 191, 139, 98, 102, 221, 48, 253,
226, 152, 37, 179, 16, 145, 34, 136, 54, 208, 148, 206, 143,
150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, 30, 66, 182,
163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61,
202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115,
243, 167, 87, 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222,
237, 49, 197, 254, 24, 227, 165, 153, 119, 38, 184, 180, 124,
17, 68, 146, 217, 35, 32, 137, 46, 55, 63, 209, 91, 149, 188,
207, 205, 144, 135, 151, 178, 220, 252, 190, 97, 242, 86, 211,
171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, 31,
45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12,
111, 246, 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134,
177, 187, 204, 62, 90, 203, 89, 95, 176, 156, 169, 160, 81, 11,
245, 22, 235, 122, 117, 44, 215, 79, 174, 213, 233, 230, 231,
173, 232, 116, 214, 244, 234, 168, 80, 88, 175,
};
static unsigned char gf8_q_coeffs[2][45] = {
{97, 251, 133, 60, 82, 160, 155, 201, 8, 112, 246, 11, 21, 42, 157,
169, 80, 174, 232, 230, 172, 211, 241, 18, 68, 216, 44, 121, 9, 200,
75, 103, 221, 252, 96, 176, 88, 167, 114, 76, 199, 26, 1, 0, 0},
{190, 96, 250, 132, 59, 81, 159, 154, 200, 7, 111, 245, 10, 20, 41,
156, 168, 79, 173, 231, 229, 171, 210, 240, 17, 67, 215, 43, 120, 8,
199, 74, 102, 220, 251, 95, 175, 87, 166, 113, 75, 198, 25, 0, 0}
};
static unsigned char gf8_p_coeffs[2][26] = {
{230, 172, 211, 241, 18, 68, 216, 44, 121, 9, 200, 75, 103, 221, 252,
96, 176, 88, 167, 114, 76, 199, 26, 1, 0, 0},
{231, 229, 171, 210, 240, 17, 67, 215, 43, 120, 8, 199, 74, 102, 220,
251, 95, 175, 87, 166, 113, 75, 198, 25, 0, 0}
};
static unsigned char yellowbook_scrambler[2340] = {
1, 128, 0, 96, 0, 40, 0, 30, 128, 8, 96, 6, 168, 2, 254, 129, 128, 96,
96, 40, 40, 30, 158,
136, 104, 102, 174, 170, 252, 127, 1, 224, 0, 72, 0, 54, 128, 22, 224,
14, 200, 4, 86, 131, 126, 225,
224, 72, 72, 54, 182, 150, 246, 238, 198, 204, 82, 213, 253, 159, 1,
168, 0, 126, 128, 32, 96, 24, 40,
10, 158, 135, 40, 98, 158, 169, 168, 126, 254, 160, 64, 120, 48, 34,
148, 25, 175, 74, 252, 55, 1, 214,
128, 94, 224, 56, 72, 18, 182, 141, 182, 229, 182, 203, 54, 215, 86,
222, 190, 216, 112, 90, 164, 59, 59,
83, 83, 125, 253, 225, 129, 136, 96, 102, 168, 42, 254, 159, 0, 104, 0,
46, 128, 28, 96, 9, 232, 6,
206, 130, 212, 97, 159, 104, 104, 46, 174, 156, 124, 105, 225, 238,
200, 76, 86, 181, 254, 247, 0, 70, 128,
50, 224, 21, 136, 15, 38, 132, 26, 227, 75, 9, 247, 70, 198, 178, 210,
245, 157, 135, 41, 162, 158, 249,
168, 66, 254, 177, 128, 116, 96, 39, 104, 26, 174, 139, 60, 103, 81,
234, 188, 79, 49, 244, 20, 71, 79,
114, 180, 37, 183, 91, 54, 187, 86, 243, 126, 197, 224, 83, 8, 61, 198,
145, 146, 236, 109, 141, 237, 165,
141, 187, 37, 179, 91, 53, 251, 87, 3, 126, 129, 224, 96, 72, 40, 54,
158, 150, 232, 110, 206, 172, 84,
125, 255, 97, 128, 40, 96, 30, 168, 8, 126, 134, 160, 98, 248, 41, 130,
158, 225, 168, 72, 126, 182, 160,
118, 248, 38, 194, 154, 209, 171, 28, 127, 73, 224, 54, 200, 22, 214,
142, 222, 228, 88, 75, 122, 183, 99,
54, 169, 214, 254, 222, 192, 88, 80, 58, 188, 19, 49, 205, 212, 85,
159, 127, 40, 32, 30, 152, 8, 106,
134, 175, 34, 252, 25, 129, 202, 224, 87, 8, 62, 134, 144, 98, 236, 41,
141, 222, 229, 152, 75, 42, 183,
95, 54, 184, 22, 242, 142, 197, 164, 83, 59, 125, 211, 97, 157, 232,
105, 142, 174, 228, 124, 75, 97, 247,
104, 70, 174, 178, 252, 117, 129, 231, 32, 74, 152, 55, 42, 150, 159,
46, 232, 28, 78, 137, 244, 102, 199,
106, 210, 175, 29, 188, 9, 177, 198, 244, 82, 199, 125, 146, 161, 173,
184, 125, 178, 161, 181, 184, 119, 50,
166, 149, 186, 239, 51, 12, 21, 197, 207, 19, 20, 13, 207, 69, 148, 51,
47, 85, 220, 63, 25, 208, 10,
220, 7, 25, 194, 138, 209, 167, 28, 122, 137, 227, 38, 201, 218, 214,
219, 30, 219, 72, 91, 118, 187, 102,
243, 106, 197, 239, 19, 12, 13, 197, 197, 147, 19, 45, 205, 221, 149,
153, 175, 42, 252, 31, 1, 200, 0,
86, 128, 62, 224, 16, 72, 12, 54, 133, 214, 227, 30, 201, 200, 86, 214,
190, 222, 240, 88, 68, 58, 179,
83, 53, 253, 215, 1, 158, 128, 104, 96, 46, 168, 28, 126, 137, 224,
102, 200, 42, 214, 159, 30, 232, 8,
78, 134, 180, 98, 247, 105, 134, 174, 226, 252, 73, 129, 246, 224, 70,
200, 50, 214, 149, 158, 239, 40, 76,
30, 181, 200, 119, 22, 166, 142, 250, 228, 67, 11, 113, 199, 100, 82,
171, 125, 191, 97, 176, 40, 116, 30,
167, 72, 122, 182, 163, 54, 249, 214, 194, 222, 209, 152, 92, 106, 185,
239, 50, 204, 21, 149, 207, 47, 20,
28, 15, 73, 196, 54, 211, 86, 221, 254, 217, 128, 90, 224, 59, 8, 19,
70, 141, 242, 229, 133, 139, 35,
39, 89, 218, 186, 219, 51, 27, 85, 203, 127, 23, 96, 14, 168, 4, 126,
131, 96, 97, 232, 40, 78, 158,
180, 104, 119, 110, 166, 172, 122, 253, 227, 1, 137, 192, 102, 208, 42,
220, 31, 25, 200, 10, 214, 135, 30,
226, 136, 73, 166, 182, 250, 246, 195, 6, 209, 194, 220, 81, 153, 252,
106, 193, 239, 16, 76, 12, 53, 197,
215, 19, 30, 141, 200, 101, 150, 171, 46, 255, 92, 64, 57, 240, 18,
196, 13, 147, 69, 173, 243, 61, 133,
209, 163, 28, 121, 201, 226, 214, 201, 158, 214, 232, 94, 206, 184, 84,
114, 191, 101, 176, 43, 52, 31, 87,
72, 62, 182, 144, 118, 236, 38, 205, 218, 213, 155, 31, 43, 72, 31,
118, 136, 38, 230, 154, 202, 235, 23,
15, 78, 132, 52, 99, 87, 105, 254, 174, 192, 124, 80, 33, 252, 24, 65,
202, 176, 87, 52, 62, 151, 80,
110, 188, 44, 113, 221, 228, 89, 139, 122, 231, 99, 10, 169, 199, 62,
210, 144, 93, 172, 57, 189, 210, 241,
157, 132, 105, 163, 110, 249, 236, 66, 205, 241, 149, 132, 111, 35,
108, 25, 237, 202, 205, 151, 21, 174, 143,
60, 100, 17, 235, 76, 79, 117, 244, 39, 7, 90, 130, 187, 33, 179, 88,
117, 250, 167, 3, 58, 129, 211,
32, 93, 216, 57, 154, 146, 235, 45, 143, 93, 164, 57, 187, 82, 243,
125, 133, 225, 163, 8, 121, 198, 162,
210, 249, 157, 130, 233, 161, 142, 248, 100, 66, 171, 113, 191, 100,
112, 43, 100, 31, 107, 72, 47, 118, 156,
38, 233, 218, 206, 219, 20, 91, 79, 123, 116, 35, 103, 89, 234, 186,
207, 51, 20, 21, 207, 79, 20, 52,
15, 87, 68, 62, 179, 80, 117, 252, 39, 1, 218, 128, 91, 32, 59, 88, 19,
122, 141, 227, 37, 137, 219,
38, 219, 90, 219, 123, 27, 99, 75, 105, 247, 110, 198, 172, 82, 253,
253, 129, 129, 160, 96, 120, 40, 34,
158, 153, 168, 106, 254, 175, 0, 124, 0, 33, 192, 24, 80, 10, 188, 7,
49, 194, 148, 81, 175, 124, 124,
33, 225, 216, 72, 90, 182, 187, 54, 243, 86, 197, 254, 211, 0, 93, 192,
57, 144, 18, 236, 13, 141, 197,
165, 147, 59, 45, 211, 93, 157, 249, 169, 130, 254, 225, 128, 72, 96,
54, 168, 22, 254, 142, 192, 100, 80,
43, 124, 31, 97, 200, 40, 86, 158, 190, 232, 112, 78, 164, 52, 123, 87,
99, 126, 169, 224, 126, 200, 32,
86, 152, 62, 234, 144, 79, 44, 52, 29, 215, 73, 158, 182, 232, 118,
206, 166, 212, 122, 223, 99, 24, 41,
202, 158, 215, 40, 94, 158, 184, 104, 114, 174, 165, 188, 123, 49, 227,
84, 73, 255, 118, 192, 38, 208, 26,
220, 11, 25, 199, 74, 210, 183, 29, 182, 137, 182, 230, 246, 202, 198,
215, 18, 222, 141, 152, 101, 170, 171,
63, 63, 80, 16, 60, 12, 17, 197, 204, 83, 21, 253, 207, 1, 148, 0, 111,
64, 44, 48, 29, 212, 9,
159, 70, 232, 50, 206, 149, 148, 111, 47, 108, 28, 45, 201, 221, 150,
217, 174, 218, 252, 91, 1, 251, 64,
67, 112, 49, 228, 20, 75, 79, 119, 116, 38, 167, 90, 250, 187, 3, 51,
65, 213, 240, 95, 4, 56, 3,
82, 129, 253, 160, 65, 184, 48, 114, 148, 37, 175, 91, 60, 59, 81, 211,
124, 93, 225, 249, 136, 66, 230,
177, 138, 244, 103, 7, 106, 130, 175, 33, 188, 24, 113, 202, 164, 87,
59, 126, 147, 96, 109, 232, 45, 142,
157, 164, 105, 187, 110, 243, 108, 69, 237, 243, 13, 133, 197, 163, 19,
57, 205, 210, 213, 157, 159, 41, 168,
30, 254, 136, 64, 102, 176, 42, 244, 31, 7, 72, 2, 182, 129, 182, 224,
118, 200, 38, 214, 154, 222, 235,
24, 79, 74, 180, 55, 55, 86, 150, 190, 238, 240, 76, 68, 53, 243, 87,
5, 254, 131, 0, 97, 192, 40,
80, 30, 188, 8, 113, 198, 164, 82, 251, 125, 131, 97, 161, 232, 120,
78, 162, 180, 121, 183, 98, 246, 169,
134, 254, 226, 192, 73, 144, 54, 236, 22, 205, 206, 213, 148, 95, 47,
120, 28, 34, 137, 217, 166, 218, 250,
219, 3, 27, 65, 203, 112, 87, 100, 62, 171, 80, 127, 124, 32, 33, 216,
24, 90, 138, 187, 39, 51, 90,
149, 251, 47, 3, 92, 1, 249, 192, 66, 208, 49, 156, 20, 105, 207, 110,
212, 44, 95, 93, 248, 57, 130,
146, 225, 173, 136, 125, 166, 161, 186, 248, 115, 2, 165, 193, 187, 16,
115, 76, 37, 245, 219, 7, 27, 66,
139, 113, 167, 100, 122, 171, 99, 63, 105, 208, 46, 220, 28, 89, 201,
250, 214, 195, 30, 209, 200, 92, 86,
185, 254, 242, 192, 69, 144, 51, 44, 21, 221, 207, 25, 148, 10, 239,
71, 12, 50, 133, 213, 163, 31, 57,
200, 18, 214, 141, 158, 229, 168, 75, 62, 183, 80, 118, 188, 38, 241,
218, 196, 91, 19, 123, 77, 227, 117,
137, 231, 38, 202, 154, 215, 43, 30, 159, 72, 104, 54, 174, 150, 252,
110, 193, 236, 80, 77, 252, 53, 129,
215, 32, 94, 152, 56, 106, 146, 175, 45, 188, 29, 177, 201, 180, 86,
247, 126, 198, 160, 82, 248, 61, 130,
145, 161, 172, 120, 125, 226, 161, 137, 184, 102, 242, 170, 197, 191,
19, 48, 13, 212, 5, 159, 67, 40, 49,
222, 148, 88, 111, 122, 172, 35, 61, 217, 209, 154, 220, 107, 25, 239,
74, 204, 55, 21, 214, 143, 30, 228,
8, 75, 70, 183, 114, 246, 165, 134, 251, 34, 195, 89, 145, 250, 236,
67, 13, 241, 197, 132, 83, 35, 125,
217, 225, 154, 200, 107, 22, 175, 78, 252, 52, 65, 215, 112, 94, 164,
56, 123, 82, 163, 125, 185, 225, 178,
200, 117, 150, 167, 46, 250, 156, 67, 41, 241, 222, 196, 88, 83, 122,
189, 227, 49, 137, 212, 102, 223, 106,
216, 47, 26, 156, 11, 41, 199, 94, 210, 184, 93, 178, 185, 181, 178,
247, 53, 134, 151, 34, 238, 153, 140,
106, 229, 239, 11, 12, 7, 69, 194, 179, 17, 181, 204, 119, 21, 230,
143, 10, 228, 7, 11, 66, 135, 113,
162, 164, 121, 187, 98, 243, 105, 133, 238, 227, 12, 73, 197, 246, 211,
6, 221, 194, 217, 145, 154, 236, 107,
13, 239, 69, 140, 51, 37, 213, 219, 31, 27, 72, 11, 118, 135, 102, 226,
170, 201, 191, 22, 240, 14, 196,
4, 83, 67, 125, 241, 225, 132, 72, 99, 118, 169, 230, 254, 202, 192,
87, 16, 62, 140, 16, 101, 204, 43,
21, 223, 79, 24, 52, 10, 151, 71, 46, 178, 156, 117, 169, 231, 62, 202,
144, 87, 44, 62, 157, 208, 105,
156, 46, 233, 220, 78, 217, 244, 90, 199, 123, 18, 163, 77, 185, 245,
178, 199, 53, 146, 151, 45, 174, 157,
188, 105, 177, 238, 244, 76, 71, 117, 242, 167, 5, 186, 131, 51, 33,
213, 216, 95, 26, 184, 11, 50, 135,
85, 162, 191, 57, 176, 18, 244, 13, 135, 69, 162, 179, 57, 181, 210,
247, 29, 134, 137, 162, 230, 249, 138,
194, 231, 17, 138, 140, 103, 37, 234, 155, 15, 43, 68, 31, 115, 72, 37,
246, 155, 6, 235, 66, 207, 113,
148, 36, 111, 91, 108, 59, 109, 211, 109, 157, 237, 169, 141, 190, 229,
176, 75, 52, 55, 87, 86, 190, 190,
240, 112, 68, 36, 51, 91, 85, 251, 127, 3, 96, 1, 232, 0, 78, 128, 52,
96, 23, 104, 14, 174, 132,
124, 99, 97, 233, 232, 78, 206, 180, 84, 119, 127, 102, 160, 42, 248,
31, 2, 136, 1, 166, 128, 122, 224,
35, 8, 25, 198, 138, 210, 231, 29, 138, 137, 167, 38, 250, 154, 195,
43, 17, 223, 76, 88, 53, 250, 151,
3, 46, 129, 220, 96, 89, 232, 58, 206, 147, 20, 109, 207, 109, 148, 45,
175, 93, 188, 57, 177, 210, 244,
93, 135, 121, 162, 162, 249, 185, 130, 242, 225, 133, 136, 99, 38, 169,
218, 254, 219, 0, 91, 64, 59, 112,
19, 100, 13, 235, 69, 143, 115, 36, 37, 219, 91, 27, 123, 75, 99, 119,
105, 230, 174, 202, 252, 87, 1,
254, 128, 64, 96, 48, 40, 20, 30, 143, 72, 100, 54, 171, 86, 255, 126,
192, 32, 80, 24, 60, 10, 145,
199, 44, 82, 157, 253, 169, 129, 190, 224, 112, 72, 36, 54, 155, 86,
235, 126, 207, 96, 84, 40, 63, 94,
144, 56, 108, 18, 173, 205, 189, 149, 177, 175, 52, 124, 23, 97, 206,
168, 84, 126, 191, 96, 112, 40, 36,
30, 155, 72, 107, 118, 175, 102, 252, 42, 193, 223, 16, 88, 12, 58,
133, 211, 35, 29, 217, 201, 154, 214,
235, 30, 207, 72, 84, 54, 191, 86, 240, 62, 196, 16, 83, 76, 61, 245,
209, 135, 28, 98, 137, 233, 166,
206, 250, 212, 67, 31, 113, 200, 36, 86, 155, 126, 235, 96, 79, 104,
52, 46, 151, 92, 110, 185, 236, 114,
205, 229, 149, 139, 47, 39, 92, 26, 185, 203, 50, 215, 85, 158, 191,
40, 112, 30, 164, 8, 123, 70, 163,
114, 249, 229, 130, 203, 33, 151, 88, 110, 186, 172, 115, 61, 229, 209,
139, 28, 103, 73, 234, 182, 207, 54,
212, 22, 223, 78, 216, 52, 90, 151, 123, 46, 163, 92, 121, 249, 226,
194, 201, 145, 150, 236, 110, 205, 236,
85, 141, 255, 37, 128, 27, 32, 11, 88, 7, 122, 130, 163, 33, 185, 216,
114, 218, 165, 155, 59, 43, 83,
95, 125, 248, 33, 130, 152, 97, 170, 168, 127, 62, 160, 16, 120, 12,
34, 133, 217, 163, 26, 249, 203, 2,
215, 65, 158, 176, 104, 116, 46, 167, 92, 122, 185, 227, 50, 201, 213,
150, 223, 46, 216, 28, 90, 137, 251,
38, 195, 90, 209, 251, 28, 67, 73, 241, 246, 196, 70, 211, 114, 221,
229, 153,
};
void scramble(unsigned char *inout)
{
unsigned char *r = inout + 12;
unsigned char *s = yellowbook_scrambler;
unsigned int i;
for (i = 2340; i; i--) {
*r++ ^= *s++;
}
}
/* Calculate the P parities for the sector.
* The 43 P vectors of length 24 are combined with the GF8_P_COEFFS.
*/
void parity_p(unsigned char *sector)
{
int i, j;
unsigned char p0_msb, p1_msb;
unsigned char p0_lsb, p1_lsb;
unsigned char *p_msb_start, *p_lsb_start;
unsigned char *p_msb, *p_lsb;
unsigned char *coeffs0, *coeffs1;
unsigned char *p0, *p1;
unsigned char d;
unsigned short c;
p_lsb_start = sector + LEC_HEADER_OFFSET;
p_msb_start = sector + LEC_HEADER_OFFSET + 1;
p1 = sector + LEC_MODE1_P_PARITY_OFFSET;
p0 = sector + LEC_MODE1_P_PARITY_OFFSET + 2 * 43;
for (i = 0; i <= 42; i++) {
p_lsb = p_lsb_start;
p_msb = p_msb_start;
coeffs0 = gf8_p_coeffs[0];
coeffs1 = gf8_p_coeffs[1];
p0_lsb = p1_lsb = p0_msb = p1_msb = 0;
for (j = 0; j <= 23; j++) {
d = *p_lsb;
if (d != 0) {
c = gf8_log[d] + *coeffs0;
if (c >= 255)
c -= 255;
p0_lsb ^= gf8_ilog[c];
c = gf8_log[d] + *coeffs1;
if (c >= 255)
c -= 255;
p1_lsb ^= gf8_ilog[c];
}
d = *p_msb;
if (d != 0) {
c = gf8_log[d] + *coeffs0;
if (c >= 255)
c -= 255;
p0_msb ^= gf8_ilog[c];
c = gf8_log[d] + *coeffs1;
if (c >= 255)
c -= 255;
p1_msb ^= gf8_ilog[c];
}
coeffs0++;
coeffs1++;
p_lsb += 2 * 43;
p_msb += 2 * 43;
}
*p0 = p0_lsb;
*(p0 + 1) = p0_msb;
*p1 = p1_lsb;
*(p1 + 1) = p1_msb;
p0 += 2;
p1 += 2;
p_lsb_start += 2;
p_msb_start += 2;
}
}
/* Calculate the Q parities for the sector.
* The 26 Q vectors of length 43 are combined with the GF8_Q_COEFFS.
*/
void parity_q(unsigned char *sector)
{
int i, j;
unsigned char q0_msb, q1_msb;
unsigned char q0_lsb, q1_lsb;
unsigned char *q_msb_start, *q_lsb_start;
unsigned char *q_msb, *q_lsb;
unsigned char *coeffs0, *coeffs1;
unsigned char *q0, *q1, *q_start;
unsigned char d;
unsigned short c;
q_lsb_start = sector + LEC_HEADER_OFFSET;
q_msb_start = sector + LEC_HEADER_OFFSET + 1;
q_start = sector + LEC_MODE1_Q_PARITY_OFFSET;
q1 = sector + LEC_MODE1_Q_PARITY_OFFSET;
q0 = sector + LEC_MODE1_Q_PARITY_OFFSET + 2 * 26;
for (i = 0; i <= 25; i++) {
q_lsb = q_lsb_start;
q_msb = q_msb_start;
coeffs0 = gf8_q_coeffs[0];
coeffs1 = gf8_q_coeffs[1];
q0_lsb = q1_lsb = q0_msb = q1_msb = 0;
for (j = 0; j <= 42; j++) {
d = *q_lsb;
if (d != 0) {
c = gf8_log[d] + *coeffs0;
if (c >= 255)
c -= 255;
q0_lsb ^= gf8_ilog[c];
c = gf8_log[d] + *coeffs1;
if (c >= 255)
c -= 255;
q1_lsb ^= gf8_ilog[c];
}
d = *q_msb;
if (d != 0) {
c = gf8_log[d] + *coeffs0;
if (c >= 255)
c -= 255;
q0_msb ^= gf8_ilog[c];
c = gf8_log[d] + *coeffs1;
if (c >= 255)
c -= 255;
q1_msb ^= gf8_ilog[c];
}
coeffs0++;
coeffs1++;
q_lsb += 2 * 44;
q_msb += 2 * 44;
if (q_lsb >= q_start) {
q_msb -= 2 * 1118;
q_lsb -= 2 * 1118;
}
}
*q0 = q0_lsb;
*(q0 + 1) = q0_msb;
*q1 = q1_lsb;
*(q1 + 1) = q1_msb;
q0 += 2;
q1 += 2;
q_lsb_start += 2 * 43;
q_msb_start += 2 * 43;
}
}

View File

@ -1,12 +0,0 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
#ifndef __LEC
#define __LEC
#define RS_L12_BITS 8
void scramble(unsigned char *);
void parity_p(unsigned char *in);
void parity_q(unsigned char *in);
#endif /* __LEC */

View File

@ -3,11 +3,15 @@
#ifndef LIBBURN_H
#define LIBBURN_H
/* Needed for off_t which is the (POSIX-ly) appropriate type for
expressing a file or stream size.
/*
Applications must use 64 bit off_t. E.g. by defining
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
or take special precautions to interface with the library by 64 bit integers
where this .h files prescribe off_t. Not to use 64 bit file i/o will keep the
application from producing and processing ISO images of more than 2 GB size.
XXX we should enforce 64-bitness for off_t
ts A61101 : this is usually done by the build system (if it is not broken)
*/
#include <sys/types.h>
@ -115,7 +119,8 @@ enum burn_write_types
2s gaps between tracks, no fonky lead-ins
With sequential DVD-R[W]: Incremental Streaming
With DVD-RAM/+RW: Random Writeable (used sequentially)
With DVD+R and BD-R: Track of open size
With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially)
With overwriteable DVD-RW: Rigid Restricted Overwrite
*/
BURN_WRITE_TAO,
@ -126,12 +131,22 @@ enum burn_write_types
With sequential DVD-R[W]: Disc-at-once, DAO
Single session, single track, fixed size mandatory, (-dvd-compat)
With other DVD or BD media: same as BURN_WRITE_TAO but may demand
that track size is known in advance.
*/
BURN_WRITE_SAO,
/** With CD: Raw disc at once recording.
all subcodes must be provided by lib or user
only raw block types are supported
With DVD and BD media: not supported.
ts A90901: THIS HAS BEEN DISABLED because its implementation
relied on code from cdrdao which is not understood
currently.
A burn run will abort with "FATAL" error message
if this mode is attempted.
@since 0.7.2
*/
BURN_WRITE_RAW,
@ -183,18 +198,41 @@ enum burn_block_types
BURN_BLOCK_SAO = 16384
};
/** Possible status' of the drive in regard to the disc in it. */
/** Possible status of the drive in regard to the disc in it. */
enum burn_disc_status
{
/** The current status is not yet known */
BURN_DISC_UNREADY,
/** The drive holds a blank disc */
/** The drive holds a blank disc. It is ready for writing from scratch.
Unused multi-session media:
CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
Blanked multi-session media (i.e. treated by burn_disc_erase())
CD-RW, DVD-RW
Overwriteable media with or without valid data
DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE
*/
BURN_DISC_BLANK,
/** There is no disc at all in the drive */
BURN_DISC_EMPTY,
/** There is an incomplete disc in the drive */
/** There is an incomplete disc in the drive. It is ready for appending
another session.
Written but not yet closed multi-session media
CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
*/
BURN_DISC_APPENDABLE,
/** There is a disc with data on it in the drive */
/** There is a disc with data on it in the drive. It is usable only for
reading.
Written and closed multi-session media
CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
Read-Only media
CD-ROM, DVD-ROM, BD-ROM
Note that many DVD-ROM drives report any written media
as Read-Only media and not by their real media types.
*/
BURN_DISC_FULL,
/* ts A61007 */
@ -204,7 +242,7 @@ enum burn_disc_status
/* ts A61020 */
/* @since 0.2.6 */
/** The media seems not to be suitable for burning */
/** The media seems to be unsuitable for reading and for writing */
BURN_DISC_UNSUITABLE
};
@ -306,11 +344,12 @@ struct burn_toc_entry
/* Indicates whether extension data are valid and eventually override
older elements in this structure:
bit0= DVD extension is valid
bit0= DVD extension is valid @since 0.3.2
@since 0.5.2 : DVD extensions are made valid for CD too
*/
unsigned char extensions_valid;
/* ts A70201 : DVD extension.
/* ts A70201 : DVD extension. extensions_valid:bit0
If invalid the members are guaranteed to be 0. */
/* @since 0.3.2 */
/* Tracks and session numbers are 16 bit. Here are the high bytes. */
@ -321,6 +360,13 @@ struct burn_toc_entry
/* min, sec, and frame may be too small if DVD extension is valid */
int track_blocks;
/* ts A90909 : LRA extension. extensions_valid:bit1 */
/* @since 0.7.2 */
/* MMC-5 6.27.3.18 : The Last Recorded Address is valid for DVD-R,
DVD-R DL when LJRS = 00b, DVD-RW, HD DVD-R, and BD-R.
This would mean profiles: 0x11, 0x15, 0x13, 0x14, 0x51, 0x41, 0x42
*/
int last_recorded_address;
};
@ -383,6 +429,13 @@ struct burn_source {
The size of a sector depends on BURN_MODE_*. The known range is
2048 to 2352.
If this call is reading from a pipe then it will learn
about the end of data only when that pipe gets closed on the
feeder side. So if the track size is not fixed or if the pipe
delivers less than the predicted amount or if the size is not
block aligned, then burning will halt until the input process
closes the pipe.
IMPORTANT:
If this function pointer is NULL, then the struct burn_source is of
version >= 1 and the job of .(*read)() is done by .(*read_xt)().
@ -812,7 +865,8 @@ void burn_allow_untested_profiles(int yes);
If the path does not exist in the filesystem yet, it is attempted to create
it as a regular file as soon as write operations are started.
The capabilities of role 3 resemble a blank DVD-R.
The capabilities of role 3 resemble a blank DVD-R. Nevertheless each
burn_disc_write() run may only write a single track.
One may distinguish pseudo-drives from MMC drives by call
burn_drive_get_drive_role().
@ -993,6 +1047,23 @@ int burn_drive_obtain_scsi_adr(char *path, int *bus_no, int *host_no,
int burn_drive_grab(struct burn_drive *drive, int load);
/* ts A90824 */
/** Calm down or alert a drive. Some drives stay alert after reading for
quite some time. This saves time with the startup for the next read
operation but also causes noise and consumes extra energy. It makes
sense to calm down the drive if no read operation is expected for the
next few seconds. The drive will get alert automatically if operations
are required.
@param drive The drive to influence.
@param flag Bitfield for control purposes
bit0= become alert (else start snoozing)
This is not mandatory to allow further drive operations
@return 1= success , 0= drive role not suitable for calming
@since 0.7.0
*/
int burn_drive_snooze(struct burn_drive *d, int flag);
/** Release a drive. This should not be done until the drive is no longer
busy (see burn_drive_get_status).
Linux: The drive device file is not reserved afterwards. (O_EXCL, F_SETLK).
@ -1072,6 +1143,61 @@ int burn_disc_read_atip(struct burn_drive *drive);
int burn_drive_get_start_end_lba(struct burn_drive *drive,
int *start_lba, int *end_lba, int flag);
/* ts A90902 */
/** Guess the manufacturer name of CD media from the ATIP addresses of lead-in
and lead-out. (Currently only lead-in is interpreted. Lead-out may in
future be used to identify the media type in more detail.)
The parameters of this call should be obtained by burn_disc_read_atip(d),
burn_drive_get_start_end_lba(d, &start_lba, &end_lba, 0),
burn_lba_to_msf(start_lba, &m_li, &s_li, &f_li) and
burn_lba_to_msf(end_lba, &m_lo, &s_lo, &f_lo).
@param m_li "minute" part of ATIP lead-in resp. start_lba
@param s_li "second" of lead-in resp. start_lba
@param f_li "frame" of lead-in
@param m_lo "minute" part of ATIP lead-out
@param s_lo "second" of lead-out
@param f_lo "frame" of lead-out
@param flag Bitfield for control purposes,
bit0= append a text "(aka ...)" to reply if other brands or
vendor names are known.
@return Printable text or NULL on memory shortage.
Dispose by free() when no longer needed.
@since 0.7.2
*/
char *burn_guess_cd_manufacturer(int m_li, int s_li, int f_li,
int m_lo, int s_lo, int f_lo, int flag);
/* ts A90909 */
/** Retrieve some media information which is mainly specific to CD. For other
media only the bits in reply parameter valid are supposed to be meaningful.
@param drive The drive to query.
@param disc_type A string saying either "CD-DA or CD-ROM", or "CD-I",
or ""CD-ROM XA", or "undefined".
@param disc_id A 32 bit number read from the media. (Meaning unclear yet)
@param bar_code 8 hex digits from a barcode on media read by the drive
(if the drive has a bar code reader built in).
@param app_code The Host Application Code which must be set in the Write
Parameters Page if the media is not unrestricted (URU==0).
@param valid Replies bits which indicate the validity of other reply
parameters or the state of certain CD info bits:
bit0= disc_type is valid
bit1= disc_id is valid
bit2= bar_code is valid
bit3= disc_app_code is valid
bit4= Disc is unrestricted (URU bit, 51h READ DISC INFO)
This seems to be broken with my drives. The bit is
0 and the validity bit for disc_app_code is 0 too.
bit5= Disc is nominally erasable (Erasable bit)
This will be set with overwriteable media which
libburn normally considers to be unerasable blank.
@since 0.7.2
*/
int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
unsigned int *disc_id, char bar_code[9], int *app_code,
int *valid);
/* ts A61110 */
/** Read start lba and Next Writeable Address of a track from media.
Usually a track lba is obtained from the result of burn_track_get_entry().
@ -1128,7 +1254,8 @@ off_t burn_disc_available_space(struct burn_drive *d,
0x11 "DVD-R sequential recording", 0x12 "DVD-RAM",
0x13 "DVD-RW restricted overwrite", 0x14 "DVD-RW sequential recording",
0x1a "DVD+RW", 0x1b "DVD+R",
0x2b "DVD+R/DL", 0x43 "BD-RE",
0x2b "DVD+R/DL",
0x41 "BD-R sequential recording", 0x43 "BD-RE",
0xffff "stdio file"
Note: 0xffff is not a MMC profile but a libburn invention.
If enabled by burn_allow_untested_profiles() it also writes to profiles
@ -1136,8 +1263,8 @@ off_t burn_disc_available_space(struct burn_drive *d,
Read-only are the profiles
0x08 "CD-ROM", 0x10 "DVD-ROM",
0x40 "BD-ROM",
For now read-only are BD-R profiles (testers wanted)
0x41 "BD-R sequential recording", 0x42 "BD-R random recording"
For now read-only is BD-R profile (testers wanted)
0x42 "BD-R random recording"
@param d The drive where the media is inserted.
@param pno Profile Number. See also mmc5r03c.pdf, table 89
@param name Profile Name (see above list, unknown profiles have empty name)
@ -1146,6 +1273,59 @@ off_t burn_disc_available_space(struct burn_drive *d,
*/
int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80]);
/* ts A90903 : API */
/** Obtain product id and standards defined media codes.
The product id is a printable string which is supposed to be the same
for identical media but should vary with non-identical media. Some media
do not allow to obtain such an id at all.
The pair (profile_number, product_id) should be the best id to identify
media with identical product specifications.
The reply parameters media_code1 and media_code2 can be used with
burn_guess_manufacturer()
The reply parameters have to be disposed by free() when no longer needed.
@param d The drive where the media is inserted.
@param product_id Reply: Printable text depicting manufacturer and
eventually media id.
@param media_code1 Reply: The eventual manufacturer identification as read
from DVD/BD media or a text "XXmYYsZZf" from CD media
ATIP lead-in.
@param media_code2 The eventual media id as read from DVD+/BD media or a
text "XXmYYsZZf" from CD ATIP lead-out.
@param book_type Book type text for DVD and BD.
Caution: is NULL with CD, even if return value says ok.
@param flag Bitfield for control purposes
bit0= do not escape " _/" (not suitable for
burn_guess_manufacturer())
@return 1= ok, product_id and media codes are valid,
0= no product id_available, reply parameters are NULL
<0= error
@since 0.7.2
*/
int burn_disc_get_media_id(struct burn_drive *d,
char **product_id, char **media_code1, char **media_code2,
char **book_type, int flag);
/* ts A90904 */
/** Guess the name of a manufacturer by profile number, manufacturer code
and media code. The profile number can be obtained by
burn_disc_get_profile(), the other two parameters can be obtained as
media_code1 and media_code2 by burn_get_media_product_id().
@param profile_no Profile number (submit -1 if not known)
@param manuf_code Manufacturer code from media (e.g. "RICOHJPN")
@param media_code Media ID code from media (e.g. "W11")
@param flag Bitfield for control purposes, submit 0
@return Printable text or NULL on memory shortage.
If the text begins with "Unknown " then no item of the
manufacturer list matched the codes.
Dispose by free() when no longer needed.
@since 0.7.2
*/
char *burn_guess_manufacturer(int profile_no,
char *manuf_code, char *media_code, int flag);
/** Tells whether a disc can be erased or not
@param d The drive to inquire.
@return Non-zero means erasable
@ -1160,8 +1340,8 @@ int burn_disc_erasable(struct burn_drive *d);
enum burn_drive_status burn_drive_get_status(struct burn_drive *drive,
struct burn_progress *p);
/** Creates a write_opts struct for burning to the specified drive
must be freed with burn_write_opts_free
/** Creates a write_opts struct for burning to the specified drive.
The returned object must later be freed with burn_write_opts_free().
@param drive The drive to write with
@return The write_opts, NULL on error
*/
@ -1211,7 +1391,8 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
/** Format media for use with libburn. This currently applies to DVD-RW
in state "Sequential Recording" (profile 0014h) which get formatted to
state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced"
by setting bit2 of flag. Other media cannot be formatted yet.
by setting bit2 of flag. DVD-RAM and BD-RE may get formatted initially
or re-formatted to adjust their Defect Managment.
This function usually returns while the drive is still in the process
of formatting. The formatting is done, when burn_drive_get_status()
returns BURN_DRIVE_IDLE. This may be immediately after return or may
@ -1226,7 +1407,8 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
bit1+2: size mode
0 = use parameter size as far as it makes sense
1 = insist in size 0 even if there is a better default known
(on DVD-RAM or BD-RE identical to size mode 0)
(on DVD-RAM or BD-R identical to size mode 0,
i.e. they never get formatted with payload size 0)
2 = without bit7: format to maximum available size
with bit7 : take size from indexed format descriptor
3 = without bit7: format to default size
@ -1235,13 +1417,16 @@ void burn_disc_erase(struct burn_drive *drive, int fast);
bit4= enforce re-format of (partly) formatted media
bit5= try to disable eventual defect management
bit6= try to avoid lengthy media certification
bit7= MMC expert application mode (else libburn tries to
choose a suitable format type):
bit8 to bit15 contain the index of the format to use. See
burn_disc_get_formats(), burn_disc_get_format_descr().
bit7, bit8 to bit15 =
bit7 enables MMC expert application mode (else libburn
tries to choose a suitable format type):
If it is set then bit8 to bit15 contain the index of
the format to use. See burn_disc_get_formats(),
burn_disc_get_format_descr().
Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13,
0x15, 0x26, 0x30, 0x31.
If bit7 is set, bit4 is set automatically.
0x15, 0x26, 0x30, 0x31, 0x32.
If bit7 is set, then bit4 is set automatically.
bit16= enable POW on blank BD-R
@since 0.3.0
*/
void burn_disc_format(struct burn_drive *drive, off_t size, int flag);
@ -1346,6 +1531,28 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
*/
void burn_disc_write(struct burn_write_opts *o, struct burn_disc *disc);
/* ts A90227 */
/** Control stream recording during the write run and eventually set the start
LBA for stream recording.
Stream recording is set from struct burn_write_opts when the write run
gets started. See burn_write_opts_set_stream_recording().
The call described here can be used later to override this setting and
to program automatic switching at a given LBA. It also affects subsequent
calls to burn_random_access_write().
@param drive The drive which performs the write operation.
@param recmode -1= disable stream recording
0= leave setting as is
1= enable stream recording
@param start The LBA where actual stream recording shall start.
(0 means unconditional stream recording)
@param flag Bitfield for control purposes (unused yet, submit 0).
@return 1=success , <=0 failure
@since 0.6.4
*/
int burn_drive_set_stream_recording(struct burn_drive *drive, int recmode,
int start, int flag);
/** Cancel an operation on a drive.
This will only work when the drive's busy state is BURN_DRIVE_READING or
BURN_DRIVE_WRITING.
@ -1482,6 +1689,22 @@ void burn_track_define_data(struct burn_track *t, int offset, int tail,
int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes);
/* ts A90910 */
/** Activates CD XA compatibility modes.
libburn currently writes data only in CD mode 1. Some programs insist in
sending data with additional management bytes. These bytes have to be
stripped in order to make the input suitable for BURN_MODE1.
@param t The track to manipulate
@param value 0= no conversion
1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1
see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data
all other values are reserved
@return 1=success , 0=unacceptable value
@since 0.7.2
*/
int burn_track_set_cdxa_conv(struct burn_track *t, int value);
/** Set the ISRC details for a track
@param t The track to change
@param country the 2 char country code. Each character must be
@ -1578,9 +1801,11 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size);
@param inp The burn_source for which the fifo shall act as proxy.
It can be disposed by burn_source_free() immediately
after this call.
@param chunksize The size in bytes of a chunk. Use 2048 for sources
suitable for BURN_BLOCK_MODE1 and 2352 for sources
which deliver for BURN_BLOCK_AUDIO.
@param chunksize The size in bytes of a chunk.
Use 2048 for sources suitable for BURN_BLOCK_MODE1,
2352 for sources which deliver for BURN_BLOCK_AUDIO,
2056 for sources which shall get treated by
burn_track_set_cdxa_conv(track, 1).
Some variations of burn_source might work only with
a particular chunksize. E.g. libisofs demands 2048.
@param chunks The number of chunks to be allocated in ring buffer.
@ -1864,12 +2089,15 @@ void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force);
/* ts A80412 */
/** Eventually makes use of the more modern write command AAh WRITE12 and
sets the Streaming bit. With DVD-RAM this can override the traditional
slowdown to half nominal speed. But if it speeds up writing then it also
disables error management and correction. Weigh your priorities.
This only affects the write operations of burn_disc_write().
sets the Streaming bit. With DVD-RAM and BD this can override the
traditional slowdown to half nominal speed. But if it speeds up writing
then it also disables error management and correction. Weigh your
priorities. This affects the write operations of burn_disc_write()
and subsequent calls of burn_random_access_write().
@param opts The write opts to change
@param value 0=use 2Ah WRITE10, 1=use AAh WRITE12 with Streaming bit
@since 0.6.4:
>=16 use WRITE12 but not before the LBA given by value
@since 0.4.6
*/
void burn_write_opts_set_stream_recording(struct burn_write_opts *opts,
@ -1931,6 +2159,34 @@ void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts,
void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts,
unsigned char hardware_error_retries);
/* ts A90815 */
/** Gets the list of profile codes supported by the drive.
Profiles depict the feature sets which constitute media types. For
known profile codes and names see burn_disc_get_profile().
@param d is the drive to query
@param num_profiles returns the number of supported profiles
@param profiles returns the profile codes
@param is_current returns the status of the corresponding profile code:
1= current, i.e. the matching media is loaded
0= not current, i.e. the matching media is not loaded
@return always 1 for now
@since 0.7.0
*/
int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles,
int profiles[64], char is_current[64]);
/* ts A90815 */
/** Obtains the profile name associated with a profile code.
@param profile_code the profile code to be translated
@param name returns the profile name (e.g. "DVD+RW")
@return 1= known profile code , 0= unknown profile code
@since 0.7.0
*/
int burn_obtain_profile_name(int profile_code, char name[80]);
/** Gets the maximum write speed for a drive and eventually loaded media.
The return value might change by the media type of already loaded media,
again by call burn_drive_grab() and again by call burn_disc_read_atip().
@ -2192,8 +2448,8 @@ void burn_version(int *major, int *minor, int *micro);
*/
#define burn_header_version_major 0
#define burn_header_version_minor 4
#define burn_header_version_micro 9
#define burn_header_version_minor 7
#define burn_header_version_micro 2
/** Note:
Above version numbers are also recorded in configure.ac because libtool
wants them as parameters at build time.
@ -2402,6 +2658,21 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
char *data, off_t data_count, int flag);
/* ts A81215 */
/** Inquire the maximum amount of readable data.
It is supposed that all LBAs in the range from 0 to media_read_acpacity-1
can be read via burn_read_data() although some of them may never have been
recorded. If tracks are recognizable then it is better to only read
LBAs which are part of some track.
@param d The drive from which to read
@param capacity Will return the result if valid
@param flag Bitfield for control purposes: Unused yet, submit 0.
@return 1=sucessful , <=0 an error occured
@since 0.6.0
*/
int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag);
/* ts A70812 */
/** Read data in random access mode.
The drive must be grabbed successfully before calling this function.
@ -2411,7 +2682,7 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
This is a synchronous call which returns only after the full read job
has ended (sucessfully or not). So it is wise not to read giant amounts
of data in a single call.
@param d The drive to which to write
@param d The drive from which to read
@param byte_address The start address of the read in byte (aligned to 2048)
@param data A memory buffer capable of taking data_size bytes
@param data_size The amount of data to be read. This does not have to
@ -2420,6 +2691,8 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
@param flag Bitfield for control purposes:
bit0= - reserved -
bit1= do not submit error message if read error
bit2= on error do not try to read a second time
with single block steps. @since 0.5.2
@return 1=sucessful , <=0 an error occured
@since 0.4.0
*/
@ -2467,7 +2740,6 @@ int burn_drive_get_drive_role(struct burn_drive *d);
int burn_drive_equals_adr(struct burn_drive *d1, char *adr2, int drive_role2);
#ifndef DOXYGEN
BURN_END_DECLS

View File

@ -1,7 +1,7 @@
/* libdax_msgs
Message handling facility of libdax.
Copyright (C) 2006 - 2008 Thomas Schmitt <scdbackup@gmx.net>,
Copyright (C) 2006 - 2009 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPL version 2
*/

View File

@ -1,7 +1,7 @@
/* libdax_msgs
Message handling facility of libdax.
Copyright (C) 2006-2008 Thomas Schmitt <scdbackup@gmx.net>,
Copyright (C) 2006-2009 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPL version 2
*/
@ -432,6 +432,8 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020007 (NOTE,HIGH) = Closed O_EXCL scsi siblings
0x00020008 (SORRY,HIGH) = Device busy. Failed to fcntl-lock
0x00020009 (SORRY,HIGH) = Neither stdio-path nor its directory exist
0x0002000a (FAILURE,HIGH) = Cannot accept '...' as SG_IO CDROM drive
0x0002000b (FAILURE,HIGH) = File object '...' not found
General library operations:
@ -529,6 +531,27 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x0002015c (FAILURE,HIGH) = Fifo size is smaller than desired peek buffer
0x0002015d (FAILURE,HIGH) = Fifo input ended short of desired peek buffer size
0x0002015e (FATAL,HIGH) = Fifo is already under consumption when peeking
0x0002015f (MISHAP,HIGH) = Damaged CD table-of-content detected and truncated
0x00020160 (WARNING,HIGH) = Session without leadout encountered
0x00020161 (WARNING,HIGH) = Empty session deleted
0x00020162 (SORRY,HIGH) = BD-R not unformatted blank any more. Cannot format
0x00020163 (NOTE,HIGH) = Blank BD-R left unformatted for zero spare capacity
0x00020164 (SORRY,HIGH) = Drive does not format BD-RE without spares
0x00020165 (WARNING,HIGH) = Drive does not support fast formatting
0x00020166 (WARNING,HIGH) = Drive does not support full formatting
0x00020167 (SORRY,HIGH) = Drive does not support non-default formatting
0x00020168 (FAILURE,HIGH) = Media not properly formatted. Cannot write.
0x00020169 (WARNING,HIGH) = Last session on media is still open
0x0002016a (FAILURE,HIGH) = No MMC transport adapter is present
0x0002016b (WARNING,HIGH) = No MMC transport adapter is present
0x0002016c (DEBUG,HIGH) = No MMC transport adapter is present
0x0002016e (DEBUG,HIGH) = MODE SENSE page 2A too short
0x0002016f (DEBUG,HIGH) = Unable to grab scanned drive
0x00020170 (NOTE,HIGH) = Closing open session before writing new one
0x00020171 (NOTE,HIGH) = Closing BD-R with accidently open session
0x00020172 (SORRY,HIGH) = Read start address larger than number of readable blocks
0x00020173 (FAILURE,HIGH) = Drive tells NWA smaller than last written address
libdax_audioxtr:
0x00020200 (SORRY,HIGH) = Cannot open audio source file

File diff suppressed because it is too large Load Diff

View File

@ -72,9 +72,22 @@ int mmc_compose_mode_page_5(struct burn_drive *d,
int mmc_read_10(struct burn_drive *d, int start, int amount,
struct buffer *buf);
/* ts A81210 : Determine the upper limit of readable data size */
int mmc_read_capacity(struct burn_drive *d);
/* ts A61201 */
char *mmc_obtain_profile_name(int profile_number);
/* mmc5r03c.pdf 4.3.4.4.1 d) "The maximum number of RZones is 2 302." */
#define BURN_MMC_FAKE_TOC_MAX_SIZE 2302
/* ts A90903 */
/* MMC backend of API call burn_get_media_product_id()
*/
int mmc_get_media_product_id(struct burn_drive *d,
char **product_id, char **media_code1, char **media_code2,
char **book_type, int flag);
#endif /*__MMC*/

View File

@ -143,7 +143,7 @@ int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim)
int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts,
int underrun_proof)
{
if (!opts->drive->mdata->valid)
if (opts->drive->mdata->valid <= 0)
return 0;
if (opts->drive->mdata->underrun_proof) {
opts->underrun_proof = underrun_proof;
@ -385,7 +385,7 @@ void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force)
void burn_write_opts_set_stream_recording(struct burn_write_opts *opts,
int value)
{
opts->do_stream_recording = !!value;
opts->do_stream_recording = value;
}

63
libburn/os-dummy.h Normal file
View File

@ -0,0 +1,63 @@
/* os-dummy.h
Operating system specific libburn definitions and declarations. Included
by os.h in case of compilation for
Unknown POSIX like systems
with the dummy MMC transport adapter sg-dummy.c
Copyright (C) 2009 Thomas Schmitt <scdbackup@gmx.net>, provided under GPL
*/
/** List of all signals which shall be caught by signal handlers and trigger
a graceful abort of libburn. (See man 7 signal.)
*/
/* Once as system defined macros */
#define BURN_OS_SIGNAL_MACRO_LIST \
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, \
SIGFPE, SIGSEGV, SIGPIPE, SIGALRM, SIGTERM, \
SIGUSR1, SIGUSR2, SIGXCPU, SIGTSTP, SIGTTIN, \
SIGTTOU
/* Once as text 1:1 list of strings for messages and interpreters */
#define BURN_OS_SIGNAL_NAME_LIST \
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGABRT", \
"SIGFPE", "SIGSEGV", "SIGPIPE", "SIGALRM", "SIGTERM", \
"SIGUSR1", "SIGUSR2", "SIGXCPU", "SIGTSTP", "SIGTTIN", \
"SIGTTOU"
/* The number of above list items */
#define BURN_OS_SIGNAL_COUNT 16
/** To list all signals which shall surely not be caught */
#define BURN_OS_NON_SIGNAL_MACRO_LIST \
SIGKILL, SIGCHLD, SIGSTOP
/* The number of above list items */
#define BURN_OS_NON_SIGNAL_COUNT 3
/* The maximum size for a (SCSI) i/o transaction */
/* Important : MUST be at least 32768 ! */
#define BURN_OS_TRANSPORT_BUFFER_SIZE 65536
/* To hold the position of the most recently delivered address from
device enumeration.
*/
struct burn_drive_enumerator_struct {
int pos;
int info_count;
char **info_list;
};
#define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \
typedef struct burn_drive_enumerator_struct burn_drive_enumerator_t;
/* The list of operating system dependent elements in struct burn_drive.
Usually they are initialized in sg-*.c:enumerate_common().
*/
#define BURN_OS_TRANSPORT_DRIVE_ELEMENTS \
int just_a_dummy;

View File

@ -51,11 +51,17 @@ SIGKILL, SIGCHLD, SIGSTOP, SIGURG, SIGWINCH
#define BURN_OS_TRANSPORT_BUFFER_SIZE 65536
/* To hold the index number of the most recently delivered address from
/* To hold the position of the most recently delivered address from
device enumeration.
*/
struct burn_drive_enumerator_struct {
int pos;
int info_count;
char **info_list;
};
#define BURN_OS_DEFINE_DRIVE_ENUMERATOR_T \
typedef int burn_drive_enumerator_t;
typedef struct burn_drive_enumerator_struct burn_drive_enumerator_t;
/* Parameters for sibling list. See sibling_fds, sibling_fnames */

View File

@ -3,7 +3,7 @@
Operating system specific libburn definitions and declarations.
The macros defined here are used by libburn modules in order to
avoid own system dependent case distinctions.
Copyright (C) 2006 Thomas Schmitt <scdbackup@gmx.net>, provided under GPL
Copyright (C) 2009 Thomas Schmitt <scdbackup@gmx.net>, provided under GPL
*/
#ifndef BURN_OS_H_INCLUDED
@ -20,14 +20,23 @@
#include "os-freebsd.h"
#else /* operating system case distinction */
#else
#ifdef __linux
/* --------- Linux kernels 2.4 and 2.6 with Linux SCSI Generic (sg) -------- */
#include "os-linux.h"
#endif /* End of operating system case distinction */
#else
/* --------- Any other system. With dummy MMC transport sg-dummy.c --------- */
#include "os-dummy.h"
#endif /* ! __linux */
#endif /* ! __FreeBSD__ */
#endif /* ! BURN_OS_H_INCLUDED */

View File

@ -27,7 +27,6 @@
#include "crc.h"
#include "debug.h"
#include "init.h"
#include "lec.h"
#include "toc.h"
#include "util.h"
#include "sg.h"
@ -323,7 +322,7 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
int alignment = 2048, start, upto, chunksize = 1, err, cpy_size, i;
int sose_mem = 0, fd = -1, ret;
char msg[81], *wpt;
struct buffer buf;
struct buffer buf, *buffer_mem = d->buffer;
/*
#define Libburn_read_data_adr_logginG 1
@ -371,6 +370,20 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
msg, 0, 0);
return 0;
}
if (d->media_read_capacity != 0x7fffffff && byte_address >=
((off_t) d->media_read_capacity + (off_t) 1) * (off_t) 2048) {
if (!(flag & 2)) {
sprintf(msg,
"Read start address %ds larger than number of readable blocks %d",
(int) (byte_address / 2048 + !!(byte_address % 2048)),
d->media_read_capacity);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020172,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
}
return 0;
}
if (d->busy != BURN_DRIVE_IDLE) {
libdax_msgs_submit(libdax_messenger,
@ -443,7 +456,8 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
d->silent_on_scsi_error = sose_mem;
if (err == BE_CANCELLED) {
/* Try to read a smaller part of the chunk */
for (i = 0; i < chunksize - 1; i++) {
if(!(flag & 4))
for (i = 0; i < chunksize - 1; i++) {
if (flag & 2)
d->silent_on_scsi_error = 1;
if (d->drive_role == 1) {
@ -484,7 +498,7 @@ ex:;
if (fd != -1)
close(fd);
*/
d->buffer = NULL;
d->buffer = buffer_mem;
d->busy = BURN_DRIVE_IDLE;
return ret;
}

View File

@ -21,6 +21,7 @@ int mmc_function_spy(struct burn_drive *d, char * text);
static unsigned char SBC_LOAD[] = { 0x1b, 0, 0, 0, 3, 0 };
static unsigned char SBC_UNLOAD[] = { 0x1b, 0, 0, 0, 2, 0 };
static unsigned char SBC_START_UNIT[] = { 0x1b, 0, 0, 0, 1, 0 };
static unsigned char SBC_STOP_UNIT[] = { 0x1b, 0, 0, 0, 0, 0 };
void sbc_load(struct burn_drive *d)
{
@ -79,28 +80,46 @@ void sbc_eject(struct burn_drive *d)
int sbc_start_unit(struct burn_drive *d)
{
struct command c;
int ret;
if (mmc_function_spy(d, "start_unit") <= 0)
return 0;
scsi_init_command(&c, SBC_START_UNIT, sizeof(SBC_START_UNIT));
/*
memcpy(c.opcode, SBC_START_UNIT, sizeof(SBC_START_UNIT));
c.oplen = sizeof(SBC_START_UNIT);
c.page = NULL;
*/
c.retry = 1;
c.opcode[1] |= 1; /* ts A70918 : Immed */
c.dir = NO_TRANSFER;
d->issue_command(d, &c);
if (c.error)
return 0;
/* ts A70918 : now asynchronous */
return spc_wait_unit_attention(d, 1800, "START UNIT", 0);
d->is_stopped = 0;
ret = spc_wait_unit_attention(d, 1800, "START UNIT", 0);
return ret;
}
/* ts A90824 : Trying to reduce drive noise */
int sbc_stop_unit(struct burn_drive *d)
{
struct command c;
int ret;
if (mmc_function_spy(d, "stop_unit") <= 0)
return 0;
scsi_init_command(&c, SBC_STOP_UNIT, sizeof(SBC_STOP_UNIT));
c.retry = 0;
c.opcode[1] |= 1; /* Immed */
c.dir = NO_TRANSFER;
d->issue_command(d, &c);
if (c.error)
return 0;
ret = spc_wait_unit_attention(d, 1800, "STOP UNIT", 0);
d->is_stopped = 1;
return ret;
}
/* ts A61021 : the sbc specific part of sg.c:enumerate_common()
*/
@ -109,6 +128,8 @@ int sbc_setup_drive(struct burn_drive *d)
d->eject = sbc_eject;
d->load = sbc_load;
d->start_unit = sbc_start_unit;
d->stop_unit = sbc_stop_unit;
d->is_stopped = 0;
return 1;
}

View File

@ -15,10 +15,12 @@
#include "sector.h"
#include "crc.h"
#include "debug.h"
#include "lec.h"
#include "toc.h"
#include "write.h"
#include "libdax_msgs.h"
extern struct libdax_msgs *libdax_messenger;
#ifdef Libburn_log_in_and_out_streaM
/* <<< ts A61031 */
@ -206,8 +208,7 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
{
struct burn_drive *d = opts->drive;
struct buffer *out = d->buffer;
int outmode;
int seclen;
int outmode, seclen;
unsigned char *ret;
outmode = get_outmode(opts);
@ -223,6 +224,7 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
seclen += burn_subcode_length(outmode);
/* ts A61219 : opts->obs is eventually a 32k trigger for DVD */
/* (there is enough buffer size reserve for track->cdxa_conversion) */
if (out->bytes + seclen > BUFFER_SIZE ||
(opts->obs > 0 && out->bytes + seclen > opts->obs)) {
int err;
@ -242,7 +244,6 @@ static unsigned char *get_sector(struct burn_write_opts *opts,
out->bytes = 0;
out->sectors = 0;
}
ret = out->data + out->bytes;
out->bytes += seclen;
out->sectors++;
@ -299,7 +300,17 @@ static int convert_data(struct burn_write_opts *o, struct burn_track *track,
return 0;
if ((outmode & BURN_MODE_BITS) == (inmode & BURN_MODE_BITS)) {
/* see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data
Table 24 Mode 2 Formed Sector Sub-header Format */
if (track != NULL)
if (track->cdxa_conversion == 1)
inlen += 8;
get_bytes(track, inlen, data);
if (track != NULL)
if (track->cdxa_conversion == 1)
memmove(data, data + 8, inlen - 8);
return 1;
}
@ -413,7 +424,8 @@ int sector_toc(struct burn_write_opts *o, int mode)
return 0;
subcode_toc(d, mode, subs);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 1);
if (sector_headers(o, data, mode, 1) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -433,7 +445,8 @@ int sector_pregap(struct burn_write_opts *o,
return 0;
subcode_user(o, subs, tno, control, 0, NULL, 1);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 0);
if (sector_headers(o, data, mode, 0) <= 0)
return 0;
sector_common(--)
return 1;
}
@ -450,11 +463,12 @@ int sector_postgap(struct burn_write_opts *o,
return 0;
/* ts A61010 */
if (convert_data(o, NULL, mode, data) <= 0)
return 0;;
return 0;
/* use last index in track */
subcode_user(o, subs, tno, control, 1, NULL, 1);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 0);
if (sector_headers(o, data, mode, 0) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -625,7 +639,8 @@ int sector_lout(struct burn_write_opts *o, unsigned char control, int mode)
return 0;
subcode_lout(o, control, subs);
convert_subs(o, mode, subs, data);
sector_headers(o, data, mode, 0);
if (sector_headers(o, data, mode, 0) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -660,7 +675,8 @@ int sector_data(struct burn_write_opts *o, struct burn_track *t, int psub)
t->entry->control, 1, &t->isrc, psub);
convert_subs(o, t->mode, subs, data);
sector_headers(o, data, t->mode, 0);
if (sector_headers(o, data, t->mode, 0) <= 0)
return 0;
sector_common(++)
return 1;
}
@ -711,118 +727,31 @@ int sector_headers_is_ok(struct burn_write_opts *o, int mode)
return 0;
}
void sector_headers(struct burn_write_opts *o, unsigned char *out,
/* ts A90830 : changed return type to int
@return 0= failure
1= success
*/
int sector_headers(struct burn_write_opts *o, unsigned char *out,
int mode, int leadin)
{
struct burn_drive *d = o->drive;
unsigned int crc;
int min, sec, frame;
int modebyte = -1;
/* ts A61009 */
#if 1
int ret;
ret = sector_headers_is_ok(o, mode);
if (ret != 2)
return;
modebyte = 1;
return (!! ret);
#else
if (mode & BURN_AUDIO) /* no headers for "audio" */
return;
if (o->write_type == BURN_WRITE_SAO)
return;
/* ts A61031 */
if (o->write_type == BURN_WRITE_TAO)
return;
if (mode & BURN_MODE1)
modebyte = 1;
#endif
/* ts A61009 : now ensured by burn_disc_write_is_ok() */
/* a ssert(modebyte == 1); */
out[0] = 0;
memset(out + 1, 0xFF, 10); /* sync */
out[11] = 0;
if (leadin) {
burn_lba_to_msf(d->rlba, &min, &sec, &frame);
out[12] = dec_to_bcd(min) + 0xA0;
out[13] = dec_to_bcd(sec);
out[14] = dec_to_bcd(frame);
out[15] = modebyte;
} else {
burn_lba_to_msf(d->alba, &min, &sec, &frame);
out[12] = dec_to_bcd(min);
out[13] = dec_to_bcd(sec);
out[14] = dec_to_bcd(frame);
out[15] = modebyte;
}
if (mode & BURN_MODE1) {
crc = crc_32(out, 2064);
out[2064] = crc & 0xFF;
crc >>= 8;
out[2065] = crc & 0xFF;
crc >>= 8;
out[2066] = crc & 0xFF;
crc >>= 8;
out[2067] = crc & 0xFF;
}
if (mode & BURN_MODE1) {
memset(out + 2068, 0, 8);
parity_p(out);
parity_q(out);
}
scramble(out);
/* ts A90830 : lec.c is copied from cdrdao.
I have no idea yet how lec.c implements the Reed-Solomon encoding
which is described in ECMA-130 for CD-ROM.
So this got removed for now.
*/
libdax_msgs_submit(libdax_messenger, o->drive->global_index,
0x0002010a,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Raw CD write modes are not supported", 0, 0);
return 0;
}
#if 0
void process_q(struct burn_drive *d, unsigned char *q)
{
unsigned char i[5];
int mode;
mode = q[0] & 0xF;
/* burn_print(12, "mode: %d : ", mode);*/
switch (mode) {
case 1:
/* burn_print(12, "tno = %d : ", q[1]);
burn_print(12, "index = %d\n", q[2]);
*/
/* q[1] is the track number (starting at 1) q[2] is the index
number (starting at 0) */
#warning this is totally bogus
if (q[1] - 1 > 99)
break;
if (q[2] > d->toc->track[q[1] - 1].indices) {
burn_print(12, "new index at %d\n", d->alba);
d->toc->track[q[1] - 1].index[q[2]] = d->alba;
d->toc->track[q[1] - 1].indices++;
}
break;
case 2:
/* XXX dont ignore these */
break;
case 3:
/* burn_print(12, "ISRC data in mode 3 q\n");*/
i[0] = isrc[(q[1] << 2) >> 2];
/* burn_print(12, "0x%x 0x%x 0x%x 0x%x 0x%x\n", q[1], q[2], q[3], q[4], q[5]);
burn_print(12, "ISRC - %c%c%c%c%c\n", i[0], i[1], i[2], i[3], i[4]);
*/
break;
default:
/* ts A61009 : if reactivated then witout Assert */
a ssert(0);
}
}
#endif
/* this needs more info. subs in the data? control/adr? */
@ -835,12 +764,14 @@ void process_q(struct burn_drive *d, unsigned char *q)
*/
int sector_identify(unsigned char *data)
{
scramble(data);
/*
scramble(data);
check mode byte for 1 or 2
test parity to see if it's a valid sector
if invalid, return BURN_MODE_AUDIO;
else return mode byte (what about mode 2 formless? heh)
*/
return BURN_MODE1;
}

View File

@ -22,7 +22,7 @@ int sector_data(struct burn_write_opts *, struct burn_track *t, int psub);
/* ts A61009 */
int sector_headers_is_ok(struct burn_write_opts *o, int mode);
void sector_headers(struct burn_write_opts *, unsigned char *,
int sector_headers(struct burn_write_opts *, unsigned char *,
int mode, int leadin);
void subcode_user(struct burn_write_opts *, unsigned char *s,
unsigned char tno, unsigned char control,

229
libburn/sg-dummy.c Normal file
View File

@ -0,0 +1,229 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/*
This is the main operating system dependent SCSI part of libburn. It implements
the transport level aspects of SCSI control and command i/o.
Present implementation: default dummy which enables libburn only to work
with stdio: pseudo drive addresses.
For real implementations see sg-linux.c or sg-freebsd.c
*/
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#ifdef Libburn_os_has_statvfS
#include <sys/statvfs.h>
#endif /* Libburn_os_has_stavtfS */
#include "transport.h"
#include "drive.h"
#include "sg.h"
#include "spc.h"
#include "mmc.h"
#include "sbc.h"
#include "debug.h"
#include "toc.h"
#include "util.h"
#include "libdax_msgs.h"
extern struct libdax_msgs *libdax_messenger;
/** Returns the next index number and the next enumerated drive address.
The enumeration has to cover all available and accessible drives. It is
allowed to return addresses of drives which are not available but under
some (even exotic) circumstances could be available. It is on the other
hand allowed, only to hand out addresses which can really be used right
in the moment of this call. (This implementation chooses the former.)
@param idx An opaque handle. Make no own theories about it.
@param adr Takes the reply
@param adr_size Gives maximum size of reply including final 0
@param initialize 1 = start new,
0 = continue, use no other values for now
-1 = finish
@return 1 = reply is a valid address , 0 = no further address available
-1 = severe error (e.g. adr_size too small)
*/
int sg_give_next_adr(burn_drive_enumerator_t *idx,
char adr[], int adr_size, int initialize)
{
return 0;
}
/** Brings all available, not-whitelist-banned, and accessible drives into
libburn's list of drives.
*/
/* ts A61115: replacing call to sg-implementation internals from drive.c */
int scsi_enumerate_drives(void)
{
libdax_msgs_submit(libdax_messenger, -1, 0x0002016b,
LIBDAX_MSGS_SEV_WARNING, LIBDAX_MSGS_PRIO_HIGH,
"No MMC transport adapter is present. Running on sg-dummy.c.",
0, 0);
return 1;
}
/** Tells wether libburn has the given drive in use or exclusively reserved.
If it is "open" then libburn will eventually call sg_release() on it when
it is time to give up usage resp. reservation.
*/
/** Published as burn_drive.drive_is_open() */
int sg_drive_is_open(struct burn_drive * d)
{
return 0;
}
/** Opens the drive for SCSI commands and - if burn activities are prone
to external interference on your system - obtains an exclusive access lock
on the drive. (Note: this is not physical tray locking.)
A drive that has been opened with sg_grab() will eventually be handed
over to sg_release() for closing and unreserving.
*/
int sg_grab(struct burn_drive *d)
{
libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002016a,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
"No MMC transport adapter is present. Running on sg-dummy.c.",
0, 0);
return 0;
}
/** Gives up the drive for SCSI commands and releases eventual access locks.
(Note: this is not physical tray locking.)
*/
int sg_release(struct burn_drive *d)
{
return 0;
}
/** Sends a SCSI command to the drive, receives reply and evaluates wether
the command succeeded or shall be retried or finally failed.
Returned SCSI errors shall not lead to a return value indicating failure.
The callers get notified by c->error. An SCSI failure which leads not to
a retry shall be notified via scsi_notify_error().
The Libburn_log_sg_commandS facility might be of help when problems with
a drive have to be examined. It shall stay disabled for normal use.
@return: 1 success , <=0 failure
*/
int sg_issue_command(struct burn_drive *d, struct command *c)
{
libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002016a,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
"No MMC transport adapter is present. Running on sg-dummy.c.",
0, 0);
return -1;
}
/** Tries to obtain SCSI address parameters.
@return 1 is success , 0 is failure
*/
int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no,
int *target_no, int *lun_no)
{
libdax_msgs_submit(libdax_messenger, -1, 0x0002016c,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
"No MMC transport adapter is present. Running on sg-dummy.c.",
0, 0);
return 0;
}
/** Tells wether a text is a persistent address as listed by the enumeration
functions.
*/
int sg_is_enumerable_adr(char *adr)
{
return(0);
}
/** Estimate the potential payload capacity of a file address.
@param path The address of the file to be examined. If it does not
exist yet, then the directory will be inquired.
@param bytes The pointed value gets modified, but only if an estimation is
possible.
@return -2 = cannot perform necessary operations on file object
-1 = neither path nor dirname of path exist
0 = could not estimate size capacity of file object
1 = estimation has been made, bytes was set
*/
int burn_os_stdio_capacity(char *path, off_t *bytes)
{
struct stat stbuf;
#ifdef Libburn_os_has_statvfS
struct statvfs vfsbuf;
#endif
char testpath[4096], *cpt;
long blocks;
off_t add_size = 0;
testpath[0] = 0;
blocks = *bytes / 512;
if (stat(path, &stbuf) == -1) {
strcpy(testpath, path);
cpt = strrchr(testpath, '/');
if(cpt == NULL)
strcpy(testpath, ".");
else if(cpt == testpath)
testpath[1] = 0;
else
*cpt = 0;
if (stat(testpath, &stbuf) == -1)
return -1;
#ifdef Libburn_if_this_was_linuX
} else if(S_ISBLK(stbuf.st_mode)) {
fd = open(path, open_mode);
if (fd == -1)
return -2;
ret = ioctl(fd, BLKGETSIZE, &blocks);
close(fd);
if (ret == -1)
return -2;
*bytes = ((off_t) blocks) * (off_t) 512;
#endif /* Libburn_if_this_was_linuX */
} else if(S_ISREG(stbuf.st_mode)) {
add_size = stbuf.st_blocks * (off_t) 512;
strcpy(testpath, path);
} else
return 0;
if (testpath[0]) {
#ifdef Libburn_os_has_statvfS
if (statvfs(testpath, &vfsbuf) == -1)
return -2;
*bytes = add_size + ((off_t) vfsbuf.f_bsize) *
(off_t) vfsbuf.f_bavail;
#else /* Libburn_os_has_statvfS */
return 0;
#endif /* ! Libburn_os_has_stavtfS */
}
return 1;
}

View File

@ -76,7 +76,7 @@ Send feedback to libburn-hackers@pykix.org .
#include <err.h> /* XXX */
/* ts A70909 : >>> untestet yet wether this compiles */
/* ts A70909 */
#include <sys/statvfs.h>

View File

@ -1,6 +1,5 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
@ -18,7 +17,7 @@
#include <err.h> /* XXX */
/* ts A70909 : >>> untestet yet wether this compiles */
/* ts A70909 */
#include <sys/statvfs.h>
@ -553,11 +552,26 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
if (c->page) {
ccb->csio.data_ptr = c->page->data;
if (c->dir == FROM_DRIVE) {
ccb->csio.dxfer_len = BUFFER_SIZE;
/* ts A90430 : Ticket 148 , by jwehle :
"On ... FreeBSD 6.4 which has a usb memory reader in
addition to a ATAPI DVD burner sg_issue_command
will hang while the SCSI bus is being scanned"
*/
if (c->dxfer_len >= 0)
ccb->csio.dxfer_len = c->dxfer_len;
else
ccb->csio.dxfer_len = BUFFER_SIZE;
/* touch page so we can use valgrind */
memset(c->page->data, 0, BUFFER_SIZE);
} else {
assert(c->page->bytes > 0);
/* ts A90430 */
/* a ssert(c->page->bytes > 0); */
if (c->page->bytes <= 0) {
c->error = 1;
return 0;
}
ccb->csio.dxfer_len = c->page->bytes;
}
} else {
@ -622,7 +636,6 @@ int burn_os_stdio_capacity(char *path, off_t *bytes)
struct statvfs vfsbuf;
char testpath[4096], *cpt;
long blocks;
int open_mode = O_RDWR, fd, ret;
off_t add_size = 0;
testpath[0] = 0;
@ -642,6 +655,8 @@ int burn_os_stdio_capacity(char *path, off_t *bytes)
#ifdef Libburn_if_this_was_linuX
} else if(S_ISBLK(stbuf.st_mode)) {
int open_mode = O_RDWR, fd, ret;
if(burn_sg_open_o_excl)
open_mode |= O_EXCL;
fd = open(path, open_mode);

View File

@ -158,6 +158,13 @@ static char linux_ata_device_family[80] = {"/dev/hd%c"};
static int linux_ata_enumerate_verbous = 0;
/* The waiting time before eventually retrying a failed SCSI command.
Before each retry wait Libburn_sg_linux_retry_incR longer than with
the previous one.
*/
#define Libburn_sg_linux_retry_usleeP 100000
#define Libburn_sg_linux_retry_incR 100000
/** PORTING : ------ libburn portable headers and definitions ----- */
@ -470,7 +477,7 @@ static int sg_fcntl_lock(int *fd, char *fd_name, int l_type, int verbous)
/* ts A60926 */
static int sg_open_drive_fd(char *fname, int scan_mode)
{
int open_mode = O_RDWR, fd;
int open_mode = O_RDWR, fd, tries= 0;
char msg[81];
/* ts A70409 : DDLP-B */
@ -502,7 +509,8 @@ static int sg_open_drive_fd(char *fname, int scan_mode)
"libburn: experimental: O_EXCL= %d , O_NDELAY= %d\n",
!!(open_mode&O_EXCL),!!(open_mode&O_NDELAY));
*/
try_open:;
fd = open(fname, open_mode);
if (fd == -1) {
/* <<< debugging
@ -511,6 +519,17 @@ static int sg_open_drive_fd(char *fname, int scan_mode)
fname,errno);
*/
if (errno == EBUSY) {
tries++;
/* <<< debugging
fprintf(stderr,
"\nlibburn_DEBUG: EBUSY , tries= %d\n", tries);
*/
if (tries < 4) {
usleep(2000000);
goto try_open;
}
sg_handle_busy_device(fname, errno);
return -1;
@ -644,12 +663,193 @@ failed:;
}
#define Libburn_drive_new_deaL 1
#ifdef Libburn_drive_new_deaL
/* ts A80731 */
static int is_ata_drive(char *fname)
{
int fd;
struct hd_driveid tm;
fd = sg_open_drive_fd(fname, 1);
if (fd == -1) {
if (linux_ata_enumerate_verbous)
fprintf(stderr,"open failed, errno=%d '%s'\n",
errno, strerror(errno));
return 0;
}
memset(&tm, 0, sizeof(tm));
ioctl(fd, HDIO_GET_IDENTITY, &tm);
/* not atapi */
if (!(tm.config & 0x8000) || (tm.config & 0x4000)) {
if (linux_ata_enumerate_verbous)
fprintf(stderr, "not marked as ATAPI\n");
sg_close_drive_fd(fname, -1, &fd, 0);
return 0;
}
/* if SG_IO fails on an atapi device, we should stop trying to
use hd* devices */
if (sgio_test(fd) == -1) {
if (linux_ata_enumerate_verbous)
fprintf(stderr,
"FATAL: sgio_test() failed: errno=%d '%s'\n",
errno, strerror(errno));
sg_close_drive_fd(fname, -1, &fd, 0);
return 0;
}
if (sg_close_drive_fd(fname, -1, &fd, 1) <= 0) {
if (linux_ata_enumerate_verbous)
fprintf(stderr,
"cannot close properly, errno=%d '%s'\n",
errno, strerror(errno));
return 0;
}
return 1;
}
static int is_scsi_drive(char *fname, int *bus_no, int *host_no,
int *channel_no, int *target_no, int *lun_no)
{
int fd, sid_ret = 0, ret;
struct sg_scsi_id sid;
int sibling_fds[BURN_OS_SG_MAX_SIBLINGS], sibling_count= 0;
char sibling_fnames[BURN_OS_SG_MAX_SIBLINGS][BURN_OS_SG_MAX_NAMELEN];
fd = sg_open_drive_fd(fname, 1);
if (fd == -1) {
if (linux_sg_enumerate_debug)
fprintf(stderr, "open failed, errno=%d '%s'\n",
errno, strerror(errno));
return 0;
}
sid_ret = ioctl(fd, SG_GET_SCSI_ID, &sid);
if (sid_ret == -1) {
sid.scsi_id = -1; /* mark SCSI address as invalid */
if(linux_sg_enumerate_debug)
fprintf(stderr,
"ioctl(SG_GET_SCSI_ID) failed, errno=%d '%s' , ",
errno, strerror(errno));
if (sgio_test(fd) == -1) {
if (linux_sg_enumerate_debug)
fprintf(stderr,
"FATAL: sgio_test() failed: errno=%d '%s'",
errno, strerror(errno));
sg_close_drive_fd(fname, -1, &fd, 0);
return 0;
}
#ifdef CDROM_DRIVE_STATUS
/* http://developer.osdl.org/dev/robustmutexes/
src/fusyn.hg/Documentation/ioctl/cdrom.txt */
sid_ret = ioctl(fd, CDROM_DRIVE_STATUS, 0);
if(linux_sg_enumerate_debug)
fprintf(stderr,
"ioctl(CDROM_DRIVE_STATUS) = %d , ",
sid_ret);
if (sid_ret != -1 && sid_ret != CDS_NO_INFO)
sid.scsi_type = TYPE_ROM;
else
sid_ret = -1;
#endif /* CDROM_DRIVE_STATUS */
}
#ifdef SCSI_IOCTL_GET_BUS_NUMBER
/* Hearsay A61005 */
if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, bus_no) == -1)
*bus_no = -1;
#endif
if (sg_close_drive_fd(fname, -1, &fd,
sid.scsi_type == TYPE_ROM ) <= 0) {
if (linux_sg_enumerate_debug)
fprintf(stderr,
"cannot close properly, errno=%d '%s'\n",
errno, strerror(errno));
return 0;
}
if ( (sid_ret == -1 || sid.scsi_type != TYPE_ROM)
&& !linux_sg_accept_any_type) {
if (linux_sg_enumerate_debug)
fprintf(stderr, "sid.scsi_type = %d (!= TYPE_ROM)\n",
sid.scsi_type);
return 0;
}
if (sid_ret == -1 || sid.scsi_id < 0) {
/* ts A61211 : employ a more general ioctl */
ret = sg_obtain_scsi_adr(fname, bus_no, host_no,
channel_no, target_no, lun_no);
if (ret>0) {
sid.host_no = *host_no;
sid.channel = *channel_no;
sid.scsi_id = *target_no;
sid.lun = *lun_no;
} else {
if (linux_sg_enumerate_debug)
fprintf(stderr,
"sg_obtain_scsi_adr() failed\n");
return 0;
}
}
/* ts A60927 : trying to do locking with growisofs */
if(burn_sg_open_o_excl>1) {
ret = sg_open_scsi_siblings(
fname, -1, sibling_fds, sibling_fnames,
&sibling_count,
sid.host_no, sid.channel,
sid.scsi_id, sid.lun);
if (ret<=0) {
if (linux_sg_enumerate_debug)
fprintf(stderr, "cannot lock siblings\n");
sg_handle_busy_device(fname, 0);
return 0;
}
/* the final occupation will be done in sg_grab() */
sg_release_siblings(sibling_fds, sibling_fnames,
&sibling_count);
}
#ifdef SCSI_IOCTL_GET_BUS_NUMBER
if(*bus_no == -1)
*bus_no = 1000 * (sid.host_no + 1) + sid.channel;
#else
*bus_no = sid.host_no;
#endif
*host_no= sid.host_no;
*channel_no= sid.channel;
*target_no= sid.scsi_id;
*lun_no= sid.lun;
return 1;
}
#endif /* Libburn_drive_new_deaL */
/** Speciality of Linux: detect non-SCSI ATAPI (EIDE) which will from
then on used used via generic SCSI as is done with (emulated) SCSI drives */
static void ata_enumerate(void)
{
#ifdef Libburn_drive_new_deaL
int ret;
#else
struct hd_driveid tm;
int i, fd;
int fd;
#endif
int i;
char fname[10];
if (linux_ata_enumerate_verbous)
@ -670,6 +870,17 @@ static void ata_enumerate(void)
fprintf(stderr, "not in whitelist\n");
continue;
}
#ifdef Libburn_drive_new_deaL
ret = is_ata_drive(fname);
if (ret < 0)
break;
if (ret == 0)
continue;
#else /* Libburn_drive_new_deaL */
fd = sg_open_drive_fd(fname, 1);
if (fd == -1) {
if (linux_ata_enumerate_verbous)
@ -706,6 +917,10 @@ static void ata_enumerate(void)
errno, strerror(errno));
continue;
}
#endif /* Libburn_drive_new_deaL */
if (linux_ata_enumerate_verbous)
fprintf(stderr, "accepting as drive without SCSI address\n");
enumerate_common(fname, -1, -1, -1, -1, -1);
@ -716,12 +931,18 @@ static void ata_enumerate(void)
/** Detects (probably emulated) SCSI drives */
static void sg_enumerate(void)
{
#ifdef Libburn_drive_new_deaL
#else
struct sg_scsi_id sid;
int i, fd, sibling_fds[BURN_OS_SG_MAX_SIBLINGS], sibling_count= 0, ret;
int fd, sibling_fds[BURN_OS_SG_MAX_SIBLINGS], sibling_count= 0;
char sibling_fnames[BURN_OS_SG_MAX_SIBLINGS][BURN_OS_SG_MAX_NAMELEN];
int sid_ret = 0;
#endif
int i, ret;
int bus_no= -1, host_no= -1, channel_no= -1, target_no= -1, lun_no= -1;
char fname[17];
char sibling_fnames[BURN_OS_SG_MAX_SIBLINGS][BURN_OS_SG_MAX_NAMELEN];
sg_select_device_family();
@ -748,6 +969,23 @@ static void sg_enumerate(void)
continue;
}
#ifdef Libburn_drive_new_deaL
ret = is_scsi_drive(fname, &bus_no, &host_no, &channel_no,
&target_no, &lun_no);
if (ret < 0)
break;
if (ret == 0)
continue;
if (linux_sg_enumerate_debug)
fprintf(stderr, "accepting as SCSI %d,%d,%d,%d bus=%d\n",
host_no, channel_no, target_no, lun_no, bus_no);
enumerate_common(fname, bus_no, host_no, channel_no,
target_no, lun_no);
#else /* Libburn_drive_new_deaL */
/* ts A60927 */
fd = sg_open_drive_fd(fname, 1);
if (fd == -1) {
@ -857,16 +1095,223 @@ static void sg_enumerate(void)
#else
bus_no = sid.host_no;
#endif
if (linux_sg_enumerate_debug)
fprintf(stderr, "accepting as SCSI %d,%d,%d,%d bus=%d\n",
sid.host_no, sid.channel, sid.scsi_id, sid.lun,
bus_no);
enumerate_common(fname, bus_no, sid.host_no, sid.channel,
sid.scsi_id, sid.lun);
#endif /* Libburn_drive_new_deaL */
}
}
#ifdef Libburn_drive_new_deaL
/* ts A80805 : eventually produce the other official name of a device file */
static int fname_other_name(char *fname, char other_name[80], int flag)
{
if(strncmp(fname, "/dev/sr", 7) == 0 &&
(fname[7] >= '0' && fname[7] <= '9') &&
(fname[8] == 0 ||
(fname[8] >= '0' && fname[8] <= '9' && fname[9] == 0))) {
sprintf(other_name, "/dev/scd%s", fname + 7);
return 1;
}
if(strncmp(fname, "/dev/scd", 8) == 0 &&
(fname[8] >= '0' && fname[8] <= '9') &&
(fname[9] == 0 ||
(fname[9] >= '0' && fname[9] <= '9' && fname[10] == 0))) {
sprintf(other_name, "/dev/sr%s", fname + 8);
return 1;
}
return 0;
}
/* ts A80805 */
static int fname_drive_is_listed(char *fname, int flag)
{
char other_fname[80];
if (burn_drive_is_listed(fname, NULL, 0))
return 1;
if (fname_other_name(fname, other_fname, 0) > 0)
if (burn_drive_is_listed(other_fname, NULL, 0))
return 2;
return 0;
}
/* ts A80731 : Directly open the given address.
@param flag bit0= do not complain about missing file
bit1= do not check whether drive is already listed
*/
static int fname_enumerate(char *fname, int flag)
{
int is_ata= 0, is_scsi= 0;
int bus_no= -1, host_no= -1, channel_no= -1, target_no= -1, lun_no= -1;
char msg[BURN_DRIVE_ADR_LEN + 80];
struct stat stbuf;
if (!(flag & 2))
if (fname_drive_is_listed(fname, 0))
return 2;
if (stat(fname, &stbuf) == -1) {
sprintf(msg, "File object '%s' not found", fname);
if (!(flag & 1))
libdax_msgs_submit(libdax_messenger, -1, 0x0002000b,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
return -1;
}
is_ata = is_ata_drive(fname);
if (is_ata < 0)
return -1;
if (!is_ata)
is_scsi = is_scsi_drive(fname, &bus_no, &host_no, &channel_no,
&target_no, &lun_no);
if (is_scsi < 0)
return -1;
if (is_ata == 0 && is_scsi == 0)
return 0;
if (linux_sg_enumerate_debug)
fprintf(stderr,
"(single) accepting as SCSI %d,%d,%d,%d bus=%d\n",
host_no, channel_no, target_no, lun_no, bus_no);
enumerate_common(fname, bus_no, host_no, channel_no,
target_no, lun_no);
return 1;
}
/* ts A80731 : Directly open the given address from a single-item whitlist */
static int single_enumerate(int flag)
{
int ret, wl_count;
char *fname, msg[BURN_DRIVE_ADR_LEN + 80];
wl_count= burn_drive_whitelist_count();
if (wl_count != 1)
return 0;
fname= burn_drive_whitelist_item(0, 0);
if (fname == NULL)
return 0;
ret = fname_enumerate(fname, 2);
if (ret <= 0) {
sprintf(msg, "Cannot access '%s' as SG_IO CDROM drive", fname);
libdax_msgs_submit(libdax_messenger, -1, 0x0002000a,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
msg, 0, 0);
ret = -1;
}
return ret;
}
/* ts A80801 : looking up drives listed in /proc/sys/dev/cdrom/info line like:
drive name: sr1 hdc hda sr0
@parm flag bit0= release list memory and exit
*/
static int proc_sys_dev_cdrom_info(char ***list, int *count, int flag)
{
FILE *fp;
char line[1024], fname[1024 + 5], *cpt, *retpt, *list_data;
int maxl= 0, pass, i;
if (*list != NULL) {
if ((*list)[0] != NULL)
free((*list)[0]);
free(*list);
*list = NULL;
*count = 0;
}
if (flag & 1)
return 1;
*count = 0;
sg_evaluate_kernel();
if (sg_kernel_age < 2) /* addresses are not suitable for kernel 2.4 */
return 1;
fp = fopen("/proc/sys/dev/cdrom/info", "r");
if (fp == NULL)
return 0;
while (1) {
retpt = fgets(line, sizeof(line), fp);
if (retpt == NULL)
break;
if(strncmp(line, "drive name:", 11) == 0)
break;
}
fclose(fp);
if (retpt == NULL)
return 0;
strcpy(fname, "/dev/");
for(pass = 0; pass < 2; pass++) {
*count = 0;
cpt = line + 11;
while (*cpt != 0) {
for(; *cpt == ' ' || *cpt == '\t'; cpt++);
if (*cpt == 0 || *cpt == '\n')
break;
sscanf(cpt, "%s", fname + 5);
if (strlen(fname) > maxl)
maxl = strlen(fname);
if (pass == 1)
strcpy((*list)[*count], fname);
(*count)++;
for(cpt++; *cpt != ' ' && *cpt != '\t'
&& *cpt != 0 && *cpt != '\n'; cpt++);
}
if (pass == 0) {
list_data = calloc(*count + 1, maxl+1);
*list = calloc(*count + 1, sizeof(char *));
if(list_data == NULL || *list == NULL) {
libdax_msgs_submit(libdax_messenger, -1,
0x00000003,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Out of virtual memory", 0, 0);
if (list_data != NULL)
free(list_data);
if (*list != NULL)
free((char *) *list);
return -1;
}
for (i = 0; i <= *count; i++)
(*list)[i] = list_data + i * (maxl + 1);
}
}
return 1;
}
static int add_proc_info_drives(int flag)
{
int ret, list_count, count = 0, i;
char **list= NULL;
ret = proc_sys_dev_cdrom_info(&list, &list_count, 0);
if (ret <= 0)
return ret;
for (i = 0; i < list_count; i++) {
if (burn_drive_is_banned(list[i]))
continue;
ret = fname_enumerate(list[i], 1);
if (ret == 1)
count++;
}
proc_sys_dev_cdrom_info(&list, &list_count, 1); /* free memory */
return 1 + count;
}
#endif /* Libburn_drive_new_deaL */
/* ts A61115 */
/* ----------------------------------------------------------------------- */
/* PORTING: Private functions which contain publicly needed functionality. */
@ -951,10 +1396,14 @@ int sg_give_next_adr(burn_drive_enumerator_t *idx,
{
/* os-linux.h : typedef int burn_drive_enumerator_t; */
static int sg_limit = 32, ata_limit = 26;
int baseno = 0;
int baseno = 0, i;
char other_name[80];
if (initialize == -1)
if (initialize == -1) {
proc_sys_dev_cdrom_info(&(idx->info_list), &(idx->info_count),
1);
return 0;
}
sg_select_device_family();
if (linux_sg_device_family[0] == 0)
@ -962,30 +1411,56 @@ int sg_give_next_adr(burn_drive_enumerator_t *idx,
if (linux_ata_device_family[0] == 0)
ata_limit = 0;
if (initialize == 1)
*idx = -1;
(*idx)++;
if (*idx >= sg_limit)
if (initialize == 1) {
idx->pos = -1;
idx->info_count= 0;
idx->info_list= NULL;
proc_sys_dev_cdrom_info(&(idx->info_list), &(idx->info_count),
0);
}
(idx->pos)++;
if (idx->pos >= sg_limit)
goto next_ata;
if (adr_size < 10)
if (adr_size < 11)
return -1;
sprintf(adr, linux_sg_device_family, *idx);
sprintf(adr, linux_sg_device_family, idx->pos);
/* ts A80702 */
sg_exchange_scd_for_sr(adr, 0);
goto return_1_pre_proc;
return 1;
next_ata:;
baseno += sg_limit;
if (*idx - baseno >= ata_limit)
goto next_nothing;
if (idx->pos - baseno >= ata_limit)
goto next_proc_info;
if (adr_size < 9)
return -1;
sprintf(adr, linux_ata_device_family, 'a' + (*idx - baseno));
return 1;
next_nothing:;
sprintf(adr, linux_ata_device_family, 'a' + (idx->pos - baseno));
goto return_1_pre_proc;
next_proc_info:;
baseno += ata_limit;
for (i = 0; i < idx->info_count; i++) {
if ((idx->info_list)[i][0] == 0)
continue;
if (baseno == idx->pos) {
if (adr_size < strlen((idx->info_list)[i]) + 1)
return -1;
strcpy(adr, (idx->info_list)[i]);
return 1;
}
baseno++;
}
return 0;
return_1_pre_proc:;
for (i = 0; i < idx->info_count; i++) {
if (strcmp((idx->info_list)[i], adr) == 0)
(idx->info_list)[i][0] = 0;
if (fname_other_name(adr, other_name, 0) > 0)
if (strcmp((idx->info_list)[i], other_name) == 0)
(idx->info_list)[i][0] = 0;
}
return 1;
}
@ -1007,8 +1482,27 @@ next_nothing:;
/* ts A61115: replacing call to sg-implementation internals from drive.c */
int scsi_enumerate_drives(void)
{
#ifdef Libburn_drive_new_deaL
int ret;
#endif
#ifdef Libburn_drive_new_deaL
/* Direct examination of eventually single whitelisted name */
ret = single_enumerate(0);
if (ret < 0)
return -1;
if (ret > 0)
return 1;
#endif /* Libburn_drive_new_deaL */
sg_enumerate();
ata_enumerate();
#ifdef Libburn_drive_new_deaL
add_proc_info_drives(0);
#endif /* Libburn_drive_new_deaL */
return 1;
}
@ -1224,8 +1718,9 @@ static int sg_log_err(struct command *c, FILE *fp,
*/
int sg_issue_command(struct burn_drive *d, struct command *c)
{
int done = 0, no_c_page = 0;
int done = 0, no_c_page = 0, usleep_time, i;
int err;
time_t start_time;
sg_io_hdr_t s;
#ifdef Libburn_log_sg_commandS
@ -1309,7 +1804,8 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
}
s.usr_ptr = c;
do {
start_time = time(NULL);
for(i = 0; !done; i++) {
err = ioctl(d->fd, SG_IO, &s);
/* ts A61010 */
@ -1343,10 +1839,22 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
c->error = 1;
break;
}
/* ts A90921 :
Calming down retries and breaking up endless cycle
*/
usleep_time = Libburn_sg_linux_retry_usleeP +
i * Libburn_sg_linux_retry_incR;
if (time(NULL) + usleep_time / 1000000 - start_time >
s.timeout / 1000 + 1) {
c->error = 1;
goto ex;
}
usleep(usleep_time);
} else {
done = 1;
}
} while (!done);
}
/* ts A61106 */
ex:;
@ -1391,6 +1899,8 @@ int sg_obtain_scsi_adr(char *path, int *bus_no, int *host_no, int *channel_no,
};
struct my_scsi_idlun idlun;
/* valgrind called idlun unitialized because it is blind for ioctl */
memset(&idlun, 0, sizeof(struct my_scsi_idlun));
l = strlen(linux_ata_device_family) - 2;
if (l > 0 && strncmp(path, linux_ata_device_family, l) == 0
@ -1460,7 +1970,8 @@ int sg_is_enumerable_adr(char *adr)
return 1;
}
}
sg_give_next_adr(&idx, fname, sizeof(fname), -1);
if (first == 0)
sg_give_next_adr(&idx, fname, sizeof(fname), -1);
return(0);
}

View File

@ -1,7 +1,7 @@
/* sg.c
Switcher for operating system dependent transport level modules of libburn.
Copyright (C) 2006 Thomas Schmitt <scdbackup@gmx.net>, provided under GPL
Copyright (C) 2009 Thomas Schmitt <scdbackup@gmx.net>, provided under GPL
*/
@ -10,8 +10,32 @@
#include "sg-freebsd.c"
#else
#ifdef __linux
#include "sg-linux.c"
#endif
#else
/* The dummy adapter formally fulfills the expectations of libburn towards
its SCSI command transport. It will show no drives and perform no SCSI
commands.
libburn will then be restricted to using its stdio pseudo drives.
*/
static int intentional_compiler_warning(void)
{
int INTENTIONAL_COMPILER_WARNING_;
int Cannot_recognize_Linux_nor_FreeBSD_;
int Have_to_use_dummy_MMC_transport_adapter_;
int This_libburn_will_not_be_able_to_operate_on_real_CD_drives;
int Have_to_use_dummy_MMC_transport_adapter;
int Cannot_recognize_Linux_nor_FreeBSD;
int INTENTIONAL_COMPILER_WARNING;
return(0);
}
#include "sg-dummy.c"
#endif /* ! __linux */
#endif /* ! __FreeBSD__ */

View File

@ -104,7 +104,9 @@ int spc_wait_unit_attention(struct burn_drive *d, int max_sec, char *cmd_text,
int flag)
{
int i, ret = 1, key = 0, asc = 0, ascq = 0;
char msg[160];
char msg[320];
unsigned char sense[14];
enum response resp;
if (!(flag & 1))
usleep(100000);
@ -117,9 +119,9 @@ int spc_wait_unit_attention(struct burn_drive *d, int max_sec, char *cmd_text,
i, ret, (unsigned) key, (unsigned) asc, (unsigned) ascq);
*/
if(ret > 0) /* ready */
if (ret > 0) /* ready */
break;
if(key!=0x2 || asc!=0x4) {
if (key!=0x2 || asc!=0x4) {
if (key == 0x2 && asc == 0x3A) {
ret = 1; /* medium not present = ok */
/* <<<
@ -138,10 +140,24 @@ int spc_wait_unit_attention(struct burn_drive *d, int max_sec, char *cmd_text,
/* media change notice = try again */
goto slumber;
#ifdef NIX
sprintf(msg,
"Asynchromous SCSI error on %s: key=%X asc=%2.2Xh ascq=%2.2Xh",
cmd_text, (unsigned) key, (unsigned) asc,
(unsigned) ascq);
#else
/* ts A90213 */
sprintf(msg,
"Asynchromous SCSI error on %s: ", cmd_text);
sense[2] = key;
sense[12] = asc;
sense[13] = ascq;
resp = scsi_error_msg(d, sense, 14, msg + strlen(msg),
&key, &asc, &ascq);
#endif /* ! NIX */
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002014d,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
@ -275,7 +291,7 @@ void spc_allow(struct burn_drive *d)
}
/*
ts A70518 : Do not call with *alloc_len < 8
ts A70518 - A90603 : Do not call with *alloc_len < 10
*/
/** flag&1= do only inquire alloc_len */
static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
@ -287,13 +303,19 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
unsigned char *page;
struct command c;
struct burn_speed_descriptor *sd;
char msg[BURN_DRIVE_ADR_LEN + 160];
/* ts A61225 : 1 = report about post-MMC-1 speed descriptors */
static int speed_debug = 0;
if (*alloc_len < 8)
if (*alloc_len < 10)
return 0;
/* ts A90602 : Clearing mdata before command execution */
m = d->mdata;
m->valid = 0;
burn_mdata_free_subs(m);
memset(&buf, 0, sizeof(buf));
scsi_init_command(&c, SPC_MODE_SENSE, sizeof(SPC_MODE_SENSE));
/*
@ -312,12 +334,11 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
d->issue_command(d, &c);
if (c.error) {
memset(&buf, 0, sizeof(buf));
d->mdata->valid = -1;
m->valid = -1;
was_error = 1;
}
size = c.page->data[0] * 256 + c.page->data[1];
m = d->mdata;
page = c.page->data + 8;
/* ts A61225 :
@ -326,18 +347,28 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
in MMC-3 6.3.11 there are at least 28 bytes plus a variable length
set of speed descriptors. In MMC-5 E.11 it is declared "legacy".
*/
/* ts A90603 :
SPC-1 8.3.3 enumerates mode page format bytes from 0 to n and
defines Page Length as (n-1).
*/
page_length = page[1];
old_alloc_len = *alloc_len;
*alloc_len = page_length + 8;
*alloc_len = page_length + 10;
if (flag & 1)
return !was_error;
if (page_length + 8 > old_alloc_len)
page_length = old_alloc_len - 8;
if (page_length < 22)
return 0;
if (page_length + 10 > old_alloc_len)
page_length = old_alloc_len - 10;
m->valid = 0;
burn_mdata_free_subs(m);
/* ts A90602 : 20 asserts page[21]. (see SPC-1 8.3.3) */
if (page_length < 20) {
m->valid = -1;
sprintf(msg, "MODE SENSE page 2A too short: %s : %d",
d->devname, page_length);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002016e, LIBDAX_MSGS_SEV_DEBUG,
LIBDAX_MSGS_PRIO_LOW, msg, 0, 0);
return 0;
}
m->buffer_size = page[12] * 256 + page[13];
m->dvdram_read = page[2] & 32;
@ -368,12 +399,13 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
m->min_end_lba = 0x7fffffff;
m->max_end_lba = 0;
m->valid = 1;
if (!was_error)
m->valid = 1;
mmc_get_configuration(d);
/* ts A61225 : end of MMC-1 , begin of MMC-3 */
if (page_length < 32) /* no write speed descriptors ? */
if (page_length < 30) /* no write speed descriptors ? */
goto try_mmc_get_performance;
m->cur_write_speed = page[28] * 256 + page[29];
@ -397,12 +429,12 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
}
for (i = 0; i < num_write_speeds; i++) {
speed = page[32 + 4*i + 2] * 256 + page[32 + 4*i + 3];
speed = page[32 + 4 * i + 2] * 256 + page[32 + 4 * i + 3];
if (speed_debug)
fprintf(stderr,
"LIBBURN_DEBUG: write speed #%d = %d kB/s (rc %d)\n",
i, speed, page[32 + 4*i +1] & 7);
i, speed, page[32 + 4 * i + 1] & 7);
/* ts A61226 */
ret = burn_speed_descriptor_new(&(d->mdata->speed_descriptors),
@ -415,7 +447,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
strcpy(sd->profile_name,
d->current_profile_text);
}
sd->wrc = (( page[32 + 4*i +1] & 7 ) == 1 );
sd->wrc = (( page[32 + 4 * i + 1] & 7 ) == 1 );
sd->write_speed = speed;
}
@ -431,19 +463,31 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
m->min_write_speed, m->max_write_speed);
try_mmc_get_performance:;
ret = mmc_get_write_performance(d);
if (ret > 0 && speed_debug)
fprintf(stderr,
if (m->cdrw_write || page_length >= 32) {
/* ts A90823:
One has to avoid U3 enhanced memory sticks here. On my
SuSE 10.2 a SanDisk Cruzer 4GB stalls at the second occasion
of ACh GET PERFORMANCE. (The first one is obviously called
by the OS at plug time.)
This pseudo drive returns no write capabilities and a page
length of 28. MMC-3 describes page length 32. Regrettably
MMC-2 prescribes a page length of 26. Here i have to trust
m->cdrw_write to reliably indicate any MMC-2 burner.
*/
ret = mmc_get_write_performance(d);
if (ret > 0 && speed_debug)
fprintf(stderr,
"LIBBURN_DEBUG: ACh min_write_speed = %d , max_write_speed = %d\n",
m->min_write_speed, m->max_write_speed);
m->min_write_speed, m->max_write_speed);
}
return !was_error;
}
void spc_sense_caps(struct burn_drive *d)
{
int alloc_len, start_len = 22, ret;
int alloc_len, start_len = 30, ret;
if (mmc_function_spy(d, "sense_caps") <= 0)
return;
@ -568,7 +612,7 @@ void spc_sense_write_params(struct burn_drive *d)
/* ts A71128 : do not interpret reply if error */
m = d->mdata;
if(!c.error) {
if (!c.error) {
size = c.page->data[0] * 256 + c.page->data[1];
page = c.page->data + 8;
burn_print(1, "write page length 0x%x\n", page[1]);
@ -845,7 +889,7 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
d->mdata = calloc(1, sizeof(struct scsi_mode_data));
/* ts A61007 : obsolete Assert in drive_getcaps() */
if(d->idata == NULL || d->mdata == NULL) {
if (d->idata == NULL || d->mdata == NULL) {
libdax_msgs_submit(libdax_messenger, -1, 0x00020108,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Could not allocate new drive object", 0, 0);
@ -854,7 +898,7 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
d->idata->valid = 0;
d->mdata->valid = 0;
d->mdata->speed_descriptors = NULL;
if(!(flag & 1)) {
if (!(flag & 1)) {
ret = spc_setup_drive(d);
if (ret<=0)
return ret;
@ -869,11 +913,14 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
}
/* ts A61122 */
/* ts A61122 - A80829 */
enum response scsi_error_msg(struct burn_drive *d, unsigned char *sense,
int senselen, char msg[161],
int senselen, char msg_data[161],
int *key, int *asc, int *ascq)
{
char *msg;
msg= msg_data;
*key= *asc= *ascq= -1;
if (senselen<=0 || senselen>2)
@ -883,50 +930,270 @@ enum response scsi_error_msg(struct burn_drive *d, unsigned char *sense,
if (senselen<=0 || senselen>13)
*ascq = sense[13];
sprintf(msg, "[%X %2.2X %2.2X] ", *key, *asc, *ascq);
msg= msg + strlen(msg);
burn_print(12, "CONDITION: 0x%x 0x%x 0x%x on %s %s\n",
*key, *asc, *ascq, d->idata->vendor, d->idata->product);
switch (*asc) {
case 0:
sprintf(msg, "(no error reported by SCSI transaction)");
case 0x00:
sprintf(msg, "(No error reported by SCSI transaction)");
return RETRY;
case 2:
sprintf(msg, "not ready");
case 0x02:
sprintf(msg, "Not ready");
return RETRY;
case 4:
case 0x04:
sprintf(msg,
"logical unit is in the process of becoming ready");
"Logical unit is in the process of becoming ready");
return RETRY;
case 0x08:
if (*key != 4)
break;
if (*ascq == 0)
sprintf(msg, "Logical unit communication failure");
else if (*ascq == 1)
sprintf(msg, "Logical unit communication timeout");
else if (*ascq == 2)
sprintf(msg, "Logical unit communication parity error");
else if (*ascq == 3)
sprintf(msg, "Logical unit communication crc error");
return RETRY;
case 0x09:
if (*key != 4)
break;
if (*ascq == 0)
sprintf(msg, "Track following error");
else if (*ascq == 1)
sprintf(msg, "Tracking servo failure");
else if (*ascq == 2)
sprintf(msg, "Focus servo failure");
else if (*ascq == 3)
sprintf(msg, "Spindle servo failure");
else if (*ascq == 4)
sprintf(msg, "Head select fault");
else
break;
return FAIL;
case 0x0C:
if (*key == 2 && *ascq == 7)
sprintf(msg, "Write error, recovery needed");
else if (*key == 2 && *ascq == 0x0f)
sprintf(msg, "Defects in error window");
else if (*key == 3 && *ascq == 2)
sprintf(msg, "Write error, auto reallocation failed");
else if (*key == 3 && *ascq == 9)
sprintf(msg, "Write error, loss of streaming");
else if (*key == 3)
sprintf(msg, "Write error");
else
break;
return FAIL;
case 0x11:
if (*key != 3)
break;
if (*ascq == 0)
sprintf(msg, "Unrecovered read error");
else if (*ascq == 1)
sprintf(msg, "Read retries exhausted");
else if (*ascq == 2)
sprintf(msg, "Error too long to correct");
else if (*ascq == 5)
sprintf(msg, "L-EC uncorrectable error");
else if (*ascq == 6)
sprintf(msg, "CIRC uncorrectable error");
else
break;
return FAIL;
case 0x15:
if (*key != 3 && *key != 4)
break;
sprintf(msg, "Random positioning error");
return FAIL;
case 0x1a:
if (*key != 5)
break;
sprintf(msg, "Parameter list length error");
return FAIL;
case 0x1b:
if (*key != 4)
break;
sprintf(msg, "Synchronous data transfer error");
return FAIL;
case 0x20:
if (*key == 5)
sprintf(msg, "bad opcode");
if (*key != 5)
break;
sprintf(msg, "Invalid command operation code");
return FAIL;
case 0x21:
sprintf(msg, "invalid address");
if (*key != 5)
break;
if (*ascq == 0)
sprintf(msg, "Lba out of range");
else if (*ascq == 3)
sprintf(msg, "Invalid write crossing layer jump");
else
sprintf(msg, "Invalid address");
return FAIL;
case 0x24:
if (*key == 5)
sprintf(msg, "invalid field in cdb");
else
if (*key != 5)
break;
sprintf(msg, "Invalid field in cdb");
return FAIL;
case 0x26:
if (*key == 5 )
sprintf(msg, "invalid field in parameter list" );
if (*key != 5)
break;
if (*ascq == 1)
sprintf(msg, "Parameter not supported");
else if (*ascq == 2)
sprintf(msg, "Parameter value invalid");
else
sprintf(msg, "Invalid field in parameter list");
return FAIL;
case 0x27:
if (*key != 7)
break;
sprintf(msg, "Write protected");
return FAIL;
case 0x28:
if (*key == 6)
if (*key != 6)
break;
if (*ascq == 0)
sprintf(msg, "Medium may have changed");
else if (*ascq == 2)
sprintf(msg, "Format layer may have changed");
else
break;
return RETRY;
case 0x29:
if (*key != 6)
break;
if (*ascq == 0)
sprintf(msg,
"Power on, reset, or bus device reset occured");
else if (*ascq == 1)
sprintf(msg, "Power on occured");
else if (*ascq == 2)
sprintf(msg, "Bus reset occured");
else if (*ascq == 3)
sprintf(msg, "Bus device reset function occured");
else if (*ascq == 4)
sprintf(msg, "Device internal reset");
else
break;
return RETRY;
case 0x2c:
if (*key != 5)
break;
if (*ascq == 0)
sprintf(msg, "Command sequence error");
else
break;
return FAIL;
case 0x2e:
if (*key != 6)
break;
if (*ascq == 0)
sprintf(msg,
"Insufficient time for operation");
else
break;
return FAIL;
case 0x30:
if (*key != 2 && *key != 5)
break;
if (*ascq == 1)
sprintf(msg, "Cannot read medium, unknown format");
else if (*ascq == 2)
sprintf(msg,
"Cannot read medium, incompatible format");
else if (*ascq == 4)
sprintf(msg, "Cannot write medium, unknown format");
else if (*ascq == 5)
sprintf(msg,
"Cannot write medium, incompatible format");
else if (*ascq == 6)
sprintf(msg,
"Cannot format medium, incompatible medium");
else if (*ascq == 7)
sprintf(msg, "Cleaning failure");
else
sprintf(msg, "Incompatible medium installed");
return FAIL;
case 0x31:
if (*key != 3)
break;
if (*ascq == 0)
sprintf(msg, "Medium unformatted or format corrupted");
else if (*ascq == 1)
sprintf(msg, "Format command failed");
return FAIL;
case 0x3A:
sprintf(msg, "Medium not present");
if (*key != 2)
break;
if (*ascq == 1)
sprintf(msg, "Medium not present, tray closed");
else if (*ascq == 2)
sprintf(msg, "Medium not present, tray open");
else if (*ascq == 3)
sprintf(msg, "Medium not present, loadable");
else
sprintf(msg, "Medium not present");
d->status = BURN_DISC_EMPTY;
return FAIL;
case 0x63:
if (*key != 5)
break;
if (*ascq == 0)
sprintf(msg,
"End of user area encountered on this track");
else if (*ascq == 1)
sprintf(msg, "Packet does not fit in available space");
else
break;
return FAIL;
case 0x64:
if (*key != 5)
break;
if (*ascq == 0)
sprintf(msg, "Illegal mode for this track");
else if (*ascq == 1)
sprintf(msg, "Invalid packet size");
else
break;
return FAIL;
case 0x72:
if (*key == 3)
sprintf(msg, "Session fixation error");
else if (*key == 5 && *ascq == 3)
sprintf(msg,
"Session fixation error, incomplete track in session");
else if (*key == 5 && *ascq == 4)
sprintf(msg,
"Empty or partially written reserved track");
else if (*key == 5 && *ascq == 5)
sprintf(msg,
"No more track reservations allowed");
else
break;
return FAIL;
case 0x73:
if (*key == 3 && *ascq == 0)
sprintf(msg, "CD control error");
else if (*key == 3 && *ascq == 2)
sprintf(msg, "Power calibration area is full");
else if (*key == 3 && *ascq == 3)
sprintf(msg, "Power calibration area error");
else if (*key == 3 && *ascq == 4)
sprintf(msg, "Program memory area update failure");
else if (*key == 3 && *ascq == 5)
sprintf(msg, "Program memory area is full");
else
break;
return FAIL;
}
sprintf(msg,
sprintf(msg_data,
"Failure. See mmc3r10g.pdf: Sense Key %X ASC %2.2X ASCQ %2.2X",
*key, *asc, *ascq);
return FAIL;
@ -951,6 +1218,72 @@ enum response scsi_error(struct burn_drive *d, unsigned char *sense,
}
static char *scsi_command_name(unsigned int c, int flag)
{
switch (c) {
case 0x00:
return "TEST UNIT READY";
case 0x03:
return "REQUEST SENSE";
case 0x04:
return "FORMAT UNIT";
case 0x1b:
return "START/STOP UNIT";
case 0x1e:
return "PREVENT/ALLOW MEDIA REMOVAL";
case 0x23:
return "READ FORMAT CAPACITIES";
case 0x25:
return "READ CAPACITY";
case 0x28:
return "READ(10)";
case 0x2a:
return "WRITE(10)";
case 0x35:
return "SYNCHRONIZE CACHE";
case 0x43:
return "READ TOC/PMA/ATIP";
case 0x46:
return "GET CONFIGURATION";
case 0x4a:
return "GET EVENT STATUS NOTIFICATION";
case 0x51:
return "READ DISC INFORMATION";
case 0x52:
return "READ TRACK INFORMATION";
case 0x53:
return "RESERVE TRACK";
case 0x54:
return "SEND OPC INFORMATION";
case 0x55:
return "MODE SELECT";
case 0x5a:
return "SEND OPC INFORMATION";
case 0x5b:
return "CLOSE TRACK/SESSION";
case 0x5c:
return "READ BUFFER CAPACITY";
case 0x5d:
return "SEND CUE SHEET";
case 0xa1:
return "BLANK";
case 0xaa:
return "WRITE(12)";
case 0xac:
return "GET PERFORMANCE";
case 0xad:
return "READ DISC STRUCTURE";
case 0xb6:
return "SET STREAMING";
case 0xbb:
return "SET CD SPEED";
case 0xbe:
return "READ CD";
}
return "(NOT IN COMMAND LIST)";
}
/* ts A61030 - A61115 */
/* @param flag bit0=do report conditions which are considered not an error */
int scsi_notify_error(struct burn_drive *d, struct command *c,
@ -962,12 +1295,9 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
if (d->silent_on_scsi_error)
return 1;
strcpy(scsi_msg, " \"");
scsi_error_msg(d, sense, senselen, scsi_msg + strlen(scsi_msg),
&key, &asc, &ascq);
strcat(scsi_msg, "\"");
scsi_error_msg(d, sense, senselen, scsi_msg, &key, &asc, &ascq);
if(!(flag & 1)) {
if (!(flag & 1)) {
/* SPC : TEST UNIT READY command */
if (c->opcode[0] == 0)
return 1;
@ -978,7 +1308,11 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
return 1;
}
sprintf(msg,"SCSI error condition on command %2.2Xh :", c->opcode[0]);
sprintf(msg, "SCSI error condition on command %2.2Xh %s: ",
c->opcode[0],
scsi_command_name((unsigned int) c->opcode[0], 0));
#ifdef NIX
if (key>=0)
sprintf(msg+strlen(msg), " key=%Xh", key);
if (asc>=0)
@ -992,6 +1326,13 @@ int scsi_notify_error(struct burn_drive *d, struct command *c,
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH,
scsi_msg,0,0);
#else
strcat(msg, scsi_msg);
ret = libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002010f,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, msg,0,0);
#endif /* NIX */
return ret;
}

View File

@ -104,6 +104,30 @@ int burn_disc_add_session(struct burn_disc *d, struct burn_session *s,
return 1;
}
/* ts A81202: this function was in the API but not implemented.
*/
int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s)
{
int i, skip = 0;
if (d->session == NULL)
return 0;
for (i = 0; i < d->sessions; i++) {
if (s == d->session[i]) {
skip++;
continue;
}
d->session[i - skip] = d->session[i];
}
if (!skip)
return 0;
burn_session_free(s);
d->sessions--;
return 1;
}
struct burn_track *burn_track_create(void)
{
struct burn_track *t;
@ -257,13 +281,23 @@ void burn_track_define_data(struct burn_track *t, int offset, int tail,
/* ts A61024 */
int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes)
{
if(swap_source_bytes!=0 && swap_source_bytes!=1)
if (swap_source_bytes != 0 && swap_source_bytes != 1)
return 0;
t->swap_source_bytes = swap_source_bytes;
return 1;
}
/* ts A90911 : API */
int burn_track_set_cdxa_conv(struct burn_track *t, int value)
{
if (value < 0 || value > 1)
return 0;
t->cdxa_conversion = value;
return 1;
}
void burn_track_set_isrc(struct burn_track *t, char *country, char *owner,
unsigned char year, unsigned int serial)
{
@ -330,11 +364,24 @@ void burn_track_clear_isrc(struct burn_track *t)
int burn_track_get_sectors(struct burn_track *t)
{
/* ts A70125 : was int */
off_t size;
off_t size = 0;
int sectors, seclen;
seclen = burn_sector_length(t->mode);
size = t->offset + t->source->get_size(t->source) + t->tail;
if (t->cdxa_conversion == 1)
/* ts A90911 : will read blocks of 2056 bytes and write 2048 */
seclen += 8;
if (t->source != NULL) /* ts A80808 : mending sigsegv */
size = t->offset + t->source->get_size(t->source) + t->tail;
else if(t->entry != NULL) {
/* ts A80808 : all burn_toc_entry of track starts should now
have (extensions_valid & 1), even those from CD.
*/
if (t->entry->extensions_valid & 1)
size = ((off_t) t->entry->track_blocks) * (off_t) 2048;
}
sectors = size / seclen;
if (size % seclen)
sectors++;
@ -468,6 +515,7 @@ int burn_session_get_sectors(struct burn_session *s)
return sectors;
}
int burn_disc_get_sectors(struct burn_disc *d)
{
int sectors = 0, i;
@ -515,3 +563,84 @@ int burn_session_get_hidefirst(struct burn_session *session)
{
return session->hidefirst;
}
/* ts A80808 : Enhance CD toc to DVD toc */
int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag)
{
int sidx= 0, tidx= 0;
struct burn_toc_entry *entry, *prev_entry= NULL;
/* ts A81126 : ticket 146 : There was a SIGSEGV in here */
char msg_data[321], *msg;
strcpy(msg_data,
"Damaged CD table-of-content detected and truncated.");
strcat(msg_data, " In burn_disc_cd_toc_extensions: ");
msg = msg_data + strlen(msg_data);
if (d->session == NULL) {
strcpy(msg, "d->session == NULL");
goto failure;
}
for (sidx = 0; sidx < d->sessions; sidx++) {
if (d->session[sidx] == NULL) {
sprintf(msg, "d->session[%d of %d] == NULL",
sidx, d->sessions);
goto failure;
}
if (d->session[sidx]->track == NULL) {
sprintf(msg, "d->session[%d of %d]->track == NULL",
sidx, d->sessions);
goto failure;
}
if (d->session[sidx]->leadout_entry == NULL) {
sprintf(msg,
" Session %d of %d: Leadout entry missing.",
sidx, d->sessions);
goto failure;
}
for (tidx = 0; tidx < d->session[sidx]->tracks + 1; tidx++) {
if (tidx < d->session[sidx]->tracks) {
if (d->session[sidx]->track[tidx] == NULL) {
sprintf(msg,
"d->session[%d of %d]->track[%d of %d] == NULL",
sidx, d->sessions, tidx, d->session[sidx]->tracks);
goto failure;
}
entry = d->session[sidx]->track[tidx]->entry;
if (entry == NULL) {
sprintf(msg,
"session %d of %d, track %d of %d, entry == NULL",
sidx, d->sessions, tidx,
d->session[sidx]->tracks);
goto failure;
}
} else
entry = d->session[sidx]->leadout_entry;
entry->session_msb = 0;
entry->point_msb = 0;
entry->start_lba = burn_msf_to_lba(entry->pmin,
entry->psec, entry->pframe);
if (tidx > 0) {
prev_entry->track_blocks =
entry->start_lba
- prev_entry->start_lba;
prev_entry->extensions_valid |= 1;
}
if (tidx == d->session[sidx]->tracks) {
entry->session_msb = 0;
entry->point_msb = 0;
entry->track_blocks = 0;
entry->extensions_valid |= 1;
}
prev_entry = entry;
}
}
return 1;
failure:
libdax_msgs_submit(libdax_messenger, -1, 0x0002015f,
LIBDAX_MSGS_SEV_MISHAP, LIBDAX_MSGS_PRIO_HIGH, msg_data, 0, 0);
d->sessions= sidx;
return 0;
}

View File

@ -64,6 +64,10 @@ struct burn_track
/* ts A61024 */
/** Byte swapping on source data stream : 0=none , 1=pairwise */
int swap_source_bytes;
/* ts A90910 : conversions from CD XA prepared input */
int cdxa_conversion; /* 0=none, 1=remove -xa1 headers (first 8 bytes)*/
};
struct burn_session
@ -109,4 +113,8 @@ int burn_track_apply_fillup(struct burn_track *t, off_t max_size, int flag);
off_t burn_track_get_default_size(struct burn_track *t);
/* ts A80808 : Enhance CD toc to DVD toc */
int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag);
#endif /* BURN__STRUCTURE_H */

View File

@ -40,7 +40,9 @@ struct buffer
Added 4096 bytes reserve against possible buffer overflows.
(Changed in sector.c buffer flush test from >= to > BUFFER_SIZE .
This can at most cause a 1 sector overlap. Sometimes an offset
of 16 byte is applied to the output data (in some RAW mode). ) */
of 16 byte is applied to the output data (in some RAW mode). )
burn_write_opts.cdxa_conversion can imply an offset of 8 bytes.
*/
unsigned char data[BUFFER_SIZE + 4096];
int sectors;
int bytes;
@ -161,6 +163,11 @@ struct burn_drive
char current_profile_text[80];
int current_is_cd_profile;
int current_is_supported_profile;
/* ts A90603 */
int current_is_guessed_profile;
/* ts A90815 */
unsigned char all_profiles[256];
int num_profiles;
/* ts A70128 : MMC-to-MMC feature info from 46h for DVD-RW.
Quite internal. Regard as opaque :)
@ -171,6 +178,19 @@ struct burn_drive
/* Link Size item number 0 from feature 0021h descriptor */
int current_feat21h_link_size;
/* Flags from feature 0023h for formatting BD mmc5r03c.pdf 5.3.13
Byte 4 BD-RE:
bit0= Cert format 30h sub-type 10b
bit1= QCert format 30h sub-type 11b
bit2= Expand format 01h
bit3= RENoSA format 31h
Byte 8 BD-R:
bit0= RRM format 32h sub-type 10b
*/
int current_feat23h_byte4;
int current_feat23h_byte8;
/* Flags from feature 002Fh feature descriptor mmc5r03c.pdf 5.3.25 :
bit1= DVD-RW supported
bit2= Test Write available
@ -192,8 +212,24 @@ struct burn_drive
with BD-RE */
int do_stream_recording;
/* ts A90227 : the LBA where stream recording shall start.
Writing to lower LBA will be done without streaming.
*/
int stream_recording_start;
/* ts A61218 from 51h READ DISC INFORMATION */
int last_lead_in;
int last_lead_out;
int bg_format_status; /* 0=needs format start, 1=needs format restart*/
int disc_type; /* 0="CD-DA or CD-ROM", 0x10="CD-I", 0x20="CD-ROM XA" */
unsigned int disc_id; /* a "32 bit binary integer" */
char disc_bar_code[9];
int disc_app_code;
int disc_info_valid; /* bit0= disc_type , bit1= disc_id ,
bit2= disc_bar_code , bit3= disc_app_code
bit4= URU bit is set (= unrestricted use)
bit5= Erasable bit was set in reply
*/
/* ts A70108 from 23h READ FORMAT CAPACITY mmc5r03c.pdf 6.24 */
int format_descr_type; /* 1=unformatted, 2=formatted, 3=unclear */
@ -223,6 +259,9 @@ struct burn_drive
/* ts A70131 : from 51h READ DISC INFORMATION Number of Sessions (-1)*/
int complete_sessions;
/* ts A90107 */
int state_of_last_session;
/* ts A70129 :
from 51h READ DISC INFORMATION Last Track Number in Last Session */
int last_track_no;
@ -235,6 +274,9 @@ struct burn_drive
/* ts A70215 : if > 0 : first lba on media that is too high for write*/
int media_lba_limit;
/* ts A81210 : Upper limit of readable data size,
0x7fffffff = unknown */
int media_read_capacity;
int toc_temp;
struct burn_disc *disc; /* disc structure */
@ -288,6 +330,11 @@ struct burn_drive
void (*eject) (struct burn_drive *);
void (*load) (struct burn_drive *);
int (*start_unit) (struct burn_drive *);
/* ts A90824 : Calming down noisy drives */
int (*stop_unit) (struct burn_drive *);
int is_stopped;
void (*read_disc_info) (struct burn_drive *);
void (*read_sectors) (struct burn_drive *,
int start,

View File

@ -4,7 +4,12 @@
/* #include <a ssert.h> */
#include <stdlib.h>
#include "../version.h"
#include <stdio.h>
/* ts A80914 : This is unneeded. Version info comes from libburn.h.
#include "v ersion.h"
*/
#include "util.h"
#include "libburn.h"
@ -48,13 +53,268 @@ char *burn_strndup(char *s, int n)
void burn_version(int *major, int *minor, int *micro)
{
/* ts A80408 : switched from configure.ac versioning to libburn.h versioning */
#ifdef burn_header_version_major
*major = burn_header_version_major;
*minor = burn_header_version_minor;
*micro = burn_header_version_micro;
#else
*major = BURN_MAJOR_VERSION;
*minor = BURN_MINOR_VERSION;
*micro = BURN_MICRO_VERSION;
#endif
*major = burn_header_version_major;
*minor = burn_header_version_minor;
*micro = burn_header_version_micro;
}
struct cd_mid_record {
char *manufacturer;
int m_li;
int s_li;
int f_li;
int m_lo;
int s_lo;
int f_lo;
char *other_brands;
};
typedef struct cd_mid_record cd_mid_record_t;
/* ts A90902 */
/** API
@param flag Bitfield for control purposes,
bit0= append "(aka %s)",other_brands to reply
*/
char *burn_guess_cd_manufacturer(int m_li, int s_li, int f_li,
int m_lo, int s_lo, int f_lo, int flag)
{
static cd_mid_record_t mid_list[]= {
{"SKC", 96, 40, 0, 0, 0, 0, ""},
{"Ritek Corp" , 96, 43, 30, 0, 0, 0, ""},
{"TDK / Ritek" , 97, 10, 0, 0, 0, 0, "TRAXDATA"},
{"TDK Corporation" , 97, 15, 0, 0, 0, 0, ""},
{"Ritek Corp" , 97, 15, 10, 0, 0, 0, "7-plus, Aopen, PONY, Power Source, TDK, TRAXDATA, HiCO, PHILIPS, Primdisc, Victor.JVC, OPTI STORAGE, Samsung"},
{"Mitsubishi Chemical Corporation" , 97, 15, 20, 0, 0, 0, ""},
{"Nan-Ya Plastics Corporation" , 97, 15, 30, 0, 0, 0, "Hatron, MMore, Acer, LITEON"},
{"Delphi" , 97, 15, 50, 0, 0, 0, ""},
{"Shenzhen SG&SAST" , 97, 16, 20, 0, 0, 0, ""},
{"Moser Baer India Limited" , 97, 17, 0, 0, 0, 0, "EMTEC, Intenso, YAKUMO, PLATINUM, Silver Circle"},
{"SKY media Manufacturing SA" , 97, 17, 10, 0, 0, 0, ""},
{"Wing" , 97, 18, 10, 0, 0, 0, ""},
{"DDT" , 97, 18, 20, 0, 0, 0, ""},
{"Daxon Technology Inc. / Acer" , 97, 22, 60, 0, 0, 0, "Maxmax, Diamond Data, BenQ, gold, SONY"},
{"Taiyo Yuden Company Limited" , 97, 24, 0, 0, 0, 0, "Maxell, FUJIFILM, SONY"},
{"Sony Corporation" , 97, 24, 10, 0, 0, 0, "LeadData, Imation"},
{"Computer Support Italcard s.r.l" , 97, 24, 20, 0, 0, 0, ""},
{"Unitech Japan Inc." , 97, 24, 30, 0, 0, 0, ""},
{"MPO, France" , 97, 25, 0, 0, 0, 0, "TDK"},
{"Hitachi Maxell Ltd." , 97, 25, 20, 0, 0, 0, ""},
{"Infodisc Technology Co,Ltd." , 97, 25, 30, 0, 0, 0, "MEMOREX, SPEEDA, Lead data"},
{"Xcitec" , 97, 25, 60, 0, 0, 0, ""},
{"Fornet International Pte Ltd" , 97, 26, 0, 0, 0, 0, "COMPUSA, Cdhouse"},
{"Postech Corporation" , 97, 26, 10, 0, 0, 0, "Mr.Platinum"},
{"SKC Co Ltd." , 97, 26, 20, 0, 0, 0, "Infinite"},
{"Fuji Photo Film Co,Ltd." , 97, 26, 40, 0, 0, 0, ""},
{"Lead Data Inc." , 97, 26, 50, 0, 0, 0, "SONY, Gigastorage, MIRAGE"},
{"CMC Magnetics Corporation" , 97, 26, 60, 0, 0, 0, "Daxon, Verbatim, Memorex, Bi-Winner, PLEXTOR, YAMAHA, Melody, Office DEPOT, Philips, eMARK, imation, HyperMedia, Samsung, Shintaro, Techworks"},
{"Ricoh Company Limited" , 97, 27, 0, 0, 0, 0, "Sony, Digital Storage, Csita"},
{"Plasmon Data Systems Ltd" , 97, 27, 10, 0, 0, 0, "Ritek, TDK, EMTEC, ALPHAPET, MANIA"},
{"Princo Corporation" , 97, 27, 20, 0, 0, 0, ""},
{"Pioneer" , 97, 27, 30, 0, 0, 0, ""},
{"Eastman Kodak Company" , 97, 27, 40, 0, 0, 0, ""},
{"Mitsui Chemicals Inc." , 97, 27, 50, 0, 0, 0, "MAM-A, TDK"},
{"Ricoh Company Limited" , 97, 27, 60, 0, 0, 0, "Ritek"},
{"Gigastorage Corporation" , 97, 28, 10, 0, 0, 0, "MaxMax, Nan-Ya"},
{"Multi Media Masters&Machinary SA" , 97, 28, 20, 0, 0, 0, "King, Mmirex"},
{"Ritek Corp" , 97, 31, 0, 0, 0, 0, "TDK"},
{"Grand Advance Technology Sdn. Bhd." , 97, 31, 30, 0, 0, 0, ""},
{"TDK Corporation" , 97, 32, 00, 0, 0, 0, ""},
{"Prodisc Technology Inc." , 97, 32, 10, 0, 0, 0, "Smartbuy, Mitsubishi, Digmaster, LG, Media Market"},
{"Mitsubishi Chemical Corporation" , 97, 34, 20, 0, 0, 0, "YAMAHA, Verbatim"},
{"Mitsui Chemicals Inc." , 97, 48, 50, 0, 0, 0, ""},
{"TDK Corporation" , 97, 49, 0, 0, 0, 0, ""},
{"", 0, 0, 0, 0, 0, 0, ""}
};
int i, f_li_0;
char buf[1024];
char *result = NULL;
f_li_0 = f_li - (f_li % 10);
for (i = 0; mid_list[i].manufacturer[0]; i++) {
if (m_li == mid_list[i].m_li &&
s_li == mid_list[i].s_li &&
(f_li_0 == mid_list[i].f_li || f_li == mid_list[i].f_li))
break;
}
if (mid_list[i].manufacturer[0] == 0) {
sprintf(buf, "Unknown CD manufacturer. Please report code '%2.2dm%2.2ds%2.2df/%2.2dm%2.2ds%2.2df', the human readable brand, size, and speed to scdbackup@gmx.net.", m_li, s_li, f_li, m_lo, s_lo, f_lo);
result = strdup(buf);
return result;
}
/* Compose, allocate and copy result */
if ((flag & 1) && mid_list[i].other_brands[0]) {
sprintf(buf, "%s (aka %s)",
mid_list[i].manufacturer, mid_list[i].other_brands);
result = strdup(buf);
} else
result = strdup(mid_list[i].manufacturer);
return result;
}
/* ts A90904 */
struct dvd_mid_record {
char *mc1;
char *mc2;
int mc1_sig_len;
char *manufacturer;
};
typedef struct dvd_mid_record dvd_mid_record_t;
/* ts A90904 */
char *burn_guess_manufacturer(int prf,
char *media_code1, char *media_code2, int flag)
{
int i, l = 0, m_li, s_li, f_li, m_lo, s_lo, f_lo;
char buf[1024];
char *result = NULL, *cpt;
/* Important Note: media_code1 and media_code2 are supposed to be
encoded by burn_util_make_printable_word().
Especially: ' ' -> '_' , {"_%/" unprintables -> %XY)
*/
static dvd_mid_record_t mid_list[]= {
{"AML", "", 8, "UML"},
{"BeAll", "", 5, "BeAll Developers, Inc."},
{"CMC", "", 3, "CMC Magnetics Corporation"},
{"DAXON", "", 5, "Daxon Technology Inc. / Acer"},
{"Daxon", "", 5, "Daxon Technology Inc. / Acer"},
{"FUJI", "", 4, "Fujifilm Holdings Corporation"},
{"INFODISC", "", 8, "New Star Digital Co., Ltd."},
{"INFOME", "", 6, "InfoMedia Inc."},
{"ISMMBD", "", 6, "Info Source Multi Media Ltd."},
{"JVC", "", 3, "JVC Limited"},
{"KIC01RG", "", 7, "AMC"},
{"LD", "", 8, "Lead Data Inc."},
{"LGE", "", 3, "LG Electronics"},
{"MAM", "", 8, "Mitsui Advanced Media, Inc. Europe"},
{"MAXELL", "", 6, "Hitachi Maxell Ltd."},
{"MBI", "", 3, "Moser Baer India Limited"},
{"MCC", "", 8, "Mitsubishi Chemical Corporation"},
{"MCI", "", 8, "Mitsui Chemicals Inc."},
{"MEI", "", 3, "Panasonic Corporation"},
{"MKM", "", 3, "Mitsubishi Kagaku Media Co."},
{"MMC", "", 8, "Mitsubishi Kagaku Media Co."},
{"MXL", "", 8, "Hitachi Maxell Ltd."},
{"NANYA", "", 5, "Nan-Ya Plastics Corporation"},
{"NSD", "", 8, "NESA International Inc."},
{"OPTODISC", "", 8, "Optodisc Technology Corporation"},
{"OTCBDR", "", 8, "Optodisc Technology Corporation"},
{"PHILIP", "", 8, "Moser Baer India Limited"},
{"PHILIPS", "", 8, "Philips"},
{"PRINCO", "", 6, "Princo Corporation"},
{"PRODISC", "", 7, "Prodisc Technology Inc."},
{"Prodisc", "", 7, "Prodisc Technology Inc."},
{"PVC", "", 3, "Pioneer"},
{"RICOHJPN", "", 8, "Ricoh Company Limited"},
{"RITEK", "", 5, "Ritek Corp"},
{"SONY", "", 4, "Sony Corporation"},
{"TDK", "", 3, "TDK Corporation"},
{"TT", "", 8, "TDK Corporation"},
{"TY", "", 8, "Taiyo Yuden Company Limited"},
{"TYG", "", 3, "Taiyo Yuden Company Limited"},
{"UTJR001", "", 7, "Unifino Inc."},
{"VERBAT", "", 5, "Mitsubishi Kagaku Media Co."},
{"YUDEN", "", 5, "Taiyo Yuden Company Limited"},
{"", "", 0, ""}
};
if (media_code2 != NULL &&
(prf == -1 || prf == 0x09 || prf == 0x0A)) {
if (strlen(media_code2) == 9 && media_code1[0] == '9' &&
media_code1[2] == 'm' && media_code1[5] == 's' &&
media_code1[8] == 'f' &&
strchr(media_code1, '%') == NULL) {
sscanf(media_code1, "%dm%ds%df", &m_li, &s_li, &f_li);
sscanf(media_code2, "%dm%ds%df", &m_lo, &s_lo, &f_lo);
if (m_li >= 96 && m_li <= 97 && m_lo > 0) {
result = burn_guess_cd_manufacturer(
m_li, s_li, f_li, m_lo, s_lo, f_lo, 0);
return result;
}
}
}
/* DVD-R do not keep manufacturer id apart from media id.
Some manufacturers use a blank as separator which would now be '_'.
*/
cpt = strchr(media_code1, '_');
if (cpt != NULL && (prf == -1 || prf == 0x11 || prf == 0x13 ||
prf == 0x14 || prf == 0x15))
l = cpt - media_code1;
for (i = 0; mid_list[i].mc1[0]; i++) {
if (strncmp(mid_list[i].mc1, media_code1,
mid_list[i].mc1_sig_len) == 0)
break;
if (l > 0)
if (strncmp(mid_list[i].mc1, media_code1, l) == 0)
break;
}
if (mid_list[i].mc1[0] == 0) {
sprintf(buf, "Unknown DVD/BD manufacturer. Please report code '%s/%s', the human readable brand, size, and speed to scdbackup@gmx.net.",
media_code1, media_code2);
result = strdup(buf);
return result;
}
result = strdup(mid_list[i].manufacturer);
return result;
}
/* ts A90905 */
/* Make *text a single printable word */
/* IMPORTANT: text must be freeable memory !
@param flag bit0=escape '/' too
bit1=(overrides bit0) do not escape " _/"
*/
int burn_util_make_printable_word(char **text, int flag)
{
int i, esc_add = 0, ret;
char *wpt, *rpt, *new_text = NULL;
if (flag & 2)
flag &= ~1;
for (i = 0; (*text)[i]; i++) {
rpt = (*text) + i;
if (*rpt < 32 || *rpt > 126 || *rpt == 96 ||
((*rpt == '_' || *rpt == '%') && (!(flag & 2))) ||
(*rpt == '/' && (flag & 1)))
esc_add += 2;
}
if (esc_add) {
new_text = calloc(strlen(*text) + esc_add + 1, 1);
if (new_text == NULL) {
ret = -1;
goto ex;
}
wpt = new_text;
for (i = 0; (*text)[i]; i++) {
rpt = (*text) + i;
if (*rpt < 32 || *rpt > 126 || *rpt == 96 ||
((*rpt == '_' || *rpt == '%') && (!(flag & 2))) ||
(*rpt == '/' && (flag & 1))) {
sprintf(wpt, "%%%2.2X",
(unsigned int) *((unsigned char *) rpt));
wpt+= 3;
} else
*(wpt++) = *rpt;
}
*wpt = 0;
free(*text);
*text = new_text;
}
if (!(flag & 2))
for (i = 0; (*text)[i]; i++)
if ((*text)[i] == ' ')
(*text)[i] = '_';
ret = 1;
ex:
return ret;
}

View File

@ -5,4 +5,7 @@ char *burn_strdup(char *s);
char *burn_strndup(char *s, int n);
/* ts A90905 */
int burn_util_make_printable_word(char **text, int flag);
#endif

View File

@ -36,7 +36,6 @@
#include "crc.h"
#include "debug.h"
#include "init.h"
#include "lec.h"
#include "toc.h"
#include "util.h"
#include "sg.h"
@ -770,8 +769,18 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
libdax_msgs_submit(libdax_messenger, d->global_index, 0x000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
msg, 0, 0);
if (nwa > d->nwa)
d->nwa = nwa;
/* ts A91003 */
if (nwa < d->nwa) {
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020173,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
"Drive tells NWA smaller than last written address",
0, 0);
d->sync_cache(d);
return 0;
}
d->nwa = nwa;
}
@ -868,8 +877,14 @@ ex:;
d->sync_cache(d);
/* ts A61030 */
if (burn_write_close_track(o, s, tnum) <= 0)
ret = 0;
/* ts A91003 :
At least in simulation mode this causes NWA=0 for the
next track. cdrecord does not use CLOSE TRACK at all but
ends the tracks by SYNCHRONIZE CACHE alone.
*/
if (!o->simulate)
if (burn_write_close_track(o, s, tnum) <= 0)
ret = 0;
}
return ret;
}
@ -884,8 +899,8 @@ int burn_disc_write_is_ok(struct burn_write_opts *o, struct burn_disc *disc,
for (i = 0; i < disc->sessions; i++)
for (t = 0; t < disc->session[i]->tracks; t++)
if (!sector_headers_is_ok(
o, disc->session[i]->track[t]->mode))
if (sector_headers_is_ok(
o, disc->session[i]->track[t]->mode) != 1)
goto bad_track_mode_found;
return 1;
bad_track_mode_found:;
@ -1005,8 +1020,10 @@ int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
} else if (d->drive_role == 3 ||
d->current_profile == 0x11 || d->current_profile == 0x14 ||
d->current_profile == 0x15 ||
d->current_profile == 0x1b || d->current_profile == 0x2b ) {
/* DVD-R* Sequential , DVD+R[/DL] , sequential stdio "drive" */
d->current_profile == 0x1b || d->current_profile == 0x2b ||
d->current_profile == 0x41) {
/* DVD-R* Sequential , DVD+R[/DL] , BD-R,
sequential stdio "drive" */
if (o->start_byte >= 0)
strcat(reasons, "write start address not supported, ");
} else {
@ -1106,6 +1123,10 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o,
if (o->write_type == BURN_WRITE_SAO &&
! burn_track_is_open_ended(s->track[tnum])) {
/* Round track size up to 32 KiB and reserve track */
/* ts A81208 */
/* >>> ??? round to 64 KiB for BD-R ? (It is not mandatory) */
size = ((off_t) burn_track_get_sectors(s->track[tnum]))
* (off_t) 2048;
size = (size + (off_t) 0x7fff) & ~((off_t) 0x7fff);
@ -1153,19 +1174,29 @@ int burn_disc_close_track_dvd_minus_r(struct burn_write_opts *o,
int burn_disc_finalize_dvd_plus_r(struct burn_write_opts *o)
{
struct burn_drive *d = o->drive;
char msg[80];
sprintf(msg, "Finalizing %s ...",
d->current_profile_text);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
"Finalizing DVD+R ...", 0, 0);
msg, 0, 0);
/* CLOSE SESSION, 101b, Finalize with minimal radius */
d->close_track_session(d, 2, 1); /* (2<<1)|1 = 5 */
if(d->current_profile == 0x41) { /* BD-R */
/* CLOSE SESSION, 110b, Finalize Disc */
d->close_track_session(d, 3, 0); /* (3<<1)|0 = 6 */
} else {
/* CLOSE SESSION, 101b, Finalize with minimal radius */
d->close_track_session(d, 2, 1); /* (2<<1)|1 = 5 */
}
sprintf(msg, "... finalizing %s done ",
d->current_profile_text);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
"... finalizing DVD+R done ", 0, 0);
msg, 0, 0);
return 1;
}
@ -1200,7 +1231,7 @@ int burn_disc_close_track_dvd_plus_r(struct burn_write_opts *o,
}
/* ts A61218 - A70129 */
/* ts A61218 - A81208 */
int burn_dvd_write_track(struct burn_write_opts *o,
struct burn_session *s, int tnum, int is_last_track)
{
@ -1224,6 +1255,11 @@ int burn_dvd_write_track(struct burn_write_opts *o,
ret = burn_disc_open_track_dvd_plus_r(o, s, tnum);
if (ret <= 0)
goto ex;
} else if (d->current_profile == 0x41) {
/* BD-R SRM */
ret = burn_disc_open_track_dvd_plus_r(o, s, tnum);
if (ret <= 0)
goto ex;
}
sectors = burn_track_get_sectors(t);
@ -1292,6 +1328,12 @@ int burn_dvd_write_track(struct burn_write_opts *o,
is_last_track);
if (ret <= 0)
goto ex;
} else if (d->current_profile == 0x41) {
/* BD-R SRM */
ret = burn_disc_close_track_dvd_plus_r(o, s, tnum,
is_last_track);
if (ret <= 0)
goto ex;
}
ret = 1;
ex:;
@ -1372,10 +1414,70 @@ int burn_disc_close_session_dvd_minus_r(struct burn_write_opts *o,
int burn_dvd_write_session(struct burn_write_opts *o,
struct burn_session *s, int is_last_session)
{
int i,ret;
int i, ret, multi_mem;
struct burn_drive *d = o->drive;
/* >>> open_session ? */
/* ts A90108 */
if (d->current_profile == 0x41 && d->status == BURN_DISC_APPENDABLE &&
d->state_of_last_session == 1) {
/* last session on BD-R is still open */;
/* BR-R were not closed by libburn-0.6.0.pl00 if o->multi==0.
This leads to an unreadable, but recoverable) media state.
Technically they are appendable although the last session
is not readable.
By default the open session gets closed here before the new
session is written. E.g. after writing a small dummy seesion
number 2 one can read session 1 and write session 3 which
points to data of session 1.
For the case that no media with 3 sessions is desired it is
possible to activate the following coarse single-session
closing code:
No new session will be written but calling programs will
report success. Quite misleading.
Activate only if really needed by
# define Libburn_bug_A90108_close_disC yes
*/
#ifdef Libburn_bug_A90108_close_disC
/* Close open session and media.
That was the goal of the failed run which led to the
unreadable (but recoverable) media state.
It is not easy to implement a general close function for
all media types. Therefore this pseudo write code is under
control of #ifdef.
*/
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020171,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
"Closing BD-R with accidently open session",
0, 0);
d->close_track_session(d, 3, 0); /* CLOSE SESSION, 110b */
d->state_of_last_session = 3; /* mark as complete session */
d->status = BURN_DISC_FULL;
sleep(3); /* The caller might need time to arrange itself */
return 1;
#else /* Libburn_bug_A90108_close_disC */
/* This is the default mode.
*/
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020170,
LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH,
"Closing open session before writing new one",
0, 0);
d->close_track_session(d, 1, 0); /* CLOSE SESSION, 010b */
d->state_of_last_session = 3; /* mark as complete session */
#endif /* ! Libburn_bug_A90108_close_disC */
}
for (i = 0; i < s->tracks; i++) {
ret = burn_dvd_write_track(o, s, i,
@ -1386,7 +1488,11 @@ int burn_dvd_write_session(struct burn_write_opts *o,
if (d->current_profile == 0x11 || d->current_profile == 0x14 ||
d->current_profile == 0x15) {
/* DVD-R , DVD-RW Sequential, DVD-R/DL Sequential */
multi_mem = o->multi;
if (!is_last_session)
o->multi = 1;
ret = burn_disc_close_session_dvd_minus_r(o, s);
o->multi = multi_mem;
if (ret <= 0)
return 0;
} else if (d->current_profile == 0x12 || d->current_profile == 0x43) {
@ -1408,6 +1514,8 @@ int burn_dvd_write_session(struct burn_write_opts *o,
}
} else if (d->current_profile == 0x1b || d->current_profile == 0x2b) {
/* DVD+R , DVD+R/DL do each track as an own session */;
} else if (d->current_profile == 0x41) {
/* BD-R SRM do each track as an own session */;
}
return 1;
}
@ -1611,8 +1719,12 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
/* ??? padding needed ??? cowardly doing it for now */
o->obs_pad = 1; /* fill-up track's last 32k buffer */
} else if (d->current_profile == 0x1b || d->current_profile == 0x2b) {
/* DVD+R , DVD+R/DL */
} else if (d->current_profile == 0x1b || d->current_profile == 0x2b ||
d->current_profile == 0x41) {
/* DVD+R , DVD+R/DL , BD-R SRM */
/* >>> ts A81208 : with BD-R set o->obs to 64 kB ? */
t = disc->session[0]->track[0];
o_end = ( burn_track_is_open_ended(t) && !o->fill_up_media );
default_size = burn_track_get_default_size(t);
@ -1627,8 +1739,8 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
}
ret = burn_disc_setup_dvd_plus_r(o, disc);
if (ret <= 0) {
sprintf(msg,
"Write preparation setup failed for DVD+R");
sprintf(msg, "Write preparation setup failed for %s",
d->current_profile == 0x41 ? "BD-R" : "DVD+R");
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020121,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
@ -1639,6 +1751,14 @@ int burn_dvd_write_sync(struct burn_write_opts *o,
o->obs_pad = 1; /* fill-up track's last 32k buffer */
}
/* <<< test only : Does this increase effective speed with USB ?
ts A90801 : 64kB: speed with 16x DVD-R is 12 rather than 8
>>> next try is 128 kB
o->obs = 128 * 1024;
*/
sprintf(msg, "dvd/bd Profile= %2.2Xh , obs= %d , obs_pad= %d",
d->current_profile, o->obs, o->obs_pad);
libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002,
@ -1748,6 +1868,13 @@ int burn_stdio_read_source(struct burn_source *source, char *buf, int bufsize,
int burn_stdio_write(int fd, char *buf, int count, struct burn_drive *d,
int flag)
{
if (d->cancel)
return 0;
/*
fprintf(stderr, "libburn_DEBUG: write(%d, %lX, %d)\n",
fd, (unsigned long) buf, count);
*/
if (write(fd, buf, count) != count) {
libdax_msgs_submit(libdax_messenger, d->global_index,
0x00020148,
@ -1996,9 +2123,9 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc)
{
struct cue_sheet *sheet;
struct burn_drive *d = o->drive;
struct buffer buf;
struct buffer *buffer_mem = o->drive->buffer;
struct burn_track *lt, *t;
int first = 1, i, ret, lba, nwa = 0;
int first = 1, i, ret, lba, nwa = 0, multi_mem;
off_t default_size;
char msg[80];
@ -2009,11 +2136,40 @@ void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *disc)
/* ts A61224 */
burn_disc_init_write_status(o, disc); /* must be done very early */
/* ts A80412 */
d->do_stream_recording = o->do_stream_recording;
/* ts A80412 , A90227 */
d->do_stream_recording = !!o->do_stream_recording;
if (o->do_stream_recording >= 16)
d->stream_recording_start = o->do_stream_recording;
else
d->stream_recording_start = 0;
d->buffer = calloc(sizeof(struct buffer), 1);
if (d->buffer == NULL)
goto fail_wo_sync;
/* >>> ts A90321
d->buffer = &buf;
memset(d->buffer, 0, sizeof(struct buffer));
fprintf(stderr, "libburn_DEBUG: d->buffer = %lX , size = %d\n",
(unsigned long) d->buffer, (int) sizeof(struct buffer));
calloc() seems not to have the desired effect. valgrind warns:
==18251== Syscall param write(buf) points to uninitialised byte(s)
==18251== at 0x5071DEB: (within /lib64/libpthread-2.5.so)
==18251== by 0x4723FA: burn_stdio_write (write.c:1850)
==18251== by 0x4725DC: burn_stdio_mmc_write (write.c:1894)
==18251== by 0x483B7A: get_sector (sector.c:229)
==18251== by 0x484F11: sector_data (sector.c:639)
==18251== by 0x4729FE: burn_stdio_write_track (write.c:2012)
==18251== by 0x472CF4: burn_stdio_write_sync (write.c:2072)
==18251== by 0x472E8D: burn_disc_write_sync (write.c:2125) <<< we are here
==18251== by 0x460254: write_disc_worker_func (async.c:514)
==18251== by 0x506B09D: start_thread (in /lib64/libpthread-2.5.so)
==18251== by 0x55484CC: clone (in /lib64/libc-2.5.so)
*/
d->rlba = -150;
d->toc_temp = 9;
@ -2148,7 +2304,12 @@ return crap. so we send the command, then ignore the result.
d->alba += 4500;
}
}
if (!burn_write_session(o, disc->session[i]))
multi_mem = o->multi;
if(i < disc->sessions - 1)
o->multi = 1;
ret = burn_write_session(o, disc->session[i]);
o->multi = multi_mem;
if (!ret)
goto fail;
lt = disc->session[i]->track[disc->session[i]->tracks - 1];
@ -2206,6 +2367,9 @@ fail_wo_sync:;
d->busy = BURN_DRIVE_IDLE;
ex:;
d->do_stream_recording = 0;
if (d->buffer != NULL)
free((char *) d->buffer);
d->buffer = buffer_mem;
return;
}
@ -2215,7 +2379,7 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
{
int alignment = 0, start, upto, chunksize, err, fd = -1, ret;
char msg[81], *rpt;
struct buffer buf;
struct buffer buf, *buffer_mem = d->buffer;
if (d->released) {
libdax_msgs_submit(libdax_messenger,
@ -2326,7 +2490,7 @@ int burn_random_access_write(struct burn_drive *d, off_t byte_address,
if(fd >= 0)
close(fd);
d->buffer = NULL;
d->buffer = buffer_mem;
d->busy = BURN_DRIVE_IDLE;
return 1;
}

View File

@ -1,6 +1,6 @@
/* test/libburner.c , API illustration of burning data or audio tracks to CD */
/* Copyright (C) 2005 - 2007 Thomas Schmitt <scdbackup@gmx.net> */
/* Copyright (C) 2005 - 2009 Thomas Schmitt <scdbackup@gmx.net> */
/* Provided under GPLv2,see also "License and copyright aspects" at file end */
@ -8,9 +8,9 @@
libburner is a minimal demo application for the library libburn as provided
on http://libburnia-project.org . It can list the available devices, can
blank a CD-RW or DVD-RW, can format DVD-RW and BD-RE, can burn to CD-R,
CD-RW, DVD-R, DVD+R, DVD+R/DL, DVD+RW, DVD-RW, DVD-RAM, BD-RE.
Not supported yet: DVD-R/DL, BD-R.
blank a CD-RW or DVD-RW, can format DVD-RW and BD, can burn to CD-R,
CD-RW, DVD-R, DVD+R, DVD+R/DL, DVD+RW, DVD-RW, DVD-RAM, BD-R, BD-RE.
Not supported yet: DVD-R/DL.
It's main purpose, nevertheless, is to show you how to use libburn and also
to serve the libburnia team as reference application. libburner.c does indeed
@ -29,9 +29,9 @@
With that aquired drive you can blank a CD-RW
libburner_blank_disc()
or you can format a DVD-RW to profile "Restricted Overwrite" (needed once)
or an unused BD-RE to default size
libburner_format_owrt()
With the aquired drive you can burn to CD or DVD
or an unused BD to default size with spare blocks
libburner_format()
With the aquired drive you can burn to CD, DVD, BD
libburner_payload()
When everything is done, main() releases the drive and shuts down libburn:
burn_drive_release();
@ -106,7 +106,7 @@ int libburner_aquire_drive(char *drive_adr, int *driveno)
ret = libburner_aquire_by_adr(drive_adr);
else
ret = libburner_aquire_by_driveno(driveno);
if (ret <= 0)
if (ret <= 0 || *driveno <= 0)
return ret;
burn_disc_get_profile(drive_list[0].drive, &current_profile,
current_profile_name);
@ -260,7 +260,8 @@ int libburner_aquire_by_driveno(int *driveno)
}
/** Makes a previously used CD-RW ready for thorough re-usal.
/** Makes a previously used CD-RW or unformatted DVD-RW ready for thorough
re-usal.
To our knowledge it is hardly possible to abort an ongoing blank operation
because after start it is entirely handled by the drive.
@ -322,24 +323,35 @@ int libburner_blank_disc(struct burn_drive *drive, int blank_fast)
Formats unformatted BD-RE to default size. This will allocate some
reserve space, test for bad blocks and make the media ready for writing.
Expect a very long run time.
Formats unformatted blank BD-R to hold a default amount of spare blocks
for eventual mishaps during writing. If BD-R get written without being
formatted, then they get no such reserve and will burn at full speed.
*/
int libburner_format_owrt(struct burn_drive *drive)
int libburner_format(struct burn_drive *drive)
{
struct burn_progress p;
double percent = 1.0;
int ret, status, num_formats, format_flag= 0;
off_t size = 0;
unsigned dummy;
enum burn_disc_status disc_state;
if (current_profile == 0x13) {
fprintf(stderr, "IDLE: DVD-RW media is already formatted\n");
return 2;
} else if (current_profile == 0x43) {
} else if (current_profile == 0x41 || current_profile == 0x43) {
disc_state = burn_disc_get_status(drive);
if (disc_state != BURN_DISC_BLANK && current_profile == 0x41) {
fprintf(stderr,
"FATAL: BD-R is not blank. Cannot format.\n");
return 0;
}
ret = burn_disc_get_formats(drive, &status, &size, &dummy,
&num_formats);
if (ret > 0 && status == BURN_FORMAT_IS_FORMATTED) {
if (ret > 0 && status != BURN_FORMAT_IS_UNFORMATTED) {
fprintf(stderr,
"IDLE: BD-RE media is already formatted\n");
"IDLE: BD media is already formatted\n");
return 2;
}
size = 0; /* does not really matter */
@ -348,7 +360,7 @@ int libburner_format_owrt(struct burn_drive *drive)
size = 128 * 1024 * 1024;
format_flag = 1; /* write initial 128 MiB */
} else {
fprintf(stderr, "FATAL: Can only format DVD-RW or BD-RE\n");
fprintf(stderr, "FATAL: Can only format DVD-RW or BD\n");
return 0;
}
@ -476,7 +488,7 @@ int libburner_payload(struct burn_drive *drive,
/* Give up local reference to the data burn_source object */
burn_source_free(data_src);
} /* trackno loop end */
} /* trackno loop end */
/* Evaluate drive and media */
disc_state = burn_disc_get_status(drive);
@ -614,7 +626,8 @@ int libburner_setup(int argc, char **argv)
}
strcpy(drive_adr, argv[i]);
}
} else if (!strcmp(argv[i], "--format_overwrite")) {
} else if ((!strcmp(argv[i], "--format_overwrite")) ||
(!strcmp(argv[i], "--format"))) {
do_blank = 101;
} else if (!strcmp(argv[i], "--multi")) {
@ -655,8 +668,7 @@ int libburner_setup(int argc, char **argv)
if (print_help || insuffient_parameters ) {
printf("Usage: %s\n", argv[0]);
printf(" [--drive <address>|<driveno>|\"-\"] [--audio]\n");
printf(" [--blank_fast|--blank_full|--format_overwrite]\n");
printf(" [--try_to_simulate]\n");
printf(" [--blank_fast|--blank_full|--format] [--try_to_simulate]\n");
printf(" [--multi] [<one or more imagefiles>|\"-\"]\n");
printf("Examples\n");
printf("A bus scan (needs rw-permissions to see a drive):\n");
@ -669,8 +681,8 @@ int libburner_setup(int argc, char **argv)
printf(" %s --drive /dev/hdc --blank_fast\n",argv[0]);
printf("Blank a used DVD-RW (is combinable with burning in one run):\n");
printf(" %s --drive /dev/hdc --blank_full\n",argv[0]);
printf("Format a DVD-RW to avoid need for blanking before re-use:\n");
printf(" %s --drive /dev/hdc --format_overwrite\n", argv[0]);
printf("Format a DVD-RW, BD-RE or BD-R:\n");
printf(" %s --drive /dev/hdc --format\n", argv[0]);
printf("Burn two audio tracks (to CD only):\n");
printf(" lame --decode -t /path/to/track1.mp3 track1.cd\n");
printf(" test/dewav /path/to/track2.wav -o track2.cd\n");
@ -720,7 +732,7 @@ int main(int argc, char **argv)
{ ret = 0; goto release_drive; }
if (do_blank) {
if (do_blank > 100)
ret = libburner_format_owrt(drive_list[driveno].drive);
ret = libburner_format(drive_list[driveno].drive);
else
ret = libburner_blank_disc(drive_list[driveno].drive,
do_blank == 1);