wine / Linux kernel, TWAIN and STI: explained
Damjan Jovanovic
dj015 at yahoo.com
Fri Oct 21 00:49:10 CDT 2005
--- Troy Rollo <wine at troy.rollo.name> wrote:
> On Fri, 21 Oct 2005 12:12, Randall Walls wrote:
>
> > I own a HP scanjet 3570c that has no support under
> SANE, and I would
> > love to get it working. It comes with it's own
> graphics front end
> > program, but I have yet to get it working under
> wine.
A lot of you seem to not understand...
In Windows:
Windows App
|
v
TWAIN
|
v
TWAIN backend (scanner-specific)
|
v
(other vendor-specific components)
|
v
STI (made by Microsoft)
|
v
STI minidriver (made by vendor)
|
v
KERNEL32.DLL (ReadFile, WriteFile, DeviceIoControl)
|
| (user mode)
--+---------------
| (kernel mode)
|
v
USBSCAN.SYS (or SCSISCAN.SYS, infrared, serial etc.
drivers) (made by Microsoft)
|
v
Scanner (made by vendor)
What I got working under Linux (well, only the Windows
app branch, and that only for an app that bypasses
TWAIN) is:
Linux app Windows app
| |
v |
SANE |
| |
v /
SANE-to-TWAIN /
| _____________/
v v
wine TWAIN
|
v
TWAIN backend
|
v
wine STI
|
v
STI minidriver
|
v
wine
|
| (user mode)
-+-----------------
| (kernel mode)
v
windows_usbscan.ko
/dev/USBSCAN...
|
v
Linux USB stack
|
v
Scanner
In more detail:
*Changed CreateFile() to check for \\.\USBSCAN..., and
if so open /dev/USBSCAN... instead of calling
VXD_Open(). Then it does wine_server_fd_to_handle().
*Changed NtDeviceIoControlFile() to check for the
ioctl code 0x8000.... (FILE_DEVICE_USB_SCAN I think)
and if so, instead of calling CDROM_DeviceIoControl(),
it does...
struct wine_packed_ioctl {
LPVOID inputBuffer;
DWORD inputBufferSize;
LPVOID outputBuffer;
DWORD outputBufferSize;
} packed;
packed.inputBuffer = .....;
packed.......
wine_server_handle_to_fd(...);
ioctl(fd, 0x8000...., &packed);
wine_server_release_fd(...);
The kernel module behaves just like USBSCAN.SYS,
reading and writing do raw USB bulk pipe reads and
writes, and the ioctl's mostly do USB control pipe
operations.
And I made a thin little STI.DLL, just the bare
minimum (my scanner driver only uses
IStillImage::GetDeviceList() and
IStillImage::GetDeviceValue()).
Now, back to my original questions: how do I
generalise the kernel module to work with more
scanners (it's currently hardcoded for my scanner)? I
need access to wine's registry / SetupAPI to know
which scanners are installed.
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
More information about the wine-devel
mailing list