[fpc-pascal] USB Human Interface Devices

Brian vmst at golden.net
Thu Aug 29 16:39:05 CEST 2019


A few general thoughts. Having been in similar situations when dealing with
hardware interfaces .. the hardware is what it is .. and annoying as it is
you have to work around it , as the hardware isn't going to change.

It seems you have two problems 1) the USB hardware and 2) your program , in
which you are not certain if it is doing something wrong .. been there many
times.

Sometimes it helps to make a simulator program which simulates (how you
think the hardware is supposed to work) , and use that to shake out the bugs
in your software. It is a lot of extra work but sometime there is no
alternative. For example use a 2nd PC and an Ethernet UDP connection to test
your software concept.

Also rather than using critical sections , use syncobs to ensure that you
are not trying to read and write to the same USB address or your data
memory.

https://www.freepascal.org/docs-html/current/fcl/syncobjs/teventobject.html

Most guys/gals when writing interrupt handlers tend to use as simple a
mechanism as possible .. from previous bad experiences.

Try testing on Linux as you can run your program in graphics mode ( if that
is what it does) while viewing events by writing write() messages to a
terminal. This occurs if you launch your program from a terminal , then all
writeln() messages go to the text terminal.



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/


More information about the fpc-pascal mailing list