>Betreff : Re: [linux-minidisc] another way to send SCSI commands >Gesendet: 04.12.2010 14:38:54 >An : "Thomas Arp <manner.moe@gmx.de>" >Von: "Adrian Glaubitz <glaubitz@physik.fu-berlin.de>" >----- Originale Nachricht ----- >Hi, >On Dec 4, 2010, at 2:33 PM, Thomas Arp wrote: >>>> Thanks a lot for investigating into that. I would very glad if we can >>>> drop libscg in favor of dvd+rw-tools. >>> I did not yet implement the suggested change, but I am quite confident >>> that it will work. >> >> I´m rewriting himdscsitest.c using the dvd-rw-tools headers for testing. >> As far as i have tested yet when cmd.transport() has finished the Scsi_Command structure will be closed automatically. >> If we want to send more commands we have to use cmd.associate(char * device) before sending another scsi command. >> >> Should we disable this autoclose feature and use genaral open and close commands instead or should every send-command function have it´s own Scsi_Command structure, so that we only need to give the devicename as parameter instead of a Scsi_Command structure? >What do you mean by disabling the feature? If I understood correctly, one can use cmd.associate() instead of >cmd.transport() to send subsequent commands to the device. If that's the case, then I'd opt for the cmd.associate() >version. >Or are you talking about changing some code in the dvd+rw tools? >Adrian cmd.associate() opens a file handle to the given device name (at least on windows), this is to check if the devicename is valid scsi device. Then we can setup the cdb and send it with cmd.transport(). If cmd.transport() has finished the handle will be closed automatically. I think we should leave it as it is and every send-scsi-command function should call cmd.associate() first to check if the device is connected right before sending the command. If we make general open/close commands it could cause errors if the device is unplugged between opening the device and sending a scsi command. I will send my code of the test tool later, i have to rearrange it first. Thomas