therau2000 wrote:
> On Mon, 2012-10-29 at 01:15 +0100, Peter Stuge wrote:
>> Find out exactly how those commands get sent, and find a method to
>> send them which is outside the USB domain if possible, since that
>> will be both simpler for you to implement *and* will provide a
>> significantly better user experience.
> The "competing program" uses a .dll to communicate with the Device's
> Firmware. By examining that .dll file, I just discovered that it is
> calling "DeviceIoControl" in kernel32.dll. MS documentation about
> "DeviceIoControl" states "An application can use the DeviceIoControl
> function to perform direct input and output operations on, or retrieve
> information about, a floppy disk drive, hard disk drive, tape drive,
> or CD-ROM drive.". Somewhere else I read that "SCSI Pass Through" is
> implemented using "DeviceIoControl" direct (meaning un-buffered).

There are exactly five fundamental I/O operations on Windows (copied
from the original Unix model): open, close, read, write, and ioctl. 
(Linux adds mmap to that list.)  The APIs for those operations happen to
be spelled CreateFile, CloseHandle, ReadFile, WriteFile, and
DeviceIoControl.  DeviceIoControl does not necessarily mean unbuffered. 
It's just the general-purpose way to send requests to a driver.

One key thing to remember here is that SCSI passthrough is a disk
concept, not a USB concept.  The ioctl is sent to disk drivers, not to
USB drivers.  They are at different layers of abstraction.  Even SATA
disk drives accept SCSI passthrough commands.


> So I imagine this is how the "competing program's" .dll communicates
> with the Device's Firmware.
>
> Writing Java and C code using the libusbx API is doable for me; I have
> done it and it does work nicely. But I am afraid that writing code for
> "DeviceIoControl" is beyond my capabilities. So unless someone helps
> in one way or another I am afraid I will have to... give up.

Ioctls are not conceptually difficult.  A read has one buffer.  A write
has one buffer.  An ioctl has a command code and two buffers.  That is
quite literally the only difference between the three operations.

There are examples on the web showing how to open a disk device and send
SCSI passthrough ioctls.  However, just like with USB, you have to know
what you're sending in the passthrough to achieve the results you want. 
You can discover that -- you have to have a reference.  We don't know
what commands the disk firmware expects, and there's no good way to find
out.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to