Adding support for a USB device
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Tue Dec 9 17:39:41 CST 2003
>>>>> "Dan" == Dan Timis <timis at museresearch.com> writes:
Dan> Hi, I need help with supporting a particular USB device under wine.
Dan> I have to start by saying that although I am an experienced C/C++
Dan> programmer with some Linux experience, I have almost no Windows or
Dan> wine experience.
Dan> The Windows code for which I need to provide support uses
Dan> CreateFile() to get a handle to the device. The name of the device
Dan> is something like "\\.\MyDevice0" "\\.\MyDevice1" and so on. Then,
Dan> the code uses DeviceIoControl() to read and write from/to the
Dan> device. The requirement is not to change the windows code.
Probably MyDevice is read from the registry or retrieved in some way from
setupapi.dll
Dan> I looked through the wine code and I found this in device.c:
Dan> static const struct VxDInfo VxDList[]
Dan> I could add another entry into the table and write a deviceio
Dan> handler (BOOL (*deviceio)(DWORD, LPVOID, DWORD, LPVOID, DWORD,
Dan> LPDWORD, LPOVERLAPPED);). I wrote some test code in Linux using
Dan> libusb reading and writing to the device so I know what to do
Dan> inside the deviceio handler.
Dan> Is this the right approach? If so, what do I need to do to get
Dan> CreateFile to return the right handle?
The approach looks right to me.
Try first to fake the device name retrival by perhaps hardcoding an access
to /proc/bus/usb/...
VxD registration needs to be implemented in a MS like way however at some
point.
Dan> Or should I write an external driver that gets loaded by wine? If
Dan> so, how would I do that? What are the chances that the Windows
Dan> driver for this device would just work with wine?
This would require some code changes as you win program needs to access the
driver.
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the wine-devel
mailing list