<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="text-align:left; direction:ltr;"><div>Hi Jean!</div><div><br></div><div>Am Sonntag, den 04.08.2019, 17:20 +0200 schrieb Jean SUZINEAU:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div class="moz-cite-prefix">Hi Hansi,<br>
</div>
<div class="moz-cite-prefix">Le 04/08/2019 à 14:05, Johann Glaser a
écrit :<br>
</div>
<blockquote type="cite" cite="mid:6b4bb7ee6879908ef93e89e6b705b0317dca06af.camel@gmx.at" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<pre>Thanks for your effort and please excuse my late reply, I was busy the</pre><pre>last few days.</pre>
</blockquote>
<p>With pleasure.</p>
<p class="moz-quote-pre" wrap="">test1library.pas from branch
"libusb-1.0" worked nearly out of the box.<br>
<br>
I nearly just needed to redefine extdecl from stdcall to cdecl as
in Linux. <br>
<br>
I copied (libusb-1.0.22)\MinGW64\dll\libusb-1.0.dll of 274 Ko to
(pas-libusb branch libusb-1.0)\src\examples.<br>
In libusb.pas I removed {$LINKLIB c} and changed {$LINKLIB
usb-1.0} to {$LINKLIB libusb-1.0.dll}<br>
I join my diff files. Lazarus made a few changes to
test1library.lpi but I don't think they are important.<br></p></blockquote><div><br></div><div>Amazing, thanks for trying and giving feedback!</div><div><br></div><div>So, from my perspective, your results and modifications are the same as those of Vitaly at</div><div> <a href="https://github.com/hansiglaser/pas-libusb/issues/4">https://github.com/hansiglaser/pas-libusb/issues/4</a></div><div><br></div><div>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.</div><div><br></div><div>Could you please also have a look at his comments in that Github issue?</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><p class="moz-quote-pre" wrap="">
I verified, test1library can be build with this command line:</p>
<p class="moz-quote-pre" wrap="">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<br>
</p>
<p class="moz-quote-pre" wrap="">(eventually you need to create
subdirectory lib\x86_64-win64 by hand)</p>
<p class="moz-quote-pre" wrap="">Upon execution, I got this results:</p>
<pre>:\03_travail\libusb\pas-libusb\src\examples>test1library.exe</pre><pre>Using libusb(x) v1.0.22.11312</pre><pre>Found 13 devices:</pre><pre> Bus 1 Device 15: ID 10C4:EA60, port: 14, port path from HCD: 0, Speed: 12 Mbit/s (USB FullSpeed)</pre><pre> Bus 1 Device 12: ID 28DE:2101, port: 7, port path from HCD: 0->11->11, Speed: 12 Mbit/s (USB FullSpeed)</pre><pre> Bus 1 Device 0: ID 8086:A2AF, port: 0, Speed: Unknown</pre><pre> Bus 1 Device 10: ID 0BB4:2C87, port: 5, port path from HCD: 0->5->5, Speed: 12 Mbit/s (USB FullSpeed)</pre><pre> Bus 1 Device 9: ID 0BB4:2C87, port: 2, port path from HCD: 0->0->0, Speed: 480 Mbit/s (USB HighSpeed)</pre><pre> Bus 1 Device 4: ID 1C4F:0002, port: 7, port path from HCD: 0, Speed: 1.5 Mbit/s (USB LowSpeed)</pre><pre> Bus 1 Device 2: ID 046D:C077, port: 8, port path from HCD: 0, Speed: 1.5 Mbit/s (USB LowSpeed)</pre><pre> Bus 1 Device 8: ID 28DE:2000, port: 1, port path from HCD: 0->1->1, Speed: 12 Mbit/s (USB FullSpeed)</pre><pre> Bus 1 Device 7: ID 0BB4:0306, port: 2, port path from HCD: 0->33, Speed: 12 Mbit/s (USB FullSpeed)</pre><pre> Bus 1 Device 11: ID 28DE:2101, port: 6, port path from HCD: 0->128->128, Speed: 12 Mbit/s (USB FullSpeed)</pre><pre> Bus 1 Device 5: ID 07CA:A110, port: 5, port path from HCD: 0, Speed: 480 Mbit/s (USB HighSpeed)</pre><pre> Bus 1 Device 6: ID 0BB4:2134, port: 1, port path from HCD: 0->0, Speed: 480 Mbit/s (USB HighSpeed)</pre><pre> Bus 1 Device 1: ID 0BB4:2210, port: 11, port path from HCD: 0, Speed: 480 Mbit/s (USB HighSpeed)</pre><pre><br></pre><pre>E:\03_travail\libusb\pas-libusb\src\examples></pre></blockquote><div><br></div><div>Yay! That looks great!</div><div><br></div><div>As a next step you can try <font face="monospace" size="3">test2controlsync.pas</font> which uses control transfers to query the device descriptors. Just change the constants <font face="monospace" size="3">DevVID</font> and <font face="monospace" size="3">DevPID</font> 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. <img src="cid:5db4463bd8e2c803add08b5c6e82232684a35c67.camel@gmx.at" alt=":-)"> 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.</div><div><br></div><div>You can also try <font face="monospace" size="3">test3controlasync.pas</font>, which does a very similar test, just using the asynchronous interface to libusb (and it is less verbose and estensive).</div><div><br></div><div>For trying real custom communication (e.g., to bulk endpoints) you would need an appropriate USB device. For example at</div><div> <a href="https://github.com/hansiglaser/pas-gpib/blob/master/usb/usbtmc.pas">https://github.com/hansiglaser/pas-gpib/blob/master/usb/usbtmc.pas</a></div><div>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.</div><div><br></div><div>Bye</div><div> Hansi</div><div><br></div></body></html>