[Libburn] [Patch] Probe Write Modes
Tiago Cogumbreiro
cogumbreiro@linus.uac.pt
Mon, 22 Dec 2003 01:04:14 -0100
--=-CFtOYr30iQdPUEDTsUcH
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi folks,
Here goes the patch for correctly probing write modes.
Changes:
+ You now have 4 more fields in drive_info:
* tao_block_types
* sao_block_types
* raw_block_types
* packet_block_types
+ Removed burn_drive_get_block_types
Have fun :)
Tiago Cogumbreiro
--=-CFtOYr30iQdPUEDTsUcH
Content-Disposition: attachment; filename=block_modes.diff
Content-Type: text/x-patch; name=block_modes.diff; charset=
Content-Transfer-Encoding: 7bit
? libburn/.drive.c.old.swp
? libburn/.drive.c.swp
? libburn/.transport.h.swp
? test/.burniso.c.swp
? test/err.log
? test/log
? test/std.log
Index: libburn/drive.c
===================================================================
RCS file: /cvs/burn/burn/libburn/drive.c,v
retrieving revision 1.250
diff -p -u -r1.250 drive.c
--- libburn/drive.c 21 Dec 2003 23:44:06 -0000 1.250
+++ libburn/drive.c 22 Dec 2003 01:59:51 -0000
@@ -255,6 +255,12 @@ static int drive_getcaps(struct burn_dri
out->write_simulate = !!d->mdata->simulate;
out->c2_errors = !!d->mdata->c2_pointers;
out->drive = d;
+ /* update available block types */
+ d->probe_write_modes(d);
+ out->tao_block_types = d->block_types[BURN_WRITE_TAO];
+ out->sao_block_types = d->block_types[BURN_WRITE_SAO];
+ out->raw_block_types = d->block_types[BURN_WRITE_RAW];
+ out->packet_block_types = d->block_types[BURN_WRITE_PACKET];
return 1;
}
Index: libburn/libburn.h
===================================================================
RCS file: /cvs/burn/burn/libburn/libburn.h,v
retrieving revision 1.183
diff -p -u -r1.183 libburn.h
--- libburn/libburn.h 21 Dec 2003 23:44:06 -0000 1.183
+++ libburn/libburn.h 22 Dec 2003 01:59:53 -0000
@@ -320,6 +320,30 @@ struct burn_drive_info
/** The size of the drive's buffer (in kilobytes) */
int buffer_size;
+ /**
+ * The supported block types in tao mode.
+ * They should be tested with the desired block type.
+ * See also burn_block_types.
+ */
+ int tao_block_types;
+ /**
+ * The supported block types in sao mode.
+ * They should be tested with the desired block type.
+ * See also burn_block_types.
+ */
+ int sao_block_types;
+ /**
+ * The supported block types in raw mode.
+ * They should be tested with the desired block type.
+ * See also burn_block_types.
+ */
+ int raw_block_types;
+ /**
+ * The supported block types in packet mode.
+ * They should be tested with the desired block type.
+ * See also burn_block_types.
+ */
+ int packet_block_types;
/** The value by which this drive can be indexed when using functions
in the library. This is the value to pass to all libbburn functions
@@ -444,14 +468,6 @@ int burn_drive_grab(struct burn_drive *d
*/
void burn_drive_release(struct burn_drive *drive, int eject);
-/** Query the possible block types for a drive.
- @param drive The drive to query for valid block types.
- @param write_type The method/style of writing to query for.
- @return A combination of all valid block types (see burn_block_types).
-*/
-int burn_drive_get_block_types(struct burn_drive *drive,
- enum burn_write_types write_type);
-
/** Returns what kind of disc a drive is holding. This function may need to be
called more than once to get a proper status from it. See burn_status
for details.
Index: libburn/mmc.c
===================================================================
RCS file: /cvs/burn/burn/libburn/mmc.c,v
retrieving revision 1.132
diff -p -u -r1.132 mmc.c
--- libburn/mmc.c 19 Dec 2003 05:35:46 -0000 1.132
+++ libburn/mmc.c 22 Dec 2003 01:59:54 -0000
@@ -271,7 +271,6 @@ void mmc_read_disc_info(struct burn_driv
d->start_lba = burn_msf_to_lba(data[17], data[18], data[19]);
d->end_lba = burn_msf_to_lba(data[21], data[22], data[23]);
d->status = BURN_DISC_BLANK;
- spc_try_write_modes(d);
break;
case 1:
d->status = BURN_DISC_APPENDABLE;
Index: libburn/sg.c
===================================================================
RCS file: /cvs/burn/burn/libburn/sg.c,v
retrieving revision 1.114
diff -p -u -r1.114 sg.c
--- libburn/sg.c 21 Dec 2003 21:45:02 -0000 1.114
+++ libburn/sg.c 22 Dec 2003 01:59:55 -0000
@@ -114,6 +114,7 @@ static void enumerate_common(char *fname
out.read_disc_info = spc_sense_write_params;
out.get_erase_progress = spc_get_erase_progress;
out.test_unit_ready = spc_test_unit_ready;
+ out.probe_write_modes = spc_probe_write_modes;
out.read_toc = mmc_read_toc;
out.write = mmc_write;
out.erase = mmc_erase;
Index: libburn/spc.c
===================================================================
RCS file: /cvs/burn/burn/libburn/spc.c,v
retrieving revision 1.85
diff -p -u -r1.85 spc.c
--- libburn/spc.c 21 Dec 2003 21:45:02 -0000 1.85
+++ libburn/spc.c 22 Dec 2003 01:59:55 -0000
@@ -281,7 +281,7 @@ don't check totally stupid modes (raw/ra
some drives say they're ok, and they're not.
*/
-void spc_try_write_modes(struct burn_drive *d)
+void spc_probe_write_modes(struct burn_drive *d)
{
struct buffer buf;
int try_write_type = 1;
Index: libburn/spc.h
===================================================================
RCS file: /cvs/burn/burn/libburn/spc.h,v
retrieving revision 1.26
diff -p -u -r1.26 spc.h
--- libburn/spc.h 21 Dec 2003 21:45:02 -0000 1.26
+++ libburn/spc.h 22 Dec 2003 01:59:55 -0000
@@ -13,7 +13,7 @@ void spc_getcaps(struct burn_drive *d);
void spc_sense_write_params(struct burn_drive *);
void spc_select_write_params(struct burn_drive *,
const struct burn_write_opts *);
-void spc_try_write_modes(struct burn_drive *);
+void spc_probe_write_modes(struct burn_drive *);
void spc_request_sense(struct burn_drive *d, struct buffer *buf);
int spc_block_type(enum burn_block_types b);
int spc_get_erase_progress(struct burn_drive *d);
Index: libburn/transport.h
===================================================================
RCS file: /cvs/burn/burn/libburn/transport.h,v
retrieving revision 1.104
diff -p -u -r1.104 transport.h
--- libburn/transport.h 21 Dec 2003 21:45:02 -0000 1.104
+++ libburn/transport.h 22 Dec 2003 01:59:56 -0000
@@ -136,6 +136,7 @@ struct burn_drive
void (*close_disc)(struct burn_drive *d, struct burn_write_opts *o);
void (*close_session)(struct burn_drive *d, struct burn_write_opts *o);
int (*test_unit_ready) (struct burn_drive *d);
+ void (*probe_write_modes) (struct burn_drive *d);
struct params params;
struct scsi_inquiry_data *idata;
struct scsi_mode_data *mdata;
--=-CFtOYr30iQdPUEDTsUcH--