Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-17 Thread Jean SUZINEAU

Le 17/08/2019 à 19:39, James Richters a écrit :

I think maybe it is the calling convention...  First I tried to change 
libusboop.pas (libusb.pas is the old unit, libusboop.pas is the one it uses) to 
stdcall,  I was unable to compile it, I get an error
libusboop.pas(1456,28) Error: Incompatible types: got "" expected ""
libusboop.pas(1726) Fatal: There were 1 errors compiling module, stopping


Yes , this is because extdecl is defined a first time in libusb.pas line 
45 and a second time in libusboop.pas line 21.
If you change it in libusboop, you need to change it accordingly in 
libusb.pas.


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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-16 Thread James Richters
Thanks for the link to the tutorial,  I'll have to look into that!   I have 
kind of a mess of things that runs through this whole sequential list checking 
all these different timings to see what needs to be done.. if all the things 
that required different timings were each in their own thread it would simplify 
things greatly

James

-Original Message-
From: fpc-pascal  On Behalf Of Jean 
SUZINEAU
Sent: Friday, August 16, 2019 1:34 PM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

Le 16/08/2019 à 17:11, James Richters a écrit :
> Can I even do threads in a console program?

Yes, you can.  I have in production some console code (worse: in a dll called 
by a console program written in 4gl (4js Genero www.4js.com)) with threads 
which compile unmodified  under Linux and Windows.

By writing a descendant of TThread it's relatively easy to write a thread in 
FreePascal ( https://wiki.freepascal.org/Multithreaded_Application_Tutorial ).
 From your (non main) thread you can execute a procedure in the main thread by 
calling TThread.Synchronize.

 From what I remember, the main problem in console is that you need to call 
regularly CheckSynchronize() ( from unit Classes ) from your program which run 
the main thread.
That will be simpler for you, in my case, I had  to export from my dll a pascal 
function calling CheckSynchronize() and call it regularly from the 4gl program 
with a timer ...

As far as I remember, it works just with a queue, when you call Synchronize you 
add a function call to the queue, and CheckSynchronize() read the queue and do 
the actual call of your function.





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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-16 Thread Jean SUZINEAU

Le 16/08/2019 à 17:11, James Richters a écrit :

Can I even do threads in a console program?


Yes, you can.  I have in production some console code (worse: in a dll 
called by a console program written in 4gl (4js Genero www.4js.com)) 
with threads which compile unmodified  under Linux and Windows.


By writing a descendant of TThread it's relatively easy to write a 
thread in FreePascal ( 
https://wiki.freepascal.org/Multithreaded_Application_Tutorial ).
From your (non main) thread you can execute a procedure in the main 
thread by calling TThread.Synchronize.


From what I remember, the main problem in console is that you need to 
call regularly CheckSynchronize() ( from unit Classes ) from your 
program which run the main thread.
That will be simpler for you, in my case, I had  to export from my dll a 
pascal function calling CheckSynchronize() and call it regularly from 
the 4gl program with a timer ...


As far as I remember, it works just with a queue, when you call 
Synchronize you add a function call to the queue, and CheckSynchronize() 
read the queue and do the actual call of your function.






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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-16 Thread James Richters
Thank you, it's working with either 64bit or 32bit interchangeably now.

James

>I think you can get it at
>https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z,
>subdirectory MinGW32/dll in the archive
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-16 Thread Jean SUZINEAU

Le 16/08/2019 à 12:23, James Richters a écrit :

Can you tell me where to get libusb_1.0_X86.dll  ?I had the x64 version 
from the sample Jean sent me, but I would like to make my program work on 32bit 
machines as well.
I think you can get it at 
https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z, 
subdirectory MinGW32/dll in the archive

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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-14 Thread James Richters
> Did you try to change your driver with Zadig (https://zadig.akeo.ie/) for 
> your device 10CE:EB93 ?

No, I didn't try that..   but I'm trying it now 
I downloaded Zadig, and used the pulldown and selected devices until I got the 
one with the USB ID  I want.
It filled in as follows:
"USB Input Device"
Driver: HidUSB (v10.0.17763.1)
USB ID: 10CE EB93
WCID has a red X in it

I am not sure what to do from here.   It looks like it has a driver for HidUSB 
and maybe that's what I want because the project at 
https://github.com/prof7bit/HIDAPI.pas has the same functions as the ones I am 
looking to duplicate... but then I don't know, maybe I am mixing up terminology

Anyway, before I go changing drivers.. is there some way to un-do this change?  
I don't see HidUSB in the list of drivers that Zadig can install, so if it 
turns out hat I really wanted HidUSB driver and I changed it to LibUsb then is 
there a way to put it back?

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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-14 Thread Jean SUZINEAU

Le 14/08/2019 à 01:41, James Richters a écrit :

Anyone have any thoughts on all this?


I'm busy for now, but I'll have a look as soon as possible.

Did you try to change your driver with Zadig (https://zadig.akeo.ie/) 
for your device 10CE:EB93 ?


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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-06 Thread Jean SUZINEAU

  
  
Le 06/08/2019 à 17:18, James Richters a
  écrit :


  
  
  
  I used this command line:
I:\Programming\FPC\3.0.4\bin\i386-win32\fpc.exe
  -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Filib\i386-win32\
  -Fu.. -Fu. -FUlib\i386-win32\ -FE. -otest1library.exe
  test1library.pas
  

Usually, if lazarus is installed, you just need to locate and double
click on
I:\Programming\pas-libusb_test_dll\src\examples\test1library.lpi in
Windows Explorer, and when the project is open, just press Ctr F9 to
compile or F9 to execute, just as in the good old Turbo Pascal 5.5
from 1989 ...
  

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


Re: [fpc-pascal] *** SPAM *** Re: USB Human Interface Devices

2019-08-05 Thread Jean SUZINEAU

  
  
Hi James,

Le 05/08/2019 à 13:00, James Richters a
  écrit :


  
  
  
  
Hi Jean, 
 
Thank you
very much for posting the zip, I’ll download it and see if I
can figure it out.  Also thank you very much for your
efforts and help with this.   It is VERY much appreciated!
 

  James

  

With pleasure. It's  a good occasion for me to learn a bit more on
USB.
  

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