Hi Jean! Am Sonntag, den 04.08.2019, 17:20 +0200 schrieb Jean SUZINEAU: > Hi Hansi, > > > > Le 04/08/2019 à 14:05, Johann Glaser a > écrit : > > > > > > Thanks for your effort and please excuse my late reply, I was > > busy thelast few days. > > > > With pleasure. > > test1library.pas from branch > "libusb-1.0" worked nearly out of the box. > > > > I nearly just needed to redefine extdecl from stdcall to cdecl > as > in Linux. > > > > I copied (libusb-1.0.22)\MinGW64\dll\libusb-1.0.dll of 274 Ko > to > (pas-libusb branch libusb-1.0)\src\examples. > > In libusb.pas I removed {$LINKLIB c} and changed {$LINKLIB > usb-1.0} to {$LINKLIB libusb-1.0.dll} > > I join my diff files. Lazarus made a few changes to > test1library.lpi but I don't think they are important.
Amazing, thanks for trying and giving feedback! So, from my perspective, your results and modifications are the same as those of Vitaly at https://github.com/hansiglaser/pas-libusb/issues/4 Referring to your EMail to James, it seems that Vitaly even got it working with static linking. Especially "$LINKLIB msvcrt" and "$LINKLIB usb-1.0.dll.a" look promising. Hmm, OTOH he writes of dynamically linked, I don't know. Could you please also have a look at his comments in that Github issue? > I verified, test1library can be build with this command line: > > C:\lazarus\fpc\3.0.4\bin\x86_64-win64\fpc.exe > -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Filib\x86_64-win64 > -Fu.. > -Fu. -FUlib\x86_64-win64 -FE. -otest1library.exe > test1library.pas > > > > (eventually you need to create > subdirectory lib\x86_64-win64 by hand) > > Upon execution, I got this results: > > :\03_travail\libusb\pas-libusb\src\examples>test1library.exeUsing > libusb(x) v1.0.22.11312Found 13 devices: Bus 1 Device 15: ID > 10C4:EA60, port: 14, port path from HCD: 0, Speed: 12 Mbit/s (USB > FullSpeed) Bus 1 Device 12: ID 28DE:2101, port: 7, port path > from HCD: 0->11->11, Speed: 12 Mbit/s (USB FullSpeed) Bus 1 > Device 0: ID 8086:A2AF, port: 0, Speed: Unknown Bus 1 > Device 10: ID 0BB4:2C87, port: 5, port path from HCD: 0->5->5, > Speed: 12 Mbit/s (USB FullSpeed) Bus 1 Device 9: ID > 0BB4:2C87, port: 2, port path from HCD: 0->0->0, Speed: 480 Mbit/s > (USB HighSpeed) Bus 1 Device 4: ID 1C4F:0002, port: 7, port > path from HCD: 0, Speed: 1.5 Mbit/s (USB LowSpeed) Bus 1 > Device 2: ID 046D:C077, port: 8, port path from HCD: 0, Speed: > 1.5 Mbit/s (USB LowSpeed) Bus 1 Device 8: ID > 28DE:2000, port: 1, port path from HCD: 0->1->1, Speed: 12 Mbit/s > (USB FullSpeed) Bus 1 Device 7: ID 0BB4:0306, port: 2, port > path from HCD: 0->33, Speed: 12 Mbit/s (USB FullSpeed) Bus 1 > Device 11: ID 28DE:2101, port: 6, port path from HCD: 0->128- > >128, Speed: 12 Mbit/s (USB FullSpeed) Bus 1 Device 5: ID > 07CA:A110, port: 5, port path from HCD: 0, Speed: 480 Mbit/s (USB > HighSpeed) Bus 1 Device 6: ID 0BB4:2134, port: 1, port path > from HCD: 0->0, Speed: 480 Mbit/s (USB HighSpeed) Bus 1 > Device 1: ID 0BB4:2210, port: 11, port path from HCD: 0, Speed: > 480 Mbit/s (USB HighSpeed) > E:\03_travail\libusb\pas-libusb\src\examples> Yay! That looks great! As a next step you can try test2controlsync.pas which uses control transfers to query the device descriptors. Just change the constants DevVID and DevPID at the top to the values of a device connected to your PC. I'd recommend to use a device you don't depend on during testing, i.e., don't use your primary keyboard and mouse. :-) There shouldn't be a problem, but better safe than sorry. And I hope that Windows doesn't cross your plans and already has allocated that device to a certain driver. You can also try test3controlasync.pas, which does a very similar test, just using the asynchronous interface to libusb (and it is less verbose and estensive). For trying real custom communication (e.g., to bulk endpoints) you would need an appropriate USB device. For example at https://github.com/hansiglaser/pas-gpib/blob/master/usb/usbtmc.pas I've implemented communication with electrical measurement devices (GPIB via USB). Somewhere on my harddisk I should have a driver for a barcode reader. And also drivers for a few devices built by myself. If you are interested or have questions, I can provide some sources too. Bye Hansi
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal