Windows STI interface RawReadData, etc

  • Thread starter Thread starter Michael Angelo Ravera
  • Start date Start date
M

Michael Angelo Ravera

Can someone point me to a good source on various vendor-specific
scanner commands using the Windows STI interface?

I am able to use the interface to get a list of devices and, supposedly
to access the devices (of which I have about 4 or 5 connected to my
computer), but whenever I use a (properly bracketed with DeviceLock)
RawReadData call, I either get no data or an error. Does anyone have a
good idea of what I am likely doing wrong? I'll post some code, if it
will help.
 
Hi Michael,

I'm not the best resource for the information you're requesting, but
thought I could help point you in the right direction.

Take a look at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stillimg/sti_8l2r.asp

As far as I know, a single instance of Windows can only capture from
one imaging device at a time. The limitation is an Windows system
limitation (usbscan.sys). There are ways to bypass this limitation
however. For example, if one scanner is a USB scaner and has the
sti-twain driver installed while another scanner is SCSI AND has the
ASPI-Twain driver installed, you can tell windows to ignore the SCSI
device by disabling it in Device Manager and still use both the USB
scanner and the SCSI scanner.

I never tried to capture simultaneous however... I never had a need to.
but, let me know if you'd like me to try that out or if you had
something else entirely in mind...

Hope this helps~

Danny Ha
 
Danny said:
Hi Michael,

I'm not the best resource for the information you're requesting, but
thought I could help point you in the right direction.

Take a look at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stillimg/sti_8l2r.asp

As far as I know, a single instance of Windows can only capture from
one imaging device at a time. The limitation is an Windows system
limitation (usbscan.sys). There are ways to bypass this limitation
however. For example, if one scanner is a USB scaner and has the
sti-twain driver installed while another scanner is SCSI AND has the
ASPI-Twain driver installed, you can tell windows to ignore the SCSI
device by disabling it in Device Manager and still use both the USB
scanner and the SCSI scanner.

I never tried to capture simultaneous however... I never had a need to.
but, let me know if you'd like me to try that out or if you had
something else entirely in mind...

Hope this helps~

I'll see if it does. I'm not really interested in accessing more than
one device at a time. I was just indicating that I was sufficiently
into the the STI interface that I was able to get a list of devices and
that I could create an instance of the device and supposedly lock it
and get status, but could not get the RawReadData to work (on the
scanner, I haven't seen the scanner start to make the scanning noise,
etc).

Thanks. I'll let you know.
 
Hi Michael,

Sorry about the misunderstanding... What's the actual STIERR-prefixed
error code defined in stierr.h?

~Danny Ha
 
Danny said:
Hi Michael,

Sorry about the misunderstanding... What's the actual STIERR-prefixed
error code defined in stierr.h?

I'm getting HRESULT 0 from the scanner, but no data.

I'm getting HRESULT 0x80070015 from the webcam.

Here is a code snippet. "camera" is the GUID of the selected device
(from a dialogue). Before the last IStiDevice_UnLockDevice, either
nrcvd is 0 or h has a value that signifies not ready.

h = StiCreateInstance (GetModuleHandle(NULL), STI_VERSION, & ppSti,
NULL);
h = IStillImage_CreateDevice (ppSti, camera, STI_DEVICE_CREATE_BOTH, &
scanner, NULL);
h = IStiDevice_LockDevice (scanner, 5000);
memset (& DevStatus, 0, sizeof DevStatus);
DevStatus.dwSize = sizeof DevStatus;
DevStatus.StatusMask = STI_DEVSTATUS_ONLINE_STATE |
STI_DEVSTATUS_EVENTS_STATE;
h = IStiDevice_GetStatus (scanner, & DevStatus);
h = IStiDevice_UnLockDevice (scanner);
if (!(huge_buf = (unsigned long *) malloc (nrcvd = 0x100000)))
exit (11);
memset (huge_buf, 'T', nrcvd);
/* h = IStiDevice_DeviceReset (scanner); */
olap.Offset = 0;
olap.OffsetHigh = 0;
olap.hEvent = 0;
h = IStiDevice_LockDevice (scanner, 5000);
h = IStiDevice_RawReadData (scanner, (void *) & huge_buf, &nrcvd, &
olap);
h = IStiDevice_UnLockDevice (scanner);
 
Back
Top