HTFC Forums

H.T.F.C.

How To Fix Computers





Go Back   HTFC Forums > Hardware Newsgroups > Storage > SCSI

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1  
Old 11-09-2007, 07:02 AM
galapogos
 
Posts: n/a
Default How to get a response from a SCSI device when writing to it?

Hi,
I'm trying to communicate to a USB Mass Storage device(UFD) with
vendor specific SCSI pass throughcommands. I'm implementing them on
both sides, since I have control over the device's firmware. Currently
I'm able to write data to the device as well as retrieve data from the
data, using DeviceIOControl, with the DataIn field set to either
SCSI_IOCTL_DATA_IN or SCSI_IOCTL_DATA_OUT.

I'm wondering if there's any way to also retrieve a success/fail value
from the device on a write. I'm able to do this for reads obviously,
but what about writes?

Reply With Quote
Sponsored Links
  #2  
Old 11-09-2007, 01:42 PM
Rob Turk
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

"galapogos" <goister@gmail.com> wrote in message
news:1194591744.214882.230580@z24g2000prh.googlegr oups.com...
> Hi,
> I'm trying to communicate to a USB Mass Storage device(UFD) with
> vendor specific SCSI pass throughcommands. I'm implementing them on
> both sides, since I have control over the device's firmware. Currently
> I'm able to write data to the device as well as retrieve data from the
> data, using DeviceIOControl, with the DataIn field set to either
> SCSI_IOCTL_DATA_IN or SCSI_IOCTL_DATA_OUT.
>
> I'm wondering if there's any way to also retrieve a success/fail value
> from the device on a write. I'm able to do this for reads obviously,
> but what about writes?
>


If you send a SCSI Write command and the write fails then the SCSI command
should end in a Check condition. Your device should then prepare Request
Sense information, as in most cases the host will send a Request Sense
command to find out what went wrong. It's up to you which sense key and
ASC/ASCQ is appropriate for the error condition.

If your device caches the SCSI Write and return Good status as soon as the
SCSI command ends then your device will need to remember that the error
occurred. On the next subsequent command (any but Inquiry and Request Sense)
the device should return Check condition status, and the subsequent Request
Sense information should indicate that this is deferred error information.

Rob


Reply With Quote
  #3  
Old 11-09-2007, 09:14 PM
galapogos
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

On Nov 9, 9:42 pm, "Rob Turk" <wipe_this_r.t...@rtist.nl> wrote:
> "galapogos" <gois...@gmail.com> wrote in message
>
> news:1194591744.214882.230580@z24g2000prh.googlegr oups.com...
>
> > Hi,
> > I'm trying to communicate to a USB Mass Storage device(UFD) with
> > vendor specific SCSI pass throughcommands. I'm implementing them on
> > both sides, since I have control over the device's firmware. Currently
> > I'm able to write data to the device as well as retrieve data from the
> > data, using DeviceIOControl, with the DataIn field set to either
> > SCSI_IOCTL_DATA_IN or SCSI_IOCTL_DATA_OUT.

>
> > I'm wondering if there's any way to also retrieve a success/fail value
> > from the device on a write. I'm able to do this for reads obviously,
> > but what about writes?

>
> If you send a SCSI Write command and the write fails then the SCSI command
> should end in a Check condition. Your device should then prepare Request
> Sense information, as in most cases the host will send a Request Sense
> command to find out what went wrong. It's up to you which sense key and
> ASC/ASCQ is appropriate for the error condition.
>
> If your device caches the SCSI Write and return Good status as soon as the
> SCSI command ends then your device will need to remember that the error
> occurred. On the next subsequent command (any but Inquiry and Request Sense)
> the device should return Check condition status, and the subsequent Request
> Sense information should indicate that this is deferred error information.
>
> Rob


Thanks. This is a different kind of error you're mentioning, but
thanks. What I was referring to was for example a specific vendor
write command that the host sends to the device, such as a password,
and then the device checks if the password is valid, and then returns
a pass/fail. Since the host is sending a "write" command based on the
direction field, is it possible to retrieve a return status message
from the device with the same command?

Reply With Quote
  #4  
Old 11-09-2007, 10:15 PM
Rob Turk
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

