On Thu, May 06, 2010 at 05:45:28PM +0200, manner.moe@gmx.de wrote: > >wodim shows the exact same problem on Debian (in certain ?) > >configurations. So, what are we gonna do now? I will check whether I > >can get himdformat.c working on MacOS. If I cannot, we should probably > >drop cdrkit/libusal in favor of cdrtools/libscg. The first one seems > >to have alot of bugs at the moment :(. > > >Adrian > > Hmm, O.K. wodim -scanbus works fine on windows. If we will use > libscg/cdrecord instead we have to fix win32 version of libscg to > work with driveletteters the way as libusal does. > I´ll test libscg on windows soon (build process is a bit complicated using > smake with MinGW). I already patched himdformat.c to work with cdrtools/libscg instead of cdrkit/libusal, however, I still can't get it to compile. The build system of cdrtools is quite sophisticated. I contacted the upstream author of cdrtools (Joerg Schilling) for help and he advised me the following (translating his answer from German): --------------------------------------------------------------------- Compiling by using SSPM (Slottable Source Plugin Modul) system should work always: touch TARGETS/55meinprogramm mkdir meinprogramm cp ../muster/Makefile . edit Makefile .... anpassen Those files can be added to a tar archive and can be added later to cdrtools so that "make" is going to find your source code later. --------------------------------------------------------------------- I'm attaching my patched version of himdformat.c. To conclude: The forked cdrkit/libusal seems to be easier to compile than the original cdrtools/libscg but the latter seems much better maintained and seems to have less bugs than the wodim fork by Debian. If possible, I suggest that we go with cdrtools/libscg unless we can't get it to build on Windows. Adrian
/* * himdformat command using libscg * use devicename on linux (/dev/sgX) or driveletter on windows (without ":") */ #include <stdio.h> #include <string.h> #include <schily/schily.h> #include <scg/scgcmd.h> #include <scg/scsitransp.h> #define SONY_SPECIFIC_COMMAND 0xC2 #define HIMD_FORMAT 3 #define MAX_DEVICE_LEN 256 #define SCSI_TIMEOUT 20 int main(int argc, char ** argv) { SCSI * scgp = NULL; char command[12]; int err = 0; int ret; char dev[MAX_DEVICE_LEN]; char errstr[80]; char cmdname[] = "himd_format"; struct scg_cmd * scmd; if(argc < 2) { fputs("Please specify the path to the scsi device\n",stderr); return -1; } memset(dev, 0, MAX_DEVICE_LEN); memcpy(dev, argv[1], sizeof(argv[1])); // open scsi driver scgp = scg_open(dev, errstr, sizeof(errstr), 0, NULL); if(!scgp) { fputs("Cannot open scsi driver", stderr); return -2; } if(scgp->addr.scsibus == -2 && scgp->addr.target == -2) // scsi device not found, search by devicename { // this is nessessary on windows when driveletter is used ret = scg__open(scgp, dev); if(!ret) { fprintf(stderr, "Cannot open SCSI device for %d\n", dev); err = -3; goto clean; } } scg_settimeout(scgp, SCSI_TIMEOUT); scgp->cmdname = cmdname; // preparing scsi command scmd = scgp->scmd; memset(scmd, 0, sizeof(struct scg_cmd)); scmd->addr = (caddr_t)0; scmd->size = 0; scmd->cdb_len = sizeof(command); scmd->sense_len = CCS_SENSE_LEN; scmd->flags = SCG_DISRE_ENA; memset(command, 0, 12); command[0] = SONY_SPECIFIC_COMMAND; command[4] = HIMD_FORMAT; memcpy(scmd->cdb.cmd_cdb, command, 12); // sending command if(scg_cmd(scgp) < 0) { fputs("cannot send scsi command", stderr); err = -4; goto clean; } else fprintf(stderr, "scsi command successfully sent"); clean: scg__close(scgp); return err; }