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.
"Dan" == Dan Timis <timis(a)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(a)elektron.ikp.physik.tu-darmstadt.de Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
participants (2)
-
Dan Timis -
Uwe Bonnes