I've made another (unsuccessful) test, using libusb-compat ( https://github.com/libusb/libusb-compat-0.1/wiki ).

It's a compatibility layer which allows to use the new libusb 1.xx through the old API of libusb 0.1

I get nearly the same results as with libusb-win32 (just "Bus: 001" instead "Bus: bus-0"), maybe there's an error in my code.

If you want to test, I've put temporarily a zip of my test directory at http://mars42.com/test_libusb-compat.zip .

I got the dlls  through msys2 in this way:

You can download MSYS2 (http://www.msys2.org/ ) by
http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20190524.exe

After complete installation, to install libusb type on the command line:
 pacman -S mingw64/mingw-w64-x86_64-libusb

and to install libusb-compat type :

 pacman -S mingw64/mingw-w64-x86_64-libusb-compat-git

In subdirectory mingw64\bin of your installation you get:
   libusb-1.0.dll    the libusb dll from https://libusb.info/
   libusb-0-1-4.dll  the libusb-compat dll with version 0.1 functions names, and which call libusb-1.0.dll

I'm not sure of the value of PATH_MAX to define in libusb.pas because  in the dll PATH_MAX is taken from limits.h ( mingw64\x86_64-w64-mingw32\include\limits.h) where it's first defined to PATH_MAX=260 but if _POSIX_ is defined then it's redefined to 512. Of course this can create havoc in the definition of USBDevice if the pointer "bus : PUSBBus;" isn't defined at the right place in memory...

For getting limits.h in subdirectory mingw64\x86_64-w64-mingw32\include , type :
 pacman -S mingw-w64-x86_64-headers-git

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to