"galapogos" <goister@gmail.com> wrote in message
news:1194616550.361578.174060@i13g2000prf.googlegr oups.com...
> On Nov 9, 9:42 pm, "Rob Turk" <wipe_this_r.t...@rtist.nl> wrote:
>> "galapogos" <gois...@gmail.com> wrote in message
>>
>> If you send a SCSI Write command and the write fails then the SCSI
>> command
>> should end in a Check condition. Your device should then prepare Request
>> Sense information, as in most cases the host will send a Request Sense
>> command to find out what went wrong. It's up to you which sense key and
>> ASC/ASCQ is appropriate for the error condition.
>>
>> If your device caches the SCSI Write and return Good status as soon as
>> the
>> SCSI command ends then your device will need to remember that the error
>> occurred. On the next subsequent command (any but Inquiry and Request
>> Sense)
>> the device should return Check condition status, and the subsequent
>> Request
>> Sense information should indicate that this is deferred error
>> information.
>>
>> Rob

>
> Thanks. This is a different kind of error you're mentioning, but
> thanks. What I was referring to was for example a specific vendor
> write command that the host sends to the device, such as a password,
> and then the device checks if the password is valid, and then returns
> a pass/fail. Since the host is sending a "write" command based on the
> direction field, is it possible to retrieve a return status message
> from the device with the same command?
>


Your best bet is to implement this as a Send Diagnostics / Read Diagnostics
Result pair. Don't try to morph a Write command into something it's not
intended for. Use Send Diagnostics to send a password, and Receive
Diagnostics to retrieve the result.

Rob


Reply With Quote
  #5  
Old 11-10-2007, 06:10 PM
galapogos
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

On Nov 10, 6:15 am, "Rob Turk" <wipe_this_r.t...@rtist.nl> wrote:
> "galapogos" <gois...@gmail.com> wrote in message
>
> news:1194616550.361578.174060@i13g2000prf.googlegr oups.com...
>
>
>
> > On Nov 9, 9:42 pm, "Rob Turk" <wipe_this_r.t...@rtist.nl> wrote:
> >> "galapogos" <gois...@gmail.com> wrote in message

>
> >> If you send a SCSI Write command and the write fails then the SCSI
> >> command
> >> should end in a Check condition. Your device should then prepare Request
> >> Sense information, as in most cases the host will send a Request Sense
> >> command to find out what went wrong. It's up to you which sense key and
> >> ASC/ASCQ is appropriate for the error condition.

>
> >> If your device caches the SCSI Write and return Good status as soon as
> >> the
> >> SCSI command ends then your device will need to remember that the error
> >> occurred. On the next subsequent command (any but Inquiry and Request
> >> Sense)
> >> the device should return Check condition status, and the subsequent
> >> Request
> >> Sense information should indicate that this is deferred error
> >> information.

>
> >> Rob

>
> > Thanks. This is a different kind of error you're mentioning, but
> > thanks. What I was referring to was for example a specific vendor
> > write command that the host sends to the device, such as a password,
> > and then the device checks if the password is valid, and then returns
> > a pass/fail. Since the host is sending a "write" command based on the
> > direction field, is it possible to retrieve a return status message
> > from the device with the same command?

>
> Your best bet is to implement this as a Send Diagnostics / Read Diagnostics
> Result pair. Don't try to morph a Write command into something it's not
> intended for. Use Send Diagnostics to send a password, and Receive
> Diagnostics to retrieve the result.
>
> Rob


Thanks. I'm not familiar with send/read diagnostics. Are these SCSI
commands? Can they be called with DeviceIOControl()? I didn't get much
luck with google. Would appreciate some links and/or code examples.

Thanks again!

Reply With Quote
  #6  
Old 11-10-2007, 08:26 PM
Rob Turk
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

"galapogos" <goister@gmail.com> wrote in message
news:1194718228.724173.297380@v23g2000prn.googlegr oups.com...
>> > Thanks. This is a different kind of error you're mentioning, but
>> > thanks. What I was referring to was for example a specific vendor
>> > write command that the host sends to the device, such as a password,
>> > and then the device checks if the password is valid, and then returns
>> > a pass/fail. Since the host is sending a "write" command based on the
>> > direction field, is it possible to retrieve a return status message
>> > from the device with the same command?

>>
>> Your best bet is to implement this as a Send Diagnostics / Read
>> Diagnostics
>> Result pair. Don't try to morph a Write command into something it's not
>> intended for. Use Send Diagnostics to send a password, and Receive
>> Diagnostics to retrieve the result.
>>
>> Rob

>
> Thanks. I'm not familiar with send/read diagnostics. Are these SCSI
> commands? Can they be called with DeviceIOControl()? I didn't get much
> luck with google. Would appreciate some links and/or code examples.
>
> Thanks again!
>


