2

After reading a little, I am concerned that my 32-bit Delphi application will not be able to use libusb 64-bit driver on Windows 7 and other 64-bit Windows systems, and that it will not be able to talk to my custom hardware device on those systems. Is this true? If yes, is there some workaround? Am I missing something in this picture?

avra
  • 3,671
  • 16
  • 19

3 Answers3

5

What exactly makes you think that it won't? If you have 64-bit driver, it's usable on 64-bit system (given that the driver works fine and is signed properly). Both 32-bit and 64-bit applications can control the driver via various communication mechanisms, such as Ioctl or MMF files. The question is if all parts of the code are written correctly, but this question applies to any library and on any platofrm

Eugene Mayevski 'Callback
  • 43,492
  • 7
  • 62
  • 119
  • My concern is using 64-bit usblib dll from 32-bit application, since I am not sure that other kind of driver access is possible in such situation. That's why I asked for help to possibly save my self from a dead end work. Thank you for your answer. – avra Jan 26 '11 at 10:52
  • 2
    @avra isn't there 32-bit DLL available? If it is, - use it. 32-bit user-mode DLL will communicate with 64-bit driver just fine, if it's written correctly. All of our driver-based products work this way. – Eugene Mayevski 'Callback Jan 26 '11 at 11:19
  • Huh, things got complicated a little in the meantime... It seams that I have to use libusb 0.1 incarnation (libusb-win32) where 32-bit version DLL (libusb0_x86.dll) calls 32-bit libusb0.sys driver, and 64-bit version DLL (libusb0.dll) calls 64-bit libusb0.sys driver. This probably means that calling 32-bit DLL would be useless. I wonder if someone can confirm this. Thank you for your interest in this topic. – avra Jan 26 '11 at 14:26
  • @avra It's a bit strange that 32-bit DLL *requires* 32-bit driver and won't work with 64-bit one. Properly written code should not care about whether the driver is 32-bit or 64-bit. If you have the source code of the library, you can check, what exactly causes this limitation - is it a simple matter of different filenames or the issue is more fundamental – Eugene Mayevski 'Callback Jan 26 '11 at 15:42
4

On libusb 1.0 with the WinUSB backend (Microsoft driver included with windows) we have no problem to communicate with it from an x86 app (Managed c++ library used by C# applications). The behavior is the same on both x86 and x64 platforms.

I don't know about libusb 0.1 (The old one that is able to use the libusb-win32 kernel driver) but as your link point to the 1.0 version you don't seem to use that.

At some point libusb 1.0 will support the libusb-win32 kernel driver but except in specific cases it isn't necessary (WinUSB have some limitations but I never ran into them)

Julien Roncaglia
  • 16,501
  • 3
  • 56
  • 74
  • WinUSB seams to exist only for WinXP SP2 and newer, which is not good since I have to support Win2K and WinXP with SP1 and without any SP. WinUSB can not talk to multiple applications at the same time. This is not a problem for current application but it might be a problem for some future hardware where this is needed, and I don't want to learn things twice. Also, WinUSB does not exist on non Windows operating systems which is not a problem right now, but it will be in the future. All this leads me to plain libusb 1.0, or moving to something like CDC class. Thank you for your answer. – avra Jan 26 '11 at 10:59
  • 1
    As specified in my answer if you use LibUsb 1.0 you are actually using the WinUSB driver as it is the only one the current code support (if your device isn't an HID but in this case except for linux support why do you use libusb ?). And as the link in your question specify "Supported systems are all Windows platforms, starting with Windows XP". – Julien Roncaglia Jan 26 '11 at 11:43
  • 1
    @avra Since there is no 64 bit version of Windows 2000 or indeed XP SP2, why you worrying about 64 bit versions on those platforms? – David Heffernan Jan 26 '11 at 13:22
  • 1
    @David Heffernan : I guess the problem was being sure that the application currently running on win2000 will run the same on x64 versions of say vista. (But it mean that the current version run on 2000 and so that either the device is an HID or libusb 0.1 is used) – Julien Roncaglia Jan 26 '11 at 13:43
  • @virtual what happens when you run this app on x64? Incidentally x64 is vista has been here a long time now. – David Heffernan Jan 26 '11 at 13:49
  • @VirtualBlackFox: Thank you for pointing out that libusb 1.0 acts only as a HID/WinUSB driver. I was not aware of that, and I see now from their web site that "libusb0.sys driver support (from libusb-win32) is planned in a future release". That and a fact that Win2K is not supported mean that I will probably have to use old libusb 0.1 in it's libusb-win32 incarnation (which was recently digitally signed and also supports 64-bit Windows systems). – avra Jan 26 '11 at 14:07
  • @David Heffernan: VirtualBlackFox is right in his comment to your question. My 32-bit app talks to my custom USB hardware via some driver. I handle both app and hardware on my own, and I hope to handle driver too. App should work on all Windows (including Win2K 32-bit), and I would like to have single driver code for all systems. I wouldn't care if 2 driver binaries are produced as long as my 32-bit app can handle them. I do not have a problem with 32-bit app running on any 32-bit windows. My concern is 32-bit app talking to USB device on 64-bit windows. Thank you for your interest. – avra Jan 26 '11 at 14:19
  • @avra sorry, my question to VirtualBlockFox should have been directed at you - I was confused. – David Heffernan Jan 26 '11 at 14:24
2

I use libusb-win32 sucessfully on my Win7 64 Bit laptop with a delphi 32 Bit application. No problems so far. The driver is signed, too (only my .inf file is not).

Note that libusb-win32 uses the "old" libusb API.

Turbo J
  • 7,232
  • 1
  • 20
  • 37