Re: Sending SCSI commands in Mac OS X
Re: Sending SCSI commands in Mac OS X
- Subject: Re: Sending SCSI commands in Mac OS X
- From: rohan a <email@hidden>
- Date: Mon, 17 Aug 2009 15:05:15 +0530
Hi,
Thanks a lot for the help. I am now able to send SCSI commands to the
drive (vendor specific too).
However, for sending a SCSI command I need to pass the interface
address. Something like, SCSITaskDeviceInterface ** interface = NULL;
Inquiry ( interface );
EnableEncryption ( interface );
Here the interface is just a pointer and will change frequently.
If I scan the devices every time and then send commands to each device
it would work fine. But what if I need to send commands to a
particular device only and this too without having to re-scan all
devices ?
I cant just store and use "interface" as it would have changed in the
meantime and might be pointing to some other device.
What should I be doing here ?
On Fri, Jul 31, 2009 at 5:23 PM, rohan a<email@hidden> wrote:
> Hi,
> WorkingwithSAM.pdf also states that:
>
> $00 for block storage devices that comply with the SCSI block commands
> specification
> $05 for multimedia devices that comply with the SCSI multimedia
> commands specification
> $07 for magneto-optical devices that comply with the SCSI block
> commands specification
> $0E for reduced block command devices that comply with the SCSI
> reduced block commands specification
>
> Now how do I check if a device falls in a particular category. Is
> there anyway I know that a device is $00,05,07 or 0E ?
>
> Also,
> I see that SCSI commands require SCSITaskDeviceInterface **interface
> ex: void Inquiry(SCSITaskDeviceInterface **interface)
>
> On looking further I see this:
> interface = ( *mmcInterface )->GetSCSITaskDeviceInterface ( mmcInterface );
> But this is only for MMCDevice Interface.
> What about SCSI devices?
>
> Thanks
>
>
>
>
>
> On 7/24/09, email@hidden <email@hidden> wrote:
>>
>> Am 24.07.2009 um 05:55 schrieb Terry Lambert:
>>
>> > Since no one else posted...
>> >
>> > Apparently the last machine I used had your tools installed on, which
>> generated BSD device stubs for my QIC tape drive when I plugged it it. 8-).
>> >
>>
>> Ok. What we are doing with our tools is to create pseudo device files in
>> /etc/UGSdev, e.g. /etc/UGSdev/nst0, which can be passed as remote devices
>> (e.g. 127.0.0.1:/etc/UGSdev/nst0) to command line tools such as tar, xtar,
>> dump/restore, mt, etc., so that our rmt will communicate with the SCSI,
>> FireWire, USB and FibreChannel tape/changer devices. Please take a look at
>> http://www.ugsoft.de/intl/faq.html#xtarntape for more
>> information on that.
>>
>> For those who are interested:
>> The tools esbdump, esbrestore, esbmt, rmt and the smtc tape device "driver"
>> are free to use and are included in ES-Backup
>> http://www.ugsoft.de/intl/esbackup . No registration nor
>> activation keys required to use the shell commands. See included License
>> document. Since no source code is included one won't be able to learn how to
>> do the SCSI programming on OS X, though. In addition to the functionality of
>> the corresponding Unix tools such as the standard dump tape format, our
>> tools offer support for Mac OS X file attributes, resource forks, etc., as
>> well as direct tape positioning during restore which make them usefull for
>> today's large amounts of backup data. Also, these tools are used in our
>> commercial product ES-Backup on Mac OS X Intel and PPC, Solaris SPARC and
>> x86, Linux x86 - but this is off-topic.
>>
>>
>> >
>> > The officially supported interface is SCSITaskDeviceInterface, from a user
>> client. Sorry for the confusion.
>> >
>>
>> I thought I've missed something ;-)
>>
>> Uwe
>>
>>
>> >
>> > Rohan: This means "no, you can not use an ioctl".
>> >
>> > -- Terry
>> >
>> > On Jul 23, 2009, at 7:04 AM, email@hidden wrote:
>> >
>> > > Am 23.07.2009 um 13:26 schrieb Terry Lambert:
>> > >
>> > > > Did you go to <http://developer.apple.com> and read the document "SCSI
>> Architecture Model Device Interface Guide"?
>> > > >
>> > > > It states:
>> > > >
>> > > > "By design, Mac OS X does not allow applications to send SCSI or ATA
>> commands to storage devices unless the application developer also provides
>> an in-kernel device driver that supports the commands."
>> > > >
>> > > > One of the intents if this is to allow the driver to model state for
>> such coomands such that the state if the device is known to the driver at
>> all times.
>> > > >
>> > > > For standard tape devices, you should not need to write your own
>> driver; if you plug the device in, it will show up in /dev,
>> > > >
>> > >
>> > > Never seen a tape drive, neither SCSI, FireWire, USB nor FibreChannel
>> connected to Mac OS X 10.2 up to 10.5 which shows up in /dev. What device
>> filename should I look for?
>> > >
>> > >
>> > > > and you can at least issue reads, writes, and standard commands, such
>> as causing a rewind, via the device file. For non-standard commands, such as
>> you would use to control loading and unloading tapes in a tape robot, etc.,
>> you will need to write an in-kernel driver that knows how to talk to the
>> hardware and subclasses the more generic device (i.e. the IOKit model lets
>> you write only the missing pieces implementing the missing control commands;
>> you don't write a whole driver that implements read/write/etc.).
>> > > >
>> > >
>> > > Instead we use SCSITaskDeviceInterface functions from userland as
>> described in Apple's SCSI Architecture Model Device Interface Guide
>> "WorkingWithSAM.pdf" in order to implement a "SCSI pass-thru" functionality.
>> No additional driver required.
>> > >
>> > >
>> > > Uwe
>> > >
>> > >
>> > >
>> >
>> >
>>
>>
>
>
> On 7/24/09, email@hidden <email@hidden> wrote:
>>
>> Am 24.07.2009 um 05:55 schrieb Terry Lambert:
>>
>> > Since no one else posted...
>> >
>> > Apparently the last machine I used had your tools installed on, which
>> generated BSD device stubs for my QIC tape drive when I plugged it it. 8-).
>> >
>>
>> Ok. What we are doing with our tools is to create pseudo device files in
>> /etc/UGSdev, e.g. /etc/UGSdev/nst0, which can be passed as remote devices
>> (e.g. 127.0.0.1:/etc/UGSdev/nst0) to command line tools such as tar, xtar,
>> dump/restore, mt, etc., so that our rmt will communicate with the SCSI,
>> FireWire, USB and FibreChannel tape/changer devices. Please take a look at
>> http://www.ugsoft.de/intl/faq.html#xtarntape for more
>> information on that.
>>
>> For those who are interested:
>> The tools esbdump, esbrestore, esbmt, rmt and the smtc tape device "driver"
>> are free to use and are included in ES-Backup
>> http://www.ugsoft.de/intl/esbackup . No registration nor
>> activation keys required to use the shell commands. See included License
>> document. Since no source code is included one won't be able to learn how to
>> do the SCSI programming on OS X, though. In addition to the functionality of
>> the corresponding Unix tools such as the standard dump tape format, our
>> tools offer support for Mac OS X file attributes, resource forks, etc., as
>> well as direct tape positioning during restore which make them usefull for
>> today's large amounts of backup data. Also, these tools are used in our
>> commercial product ES-Backup on Mac OS X Intel and PPC, Solaris SPARC and
>> x86, Linux x86 - but this is off-topic.
>>
>>
>> >
>> > The officially supported interface is SCSITaskDeviceInterface, from a user
>> client. Sorry for the confusion.
>> >
>>
>> I thought I've missed something ;-)
>>
>> Uwe
>>
>>
>> >
>> > Rohan: This means "no, you can not use an ioctl".
>> >
>> > -- Terry
>> >
>> > On Jul 23, 2009, at 7:04 AM, email@hidden wrote:
>> >
>> > > Am 23.07.2009 um 13:26 schrieb Terry Lambert:
>> > >
>> > > > Did you go to <http://developer.apple.com> and read the document "SCSI
>> Architecture Model Device Interface Guide"?
>> > > >
>> > > > It states:
>> > > >
>> > > > "By design, Mac OS X does not allow applications to send SCSI or ATA
>> commands to storage devices unless the application developer also provides
>> an in-kernel device driver that supports the commands."
>> > > >
>> > > > One of the intents if this is to allow the driver to model state for
>> such coomands such that the state if the device is known to the driver at
>> all times.
>> > > >
>> > > > For standard tape devices, you should not need to write your own
>> driver; if you plug the device in, it will show up in /dev,
>> > > >
>> > >
>> > > Never seen a tape drive, neither SCSI, FireWire, USB nor FibreChannel
>> connected to Mac OS X 10.2 up to 10.5 which shows up in /dev. What device
>> filename should I look for?
>> > >
>> > >
>> > > > and you can at least issue reads, writes, and standard commands, such
>> as causing a rewind, via the device file. For non-standard commands, such as
>> you would use to control loading and unloading tapes in a tape robot, etc.,
>> you will need to write an in-kernel driver that knows how to talk to the
>> hardware and subclasses the more generic device (i.e. the IOKit model lets
>> you write only the missing pieces implementing the missing control commands;
>> you don't write a whole driver that implements read/write/etc.).
>> > > >
>> > >
>> > > Instead we use SCSITaskDeviceInterface functions from userland as
>> described in Apple's SCSI Architecture Model Device Interface Guide
>> "WorkingWithSAM.pdf" in order to implement a "SCSI pass-thru" functionality.
>> No additional driver required.
>> > >
>> > >
>> > > Uwe
>> > >
>> > >
>> > >
>> >
>> >
>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden