Adding support for a USB device

Dan Timis timis at museresearch.com
Tue Dec 9 16:56:16 CST 2003


Hi,

I need help with supporting a particular USB device under wine.  I have 
to start by saying that although I am an experienced C/C++ programmer 
with some Linux experience, I have almost no Windows or wine experience.

The Windows code for which I need to provide support uses CreateFile() 
to get a handle to the device.  The name of the device is something 
like "\\.\MyDevice0" "\\.\MyDevice1" and so on.  Then, the code uses 
DeviceIoControl() to read and write from/to the device.  The 
requirement is not to change the windows code.

I looked through the wine code and I found this in device.c:

static const struct VxDInfo VxDList[]

I could add another entry into the table and write a deviceio handler 
(BOOL  (*deviceio)(DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD, 
LPOVERLAPPED);).  I wrote some test code in Linux using libusb reading 
and writing to the device so I know what to do inside the deviceio 
handler.

Is this the right approach?  If so, what do I need to do to get 
CreateFile to return the right handle?

Or should I write an external driver that gets loaded by wine?  If so, 
how would I do that?  What are the chances that the Windows driver for 
this device would just work with wine?

Thanks,

Dan Timis
Muse Research, Inc.




More information about the wine-devel mailing list