*** cdwrite.c.sgi Tue Feb 11 15:18:39 1997 --- cdwrite.c Mon Feb 17 14:58:54 1997 *************** *** 22,34 **** version 2.1: Unofficial hack by forrest@lidar.ssec.wisc.edu added support for SGI Irix 5.3 (-DUSE_DSLIB) added support for IBM AIX 4.1.4 (-D_AIX) */ ! #if defined(USE_DSLIB) || defined(_AIX) ! const char *version = "2.1"; ! #else /* defined(USE_DSLIB) || defined(_AIX) */ ! const char *version = "2.0"; ! #endif /* defined(USE_DSLIB) || defined(_AIX) */ #ifndef DEFAULT_DEV #define DEFAULT_DEV "/dev/cdwriter" #endif --- 22,55 ---- version 2.1: Unofficial hack by forrest@lidar.ssec.wisc.edu added support for SGI Irix 5.3 (-DUSE_DSLIB) added support for IBM AIX 4.1.4 (-D_AIX) + + version 2.2teac-sgi-beta1: + Unofficial hack by tjko@jyu.fi + so no guarantees whatsoever :) It is very alpha + code, but works for me... + added support for Teac/JVC/Pinnacle drives + (tested only on Pinnacle RCD5040!!!) + currently just compiles on SGI and audiocd support + is not finished for these drives. It's a hack, so + feel free to cleanup the code and and fix + it to work compile Linux/AIX or whatever... + added -f parameter for doing just the fixation, + since RCD5040 seems to sometimes fail on fixation + part (buggy firmware I guess) so this is just quick + hack to save those discs, it just reads the size of + image from file and uses it to finalize the disc, + DON'T even try this unless you know what you're doing! + + version 2.2teac-sgi-beta2: + fixed bug in fixation (leadout was marked to begin + two sectors earlier that it should), pregap sectors + are now filled same way as other toasters seem to do + it (don't know if it matters though) + */ ! const char *version = "2.2teac-sgi-beta2"; ! #ifndef DEFAULT_DEV #define DEFAULT_DEV "/dev/cdwriter" #endif *************** *** 85,90 **** --- 106,141 ---- #define max(A,B) ((A)<(B)?(B):(A)) #define min(A,B) ((A)<(B)?(A):(B)) + + #ifndef USE_DSLIB + /* macros for building scsi msb array parameter lists */ + #define B(s,i) ((unsigned char)((s) >> i)) + #define B1(s) ((unsigned char)(s)) + #define B2(s) B((s),8), B1(s) + #define B3(s) B((s),16), B((s),8), B1(s) + #define B4(s) B((s),24), B((s),16), B((s),8), B1(s) + + /* macros for converting scsi msb array to binary */ + #define V1(s) (s)[0] + #define V2(s) (((s)[0] << 8) | (s)[1]) + #define V3(s) (((((s)[0] << 8) | (s)[1]) << 8) | (s)[2]) + #define V4(s) (((((((s)[0] << 8) | (s)[1]) << 8) | (s)[2]) << 8) | (s)[3]) + #endif /* USE_DSLIB */ + + + /* macros for building MSF values from LBA */ + #define LBA_MIN(x) ((x)/(60*75)) + #define LBA_SEC(x) (((x)%(60*75))/75) + #define LBA_FRM(x) ((x)%75) + + #define MSF_CONV(a) ( (((a)%100)/10)*16 + ((a)%10) ) + + + #define PRINT_LBA(x) printf("LBA=%d %02d:%02d:%02d conv=%02x:%02x:%02x \n", x, LBA_MIN(x),LBA_SEC(x),LBA_FRM(x), MSF_CONV(LBA_MIN(x)), MSF_CONV(LBA_SEC(x)),MSF_CONV(LBA_FRM(x)) ); + + #define PRINT_CMD(x,n) { int i; for(i=0;ibytes/2048+(track_info->bytes%2048?1:0); + lead_out_lba=blocks; /* save for writing of TOC */ + + fillg2cmd(dsp, (uchar_t*)CMDBUF(dsp), SET_LIMITS, + 0, + B4(0), /* LBA=0 */ + B4(blocks+2), /* Length=n+2 */ + 0,0); /* reserved */ + filldsreq(dsp, 0, 0, DSRQ_WRITE | DSRQ_SENSE); + retval=send_request(dsp, "set_limits"); + + PRINT_LBA(blocks); + PRINT_CMD(CMDBUF(dsp),12); + + fillg1cmd(dsp, (uchar_t*)CMDBUF(dsp), SET_SUBCODE, + 0, + 0,0,0,0, /* reserved */ + 0, /* track no (0=new?) */ + B2(4), /* parameter list len=4 */ + 0); /* reserved */ + fillbytes(bytes,4, + 0, /* pregap (?) */ + 0x41, /* ctrl/addr */ + 1, /* Q TNO */ + 1); /* index */ + filldsreq(dsp, bytes, 4, DSRQ_WRITE|DSRQ_SENSE); + retval=send_request(dsp, "set_subcode"); + + return retval; + #else + exit(-1); /* Linux support....do it yourself version :) */ + #endif + + } + + /******/ + + int #ifdef USE_DSLIB ! write_data_track (struct track_info_t *track_info,struct dsreq *dsp) { #else /* def USE_DSLIB */ ! write_data_track (struct track_info_t *track_info,int fd, int *reply_len, struct sg_reply *rep) { *reply_len = sizeof(struct sg_reply); + #endif + + switch (cdwriter_type) { + + case type_teac: + teac_write_pregap(track_info,dsp); + return 0; + + default: + + #ifdef USE_DSLIB + fillg1cmd(dsp, (uchar_t *) CMDBUF(dsp), + #else return send_request (fd, "write_data_track", reply_len, rep, 10, #endif /* def USE_DSLIB */ WRITE_TRACK, /* 0 */ *************** *** 370,375 **** --- 560,569 ---- dsp->ds_time = 120 * 1000; return send_request(dsp, "write_data_track"); #endif /* def USE_DSLIB */ + + } + + return -1; } int *************** *** 448,453 **** --- 642,648 ---- #endif /* !defined(USE_DSLIB) && !defined(_AIX) */ int slop; int pad; + int lba = 0; static int track_no = 0; track_no++; *************** *** 551,558 **** #endif /* def USE_AIO */ #else /* def _AIX */ #ifdef USE_DSLIB ! fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), G0_WRIT, 0, ! 0, 0, this_read_len / block_size, 0); filldsreq(dsp, bbytes, this_read_len, DSRQ_WRITE | DSRQ_SENSE); dsp->ds_time = 120 * 1000; #ifdef USE_AIO --- 746,761 ---- #endif /* def USE_AIO */ #else /* def _AIX */ #ifdef USE_DSLIB ! if (cdwriter_type==type_teac) { ! /* teac_write_pregap(track_info,dsp); */ ! fillg1cmd(dsp, (uchar_t *) CMDBUF(dsp), WRITE_LBA, 0, ! B4(lba), 0, B2(this_read_len/block_size), ! 0x80); ! lba+=this_read_len/block_size; ! } else { ! fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), G0_WRIT, 0, ! 0, 0, this_read_len / block_size, 0); ! } filldsreq(dsp, bbytes, this_read_len, DSRQ_WRITE | DSRQ_SENSE); dsp->ds_time = 120 * 1000; #ifdef USE_AIO *************** *** 737,743 **** #endif /* def USE_AIO */ #else /* def _AIX */ #ifdef USE_DSLIB ! fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), G0_WRIT, 0, 0, 0, this_read_len / block_size, 0); filldsreq(dsp, bbytes, this_read_len, DSRQ_WRITE | DSRQ_SENSE); dsp->ds_time = 120 * 1000; --- 940,953 ---- #endif /* def USE_AIO */ #else /* def _AIX */ #ifdef USE_DSLIB ! if (cdwriter_type==type_teac) { ! fillg1cmd(dsp, (uchar_t *)CMDBUF(dsp), WRITE_LBA, 0, ! B4(lba),0,B2(this_read_len/block_size), ! (total_bytes_readds_time = 120 * 1000; *************** *** 1106,1115 **** int #ifdef USE_DSLIB fixation (struct dsreq *dsp, int cdrom) { - fillg1cmd(dsp, (uchar_t *) CMDBUF(dsp), #else /* def USE_DSLIB */ fixation (int fd, int *reply_len, struct sg_reply *rep, int cdrom) { *reply_len = sizeof( struct sg_reply ); return send_request (fd, "fixation", reply_len, rep, 10, #endif /* def USE_DSLIB */ FIXATION, /* 0 */ --- 1316,1409 ---- int #ifdef USE_DSLIB fixation (struct dsreq *dsp, int cdrom) { #else /* def USE_DSLIB */ fixation (int fd, int *reply_len, struct sg_reply *rep, int cdrom) { *reply_len = sizeof( struct sg_reply ); + #endif + unsigned char bytes[255]; + int retval; + + switch(cdwriter_type) { + + case type_teac: + #ifdef USE_DSLIB + fillg2cmd(dsp, (uchar_t *)CMDBUF(dsp), + CLEAR_SUBCODE, /* 0 */ + 0,0,0,0, /* 1..4 reserved */ + 0x80, /* 5 flag/link */ + 0,0,0,0,0,0); /* 6..11 reserved */ + filldsreq(dsp,0,0,DSRQ_READ|DSRQ_SENSE); + retval = send_request(dsp, "clear_subcode"); + + fillg1cmd(dsp, (uchar_t*)CMDBUF(dsp), + SET_SUBCODE, + 0, + 0,0,0,0, /* reserved */ + 0, /* track no (0=new?) */ + 0,0x17, /* parameter list len */ + 0); /* reserved */ + fillbytes(bytes,0x17, + 0, /* reserved */ + 0, /* reserved */ + 0, /* Q TNO */ + + /* track 1 */ + 0x41, /* ctrl/adr */ + 1, /* track no */ + 0,2,0, /* start MSF=00:02:00 (LBA=0) */ + + /* first track */ + 0x41, /* ctrl/adr */ + 0xa0, /* point=A0 */ + 1, /* first track */ + 0, /* type: 0=CD-DA or CD-ROM */ + 0, /* reserved */ + + /* last track */ + 0x41, /* ctrl/adr */ + 0xa1, /* point=A1 */ + 1, /* last track */ + 0,0, /* reserved */ + + /* start of lead out */ + 0x41, /* ctrl/adr */ + 0xa2, /* point=A2 */ + /* start of lead out area in MSF */ + MSF_CONV(LBA_MIN(lead_out_lba+150+2)), /* 00:00:00=-150(LBA) */ + MSF_CONV(LBA_SEC(lead_out_lba+150+2)), + MSF_CONV(LBA_FRM(lead_out_lba+150+2)) + ); + + filldsreq(dsp, bytes, 0x17, DSRQ_WRITE|DSRQ_SENSE); + printf("Leadout lba=%d (%x), lba+150+2=%d\n", + lead_out_lba,lead_out_lba,lead_out_lba+150+2); + PRINT_LBA(lead_out_lba+150+2); + PRINT_CMD(CMDBUF(dsp),10); + PRINT_CMD(bytes,0x17); + retval=send_request(dsp, "set_subcode"); + + /* fixating */ + fillg2cmd(dsp, (uchar_t *)CMDBUF(dsp), + FREEZE, /* 0 */ + 0,0,0,0, /* 1..4 reserved */ + 0x80, /* 5 flag/link */ + 0,0,0,0,0,0); /* 6..11 reserved */ + filldsreq(dsp,0,0,DSRQ_READ|DSRQ_SENSE); + dsp->ds_time = 5 * 60 * 1000; + retval = send_request(dsp, "freeze"); + + return retval; + + #else + die("fixation: Linux support not done."); + #endif + + + default: + + #ifdef USE_DSLIB + fillg1cmd(dsp, (uchar_t *) CMDBUF(dsp), + #else return send_request (fd, "fixation", reply_len, rep, 10, #endif /* def USE_DSLIB */ FIXATION, /* 0 */ *************** *** 1121,1126 **** --- 1415,1422 ---- dsp->ds_time = 5 * 60 * 1000; return send_request(dsp, "fixation"); #endif /* def USE_DSLIB */ + } + return -1; } int *************** *** 1230,1235 **** --- 1526,1550 ---- return send_request(dsp, "medium_unload"); #endif /* def USE_DSLIB */ + case type_teac: + #ifdef USE_DSLIB + fillg0cmd(dsp,(uchar_t *) CMDBUF(dsp), + G0_STOP, /* 0 */ + #else + return send_request (fd, "medium_unload", reply_len, rep, 6, + START_STOP, /* 0 */ + #endif + 0, 0, 0, + (load?3:2), + 0); + #ifdef USE_DSLIB + filldsreq(dsp, 0, 0, DSRQ_READ | DSRQ_SENSE); + dsp->ds_time = 20 * 1000; + return send_request(dsp, "medium_unload"); + #endif + + return 1; + default: die("default in medium_load_unload"); } *************** *** 1435,1441 **** int #ifdef USE_DSLIB mode_select1(struct dsreq *dsp, int audio, int preemp) { - unsigned char bytes[20]; #else /* def USE_DSLIB */ mode_select1(int fd, int *reply_len, int audio, int preemp, struct sg_reply *rep) { --- 1750,1755 ---- *************** *** 1443,1448 **** --- 1757,1766 ---- *reply_len = sizeof( struct sg_reply ); #endif /* def USE_DSLIB */ + + unsigned char bytes[255]; + int retval; + switch (cdwriter_type) { case type_yamaha: *************** *** 1522,1527 **** --- 1840,1902 ---- filldsreq(dsp, bytes, 20, DSRQ_WRITE | DSRQ_SENSE); return send_request(dsp, "mode_select6#1"); #endif /* def USE_DSLIB */ + break; + + + case type_teac: + #ifdef USE_DSLIB + fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), + G0_MSEN, /* 0 */ + #else + retval=send_request (fd "mode_sense", reply_len, rep, 6, + MODE_SENSE, /* 0 */ + #endif + 0,0,0,12,0 + ); + #ifdef USE_DSLIB + filldsreq(dsp, bytes, 12, DSRQ_READ|DSRQ_SENSE); + retval=send_request(dsp, "mode_sense"); + #endif + + #ifdef USE_DSLIB + fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), + G0_MSEL, /* 0 */ + #else /* def USE_DSLIB */ + return send_request (fd, "mode_select6#1", reply_len, rep, 18, + MODE_SELECT, /* 0 */ + #endif /* def USE_DSLIB */ + 0x00, /* 1 : Page Format Bit */ + 0, 0, /* 2..3 */ + 12, /* 4 : Parameter List Length */ + #ifdef USE_DSLIB + 0 /* 5 */); + fillbytes(bytes, 12, + #else /* def USE_DSLIB */ + 0, /* 5 */ + #endif /* def USE_DSLIB */ + + /* Mode Select Header */ + 0, /* 6+0 reserved */ + 0, /* 6+1 Medium Type */ + 0, /* 6+2 res<<7 + host_application_code */ + 8, /* 6+3 Block Descriptor Length */ + + /* Block Descriptor */ + (audio ? 4 : 1), /* 6+4+0 Density Code */ + bytes[5], /* 6+4+1..3 No of Blocks on disc*/ + bytes[6], + bytes[7], + 0, /* 6+4+4 reserved */ + 0, /* 6+4+5 Block Size (MSB) */ + (audio ? 0x09 : 0x08), /* 6+4+6 */ + (audio ? 0x30 : 0x00) /* 6+4+7 (LSB) */ + ); + #ifdef USE_DSLIB + filldsreq(dsp, bytes, 12, DSRQ_WRITE | DSRQ_SENSE); + return send_request(dsp, "mode_select6#1"); + #endif /* def USE_DSLIB */ + break; + default: die("default in mode_select1"); } *************** *** 1531,1546 **** int #ifdef USE_DSLIB mode_select2(struct dsreq *dsp, unsigned char dummy, unsigned char speed) { ! unsigned char bytes[12]; #else /* def USE_DSLIB */ mode_select2(int fd, int *reply_len, int dummy, int speed, struct sg_reply *rep) { /* Per-disc mode select */ *reply_len = sizeof( struct sg_reply ); #endif /* def USE_DSLIB */ switch (cdwriter_type) { case type_yamaha: #ifdef USE_DSLIB fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), --- 1906,1927 ---- int #ifdef USE_DSLIB mode_select2(struct dsreq *dsp, unsigned char dummy, unsigned char speed) { ! unsigned char bytes[255]; #else /* def USE_DSLIB */ mode_select2(int fd, int *reply_len, int dummy, int speed, struct sg_reply *rep) { + /* Per-disc mode select */ *reply_len = sizeof( struct sg_reply ); #endif /* def USE_DSLIB */ + + int retval; + int disc_blocks; + switch (cdwriter_type) { + case type_yamaha: #ifdef USE_DSLIB fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), *************** *** 1614,1619 **** --- 1995,2134 ---- return send_request(dsp, "mode_select6#2"); #endif /* def USE_DSLIB */ + + case type_teac: + + #ifdef USE_DSLIB + fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), + G0_MSEN, /* 0 */ + #else + retval=send_request (fd "mode_sense", reply_len, rep, 6, + MODE_SENSE, /* 0 */ + #endif + 0,0,0,12,0 + ); + #ifdef USE_DSLIB + filldsreq(dsp, bytes, 12, DSRQ_READ|DSRQ_SENSE); + retval=send_request(dsp, "mode_sense"); + #endif + + + if (bytes[1]==1||bytes[1]==2||bytes[1]==3) { + printf("sense buffer: "); PRINT_CMD(bytes,12); + printf("Disc is not writeable!\n"); + return -1; + } + + disc_blocks=V3(&bytes[5]); + printf("Disc type: %02xh\nDisc capasity: %d blocks, " + "%d Mbytes, %02d:%02d:%02d\n", + bytes[1],disc_blocks, + disc_blocks*2/1024,LBA_MIN(disc_blocks),LBA_SEC(disc_blocks), + LBA_FRM(disc_blocks) ); + + if (retval!=0) return retval; + + #ifdef USE_DSLIB + fillg0cmd(dsp, (uchar_t *) CMDBUF(dsp), + G0_MSEL, /* 0 */ + #else /* def USE_DSLIB */ + retval=send_request (fd, "mode_select6#2", reply_len, rep, 19+6, + MODE_SELECT, /* 0 */ + #endif /* def USE_DSLIB */ + 0x10, /* 1 : page format bit */ + 0, 0, /* 2..3 */ + 0x13, /* 4 : parameter list length? */ + #ifdef USE_DSLIB + 0 /* 5 */); + fillbytes(bytes, 19, + #else /* def USE_DSLIB */ + 0, /* 5 */ + #endif /* def USE_DSLIB */ + + /* Mode select header: */ + 0, /* 6+0 reserved */ + 0, /* 6+1 medium type */ + 0, /* 6+2 res<<7 + host_application_code */ + 8, /* 6+3 block descriptor length */ + + /* Block Descriptor: */ + 1, /* 6+4 density code 01h=data, 04h=audio */ + bytes[5], /* 6+5 number of blocks (3 bytes) */ + bytes[6], /* 6+6 */ + bytes[7], /* 6+7 */ + 0, /* 6+8 reserved */ + B3(2048), /* 6+9..11 block length (3 bytes) + 2048 for data + 2352 for audio */ + + /* Preview Write Page 0x21 */ + 0x21, /* 6+4+8+0 page code */ + 1, /* 6+4+8+1 page length (N-2) */ + (dummy?3:0), /* 6+4+8+2 3 (or 1)=preview, 0=write*/ + + /* Drive Speed Page 0x31 */ + 0x31, /* 6+4+8+3+0 page code */ + 2, /* 6+4+8+3+1 page length (N-2) */ + (speed==4 ? 2 : speed==2 ? 1 : 0), + /* 6+4+8+3+2 speed, + 0=normal, + 1=double, 2=quad, + 0xff=maximum */ + 0 /* 6+4+8+3+3 reserved */ + + ); + #ifdef USE_DSLIB + filldsreq(dsp, bytes, 19, DSRQ_WRITE | DSRQ_SENSE); + retval = send_request(dsp, "mode_select6#2"); + #endif /* def USE_DSLIB */ + if (retval!=0) return retval; + + /* OPC...laser calibration? :) */ + #ifdef USE_DSLIB + fillg2cmd(dsp, (uchar_t *)CMDBUF(dsp), OPC_EXECUTE, + 1, 0,0,0,0,0,0,0,0,0,0); + filldsreq(dsp, 0, 0, DSRQ_READ|DSRQ_SENSE); + dsp->ds_time=30*1000; + retval=send_request(dsp,"opc_execute1"); + #else + retval=send_request(fd,"opc_execute1",reply_len,rep,12, + OPC_EXECUTE, /* 0 */ + 1, /* 1 JD 1=judge */ + 0,0,0,0,0,0,0,0,0,0); /* 2..11 reserved */ + #endif + if (retval!=0) { printf("Disk not writeable!\n"); return retval; } + + #ifdef USE_DSLIB + fillg2cmd(dsp, (uchar_t *)CMDBUF(dsp), OPC_EXECUTE, + 0, 0,0,0,0,0,0,0,0,0,0); + filldsreq(dsp, 0, 0, DSRQ_READ|DSRQ_SENSE); + dsp->ds_time=30*1000; + retval=send_request(dsp,"opc_execute0"); + #else + retval=send_request(fd,"opc_execute0",reply_len,rep,12, + OPC_EXECUTE, /* 0 */ + 0, /* 1 JD 0=normal */ + 0,0,0,0,0,0,0,0,0,0); /* 2..11 reserved */ + #endif + + /* CLEAR SUBCODE */ + #ifdef USE_DSLIB + fillg2cmd(dsp, (uchar_t *)CMDBUF(dsp), + #else + retval=send_request(fd,"clear_subcode",reply_len,rep,12, + #endif + CLEAR_SUBCODE, /* 0 */ + 0,0,0,0, /* 1..4 reserved */ + 0x80, /* 5 flag/link */ + 0,0,0,0,0,0); /* 6..11 reserved */ + #ifdef USE_DSLIB + filldsreq(dsp, 0, 0, DSRQ_READ|DSRQ_SENSE); + /* dsp->ds_time=15*1000; */ + retval=send_request(dsp,"clear_subcode"); + #endif + + return retval; + default: die("default in mode_select2"); } *************** *** 1676,1681 **** --- 2191,2197 ---- {"--pad", 'P'}, {"--nopad", 'N'}, {"--help", 'h'}, + {"--fixation",'f'}, {NULL, 0} }; *************** *** 1705,1710 **** --- 2221,2227 ---- int tracks = 0; int do_eject = 0; int cdrom = 0; + int fixation_only = 0; struct track_info_t track_info[MAX_TRACKS]; struct track_info_t trackopt; const char *cd_writer = default_dev; *************** *** 1723,1728 **** --- 2240,2246 ---- program = argv[0]; + /* Set track defaults */ trackopt.audio = 0; /* data */ *************** *** 1837,1842 **** --- 2355,2364 ---- cd_writer = argv[++i]; break; + case 'f': /* -d, --fixation */ + fixation_only = 1; + break; + case 'h': /* -h, --help */ usage(0); #if defined(USE_DSLIB) || defined(_AIX) *************** *** 1889,1894 **** --- 2411,2419 ---- } } + + /* dummy_write=1; */ + if ( verbose ) printf("cdwrite %s\n", version); *************** *** 1959,1965 **** (void) signal(SIGINT, SIG_IGN); (void) signal(SIGQUIT, SIG_IGN); (void) signal(SIGTERM, SIG_IGN); ! if ((dsp = dsopen(cd_writer, O_RDWR)) == NULL) { #else /* def USE_DSLIB */ if ( (fd = open (cd_writer, O_RDWR)) < 0 ) { #endif /* def USE_DSLIB */ --- 2484,2490 ---- (void) signal(SIGINT, SIG_IGN); (void) signal(SIGQUIT, SIG_IGN); (void) signal(SIGTERM, SIG_IGN); ! if ((dsp = dsopen(cd_writer, O_RDWR|O_EXCL)) == NULL) { #else /* def USE_DSLIB */ if ( (fd = open (cd_writer, O_RDWR)) < 0 ) { #endif /* def USE_DSLIB */ *************** *** 2004,2009 **** --- 2529,2538 ---- cdwriter_type = type_yamaha; else if (strcmp(Manufacturer, "HP") == 0) cdwriter_type = type_hp; + else if (strcmp(Manufacturer, "PINNACLE") == 0 || + strcmp(Manufacturer, "TEAC") == 0 /* || + strcmp(Manufacturer, "JVC") == 0 */ ) + cdwriter_type = type_teac; else { fprintf(stderr, *************** *** 2036,2041 **** --- 2565,2572 ---- } #endif /* def _AIX */ + + if ( verbose ) { if ( speed_factor ) *************** *** 2042,2048 **** --- 2573,2601 ---- printf("Using speed: %d\n", speed_factor); else printf("Using speed: maximum\n"); + + printf("Dummy write: %s\n", + (dummy_write?"On (laser off)":"Off (laser on!)")); + } + + + if (fixation_only) { + printf("Fixating only! (hope you know what you're doing!\n" + "experimental, used only succesfully with Pinnacle to\n" + "rescue data discs when fixation failed at first time)\n"); + } + + + if (cdwriter_type==type_teac) { + if (tracks>1) { + printf("For this drive only supports writing single data track.\n"); + exit(1); + } + if (track_info[0].audio) { + printf("For this drive audio disc support not done.\n"); + exit(1); } + } /* Do it! */ *************** *** 2092,2116 **** } #else /* def _AIX */ #ifdef USE_DSLIB ! (void) medium_load_unload (dsp, 1); ! (void) set_removable (dsp, 0); (void) start_stop (dsp, 1); (void) rezero_unit (dsp); ! (void) test_unit_ready (dsp); (void) start_stop (dsp, 1); ! (void) mode_select2 (dsp, dummy_write, speed_factor); #else /* def USE_DSLIB */ ! medium_load_unload (fd, 1, &reply_len, &reply); set_removable (fd, 0, &reply_len, &reply); start_stop (fd, 1, &reply_len, &reply); rezero_unit (fd, &reply_len, &reply); test_unit_ready (fd, &reply_len, &reply); start_stop (fd, 1, &reply_len, &reply); ! mode_select2 (fd, &reply_len, dummy_write, speed_factor, &reply); #endif /* def USE_DSLIB */ #endif /* def _AIX */ ! ! for ( i = 0 ; i < tracks ; i++ ) { #ifdef _AIX (void) ioctl(fd, CDR100_MODE_SELECT1, track_info[i].audio); --- 2645,2679 ---- } #else /* def _AIX */ #ifdef USE_DSLIB ! if ( medium_load_unload (dsp, 1)!=0) return 1; ! test_unit_ready(dsp); ! if (test_unit_ready(dsp)!=0) { ! sleep(2); ! if (test_unit_ready(dsp)!=0) { exit(1); } ! } ! if (set_removable (dsp, 0)!=0) return 1; (void) start_stop (dsp, 1); (void) rezero_unit (dsp); ! if (test_unit_ready (dsp)!=0) return 1; (void) start_stop (dsp, 1); ! if (mode_select2 (dsp, dummy_write, speed_factor)!=0) return 1; #else /* def USE_DSLIB */ ! if (medium_load_unload (fd, 1, &reply_len, &reply)!=0) return 1; set_removable (fd, 0, &reply_len, &reply); start_stop (fd, 1, &reply_len, &reply); rezero_unit (fd, &reply_len, &reply); test_unit_ready (fd, &reply_len, &reply); start_stop (fd, 1, &reply_len, &reply); ! if (mode_select2 (fd, &reply_len, dummy_write, speed_factor, &reply)!=0) return 1; #endif /* def USE_DSLIB */ #endif /* def _AIX */ ! ! if (fixation_only) { ! lead_out_lba = track_info[0].bytes / 2048 ! + (track_info[0].bytes%2048?1:0); ! /* printf("Blocks=%d\n",lead_out_lba); */ ! } ! else for ( i = 0 ; i < tracks ; i++ ) { #ifdef _AIX (void) ioctl(fd, CDR100_MODE_SELECT1, track_info[i].audio); *************** *** 2127,2136 **** if ( track_info[i].audio ) (void) write_audio_track (dsp, track_info[i].preemp); else ! (void) write_data_track (dsp); (void) pipe_to_cd (&track_info[i], dsp); ! (void) synchronize_cache (dsp); #else /* def USE_DSLIB */ mode_select1 (fd, &reply_len, track_info[i].audio, track_info[i].preemp, &reply); --- 2690,2699 ---- if ( track_info[i].audio ) (void) write_audio_track (dsp, track_info[i].preemp); else ! (void) write_data_track ( &track_info[i], dsp); (void) pipe_to_cd (&track_info[i], dsp); ! if (cdwriter_type!=type_teac) (void) synchronize_cache (dsp); #else /* def USE_DSLIB */ mode_select1 (fd, &reply_len, track_info[i].audio, track_info[i].preemp, &reply); *************** *** 2137,2146 **** if ( track_info[i].audio ) write_audio_track (fd, &reply_len, &reply, track_info[i].preemp); else ! write_data_track (fd, &reply_len, &reply); pipe_to_cd (&track_info[i], fd, &reply_len, &reply); ! synchronize_cache (fd, &reply_len, &reply); #endif /* def USE_DSLIB */ #endif /* def _AIX */ } --- 2700,2710 ---- if ( track_info[i].audio ) write_audio_track (fd, &reply_len, &reply, track_info[i].preemp); else ! write_data_track ( &track_info[i],fd, &reply_len, &reply); pipe_to_cd (&track_info[i], fd, &reply_len, &reply); ! if (cdwriter_type!=type_teac) ! synchronize_cache (fd, &reply_len, &reply); #endif /* def USE_DSLIB */ #endif /* def _AIX */ } *************** *** 2151,2157 **** (void) ioctl(fd, CDR100_FIXATION, cdrom); #else /* def _AIX */ #ifdef USE_DSLIB ! (void) fixation(dsp, cdrom); #else /* def USE_DSLIB */ fixation(fd, &reply_len, &reply, cdrom); #endif /* def USE_DSLIB */ --- 2715,2721 ---- (void) ioctl(fd, CDR100_FIXATION, cdrom); #else /* def _AIX */ #ifdef USE_DSLIB ! (void) fixation(dsp, cdrom); #else /* def USE_DSLIB */ fixation(fd, &reply_len, &reply, cdrom); #endif /* def USE_DSLIB */ *************** *** 2158,2164 **** #endif /* def _AIX */ #ifndef _AIX ! if (cdwriter_type != type_yamaha) { /* Possibly unneeded, but doesn't hurt */ #ifdef USE_DSLIB --- 2722,2728 ---- #endif /* def _AIX */ #ifndef _AIX ! if (cdwriter_type != type_yamaha && cdwriter_type != type_teac) { /* Possibly unneeded, but doesn't hurt */ #ifdef USE_DSLIB *** Makefile.sgi Tue Feb 11 15:26:26 1997 --- Makefile Tue Feb 11 15:26:40 1997 *************** *** 1,7 **** PROGS= cdwrite isosize LINTFLAGS= -m -x LDLIBS= -lds ! CFLAGS= -O -DUSE_DSLIB -DUSE_AIO -DDEFAULT_DEV=\"/dev/scsi/sc1d3l0\" LDFLAGS= -s BINDIR= /usr/local/bin MANDIR= /usr/local/man --- 1,7 ---- PROGS= cdwrite isosize LINTFLAGS= -m -x LDLIBS= -lds ! CFLAGS= -O -DUSE_DSLIB -DDEFAULT_DEV=\"/dev/scsi/sc1d3l0\" #-DUSE_AIO LDFLAGS= -s BINDIR= /usr/local/bin MANDIR= /usr/local/man