[fpc-pascal] USB Human Interface Devices

Jean SUZINEAU Jean.Suzineau at wanadoo.fr
Fri Aug 2 14:12:35 CEST 2019


@Johann: Is the Readme.rst at https://github.com/hansiglaser/pas-libusb 
up to date ?
It states that only the legacy version 0.1 of libusb is supported, but 
the binary package for Windows on libusb.info is in version 1.0.22.
You can get source code for old versions of libusb on github but it 
seems at first glance that there are no release of windows version 
before 1.0.20 (14 sep 2015) ( 
https://github.com/libusb/libusb/releases?after=v1.0.21-rc4 ).

I tried to compile TestFirmware.pas on windows, I made a few 
modifications. I join the diff files.
In ezusb.pas I replaced the dependency to Errors unit by a quick and 
dirty rewrite of StrError function, just to allow compilation.
In paslibusbutils.pas I replace the call to fpGetTimeOfDay by a call to 
DateTimeToUnix(Now),  I'm not sure may be the result of DateTimeToUnix 
is truncated to seconds where fpGetTimeOfDay gives a result in microseconds.
In usb.pas I duplicated some constant definitions from errno.inc 
included in unit BaseUnix: ESysETIMEDOUT, ESysEAGAIN...
I also replaced the call to fpSelect(0,Nil,Nil,Nil,100) by Sleep(100) 
which should do the same thing, waiting for 100 milliseconds.

@James: Now, I just get the two final errors "Import library not found 
for c" and "Import library not found for usb".
For now I haven't found which library to use for c.
I'm preparing another mail for this.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ezusb.diff
Type: text/x-patch
Size: 757 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190802/3318873b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paslibusbutils.diff
Type: text/x-patch
Size: 777 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190802/3318873b/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb.diff
Type: text/x-patch
Size: 1662 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190802/3318873b/attachment-0002.bin>


More information about the fpc-pascal mailing list