I wonder if HID devices will work at all on Windows the same as they do on 
Linux.   I have not been able to get the HID part of the python code to work on 
windows yet either because the instructions given to install the packages 
needed only apply to Linux...   I also wonder if fundamental differences in 
operating systems is why FPC doesn't already have built in support for HID 
devices... maybe it's just not possible to make it cross platform.

I did a little searching... I came across this:
https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/introduction-to-hid-concepts

it seems maybe you are right and even though I did not install a driver into 
windows for this device, maybe windows just detected it was an HID device and 
attached it, and what I really need to do is access it through windows, not 
directly.. I had to do this with parallel ports.. I can't just read and write 
directly to the parallel port like I used to be able to with DOS,  I have to go 
through windows somehow.. I am using 
http://www.highrez.co.uk/Downloads/InpOut32/ to work with parallel ports with 
Windows.  I think it's a DLL written in C, so I had to write a unit to get it 
to work with FPC... but it does work reliably even though windows shows the 
ports in device manager.  Microsoft seems to be completely against users 
accessing hardware directly as we used to be able to with DOS. 

I wonder if the only way to get FPC to work with HID devices on Windows is to 
do something similar with the windows HID API, and go through windows the only 
way windows will allow me to access these devices.  I've been searching trying 
to find information on this.. I came across the project at:

https://github.com/signal11/hidapi

it states in the readme:

HIDAPI has four back-ends:
        * Windows (using hid.dll)
        * Linux/hidraw (using the Kernel's hidraw driver)
        * Linux/libusb (using libusb-1.0)
        * FreeBSD (using libusb-1.0)
        * Mac (using IOHidManager)

This seems to indicate the libusb-1.0 is what you use for Linux and FreeBSD, 
but not for windows, because if it worked for Windows or Mac, then why bother 
doing it differently for them.  Of course this project is for C, not pascal.... 

So then I was looking for a Pascal way to use hid.dll, and came across this:
https://github.com/prof7bit/HIDAPI.pas/blob/master/hidapi.pas  that looked 
promising because it has functions like Open(), Close(), Write(), Read(), 
SendFeatureReport() etc... but.... that isn't working under windows... 
uggggggg.  

It seems that using this HID device with FPC under windows is going to be 
anything but easy... ugggg   maybe I can solve it with hardware.. I can get a 
raspberry pi, teach my self python, hack the python code to interface with the 
HID device on the Rpi and communicate with my windows 10 FPC program over an 
ethernet port or something stupid like that and hope it's fast enough... boy is 
sure seems stupid to use another complete computer to interface this once 
device to windows... I guess I'll keep trying to come up with a solution.

Anyone have any thoughts on all this?

James


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

Reply via email to