<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">It seems that you can just remove
{$LINKLIB c} in libusb.pas.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">The libusb from libusb.info cannot be
used because the functions it provides are different, and if you
try to recompile a version before 1.0 like 0.9.4, it fails because
Windows target was not yet supported by the library.</div>
<div class="moz-cite-prefix">But on
<a class="moz-txt-link-freetext" href="https://sourceforge.net/projects/libusb-win32/">https://sourceforge.net/projects/libusb-win32/</a> you find a port to
Windows of libusb-0.1 to Windows.</div>
<div class="moz-cite-prefix">I downloaded
libusb-win32-bin-1.2.6.0.zip and extracted it. From the
subdirectory libusb-win32-bin-1.2.6.0\bin\amd64 I copied
libusb0.dll to the directory of TestFirmware.pas.</div>
<div class="moz-cite-prefix">In LibUSB.pas I changed {$LINKLIB usb}
to {$LINKLIB libusb0.dll}.</div>
<div class="moz-cite-prefix">I got a few errors on compilation
because of some changes in libusb.</div>
<div class="moz-cite-prefix">The variables usb_error_errno and
usb_error_type doesn't exist anymore in the library, for now I
just comment them out:<br>
</div>
<div class="moz-cite-prefix">
<pre> usb_error_errno : LongInt; //cvar; external; { from libusb }
usb_error_type : LongInt; //cvar; external; { from libusb }
Two functions are not available any more, I commented them too:
//Function usb_get_driver_np (dev:PUSBDevHandle; TheInterface:Longint; Var name; namelen:LongInt) : Longint; cdecl; external;
//Function usb_detach_kernel_driver_np(dev:PUSBDevHandle; TheInterface:Longint) : LongInt; cdecl; external;
This breaks in USB.pas the function USBGetDriver and the method TUSBInterface.Claim. For now I just made a small modification to comment the calls.
I join the diffs for libusb.pas and usb.pas .
With this modifications, I could compile successfully TestFirmware.pas. On execution I got this error:
E:\03_travail\libusb\test>TestFirmware.exe
Couldn't connect to device: Couldn't find firmware file "firmware.ihx" in search path ".:~/.testfirmware:(my path variable here):/etc/testfirmware". You might try to set the environment variable "TESTFIRMWAREFIRMWAREPATH".
which is normal because I don't have any test case with a firmware file for now.</pre>
</div>
<br>
</body>
</html>