Yes, Send Diagnostics and Receive Diagnostics Result are SCSI commands. It's
best to get a copy of the SCSI standard from www.t10.org as a reference. All
SCSI commands can be issued using SCSI passthrough. Use DeviceIOControl()
with IOCTL_SCSI_PASS_THROUGH_DIRECT or IOCTL_SCSI_PASS_THROUGH. Google for
one of these or for the Microsoft SPTI example. If you need more help than
this, then I think you should contact me off-line for some paid
consultancy...

Rob


Reply With Quote
  #7  
Old 11-12-2007, 11:41 PM
galapogos
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

On Nov 10, 6:15 am, "Rob Turk" <wipe_this_r.t...@rtist.nl> wrote:
> "galapogos" <gois...@gmail.com> wrote in message
>
> news:1194616550.361578.174060@i13g2000prf.googlegr oups.com...
>
>
>
> > On Nov 9, 9:42 pm, "Rob Turk" <wipe_this_r.t...@rtist.nl> wrote:
> >> "galapogos" <gois...@gmail.com> wrote in message

>
> >> If you send a SCSI Write command and the write fails then the SCSI
> >> command
> >> should end in a Check condition. Your device should then prepare Request
> >> Sense information, as in most cases the host will send a Request Sense
> >> command to find out what went wrong. It's up to you which sense key and
> >> ASC/ASCQ is appropriate for the error condition.

>
> >> If your device caches the SCSI Write and return Good status as soon as
> >> the
> >> SCSI command ends then your device will need to remember that the error
> >> occurred. On the next subsequent command (any but Inquiry and Request
> >> Sense)
> >> the device should return Check condition status, and the subsequent
> >> Request
> >> Sense information should indicate that this is deferred error
> >> information.

>
> >> Rob

>
> > Thanks. This is a different kind of error you're mentioning, but
> > thanks. What I was referring to was for example a specific vendor
> > write command that the host sends to the device, such as a password,
> > and then the device checks if the password is valid, and then returns
> > a pass/fail. Since the host is sending a "write" command based on the
> > direction field, is it possible to retrieve a return status message
> > from the device with the same command?

>
> Your best bet is to implement this as a Send Diagnostics / Read Diagnostics
> Result pair. Don't try to morph a Write command into something it's not
> intended for. Use Send Diagnostics to send a password, and Receive
> Diagnostics to retrieve the result.
>
> Rob


Thanks. Any links/code example for this? I tried googling but couldn't
find any SCSI send diagnostics command.

Reply With Quote
  #8  
Old 11-13-2007, 12:01 PM
Michael Baeuerle
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

galapogos wrote:
>
> [...]
> Thanks. Any links/code example for this? I tried googling but couldn't
> find any SCSI send diagnostics command.


Here are the specifications for the commands:
ftp://ftp.t10.org/t10/drafts/spc4/spc4r09.pdf
(Chapter 6.31 and 6.19)


Micha
Reply With Quote
  #9  
Old 11-13-2007, 02:09 PM
galapogos
 
Posts: n/a
Default Re: How to get a response from a SCSI device when writing to it?

On Nov 13, 8:01 pm, Michael Baeuerle <michael.baeue...@stz-e.de>
wrote:
> galapogos wrote:
>
> > [...]
> > Thanks. Any links/code example for this? I tried googling but couldn't
> > find any SCSI send diagnostics command.

>
> Here are the specifications for the commands:ftp://ftp.t10.org/t10/drafts/spc4/spc4r09.pdf
> (Chapter 6.31 and 6.19)
>
> Micha


Thanks Michael, I'll take a look at that.

Reply With Quote
Sponsored Links
Fix your Windows Problems - FAST.
FREE Safe Scan Registry Check. Locate & Fix Errors in Minutes!
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about SCSI device renumeration galapogos SCSI 1 10-27-2007 03:51 AM
SCSI CDB response data structure galapogos SCSI 10 10-22-2007 11:59 AM
AXV CD/DVD-ROM SCSI CdRom Device Joao Vaz Windows XP 0 08-07-2007 01:26 PM
How to create key in \HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port2\ScsiBus 0 ?? sp Windows XP 2 07-29-2007 01:21 AM
Will SCSI HD with OS work with refurbished Dell 670 with SCSI HD and no OS? E. E. Herbert Dell 3 07-09-2007 08:17 PM


All times are GMT. The time now is 01:47 AM.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004 - 2007 Web-S-Sense Pty. Ltd. Usenet and forums posts © their respective authors.
Ad Management by RedTyger