[fpc-pascal] USB Human Interface Devices
James Richters
james at productionautomation.net
Fri Aug 16 02:28:12 CEST 2019
Thanks for posting the examples and the information. I'll have a look... I am thinking maybe I should buy some of those USB relays or something simpler just to get SOMETHNG to work so I can figure out what's supposed to even be happening.
James
-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of Stefan V. Pantazi
Sent: Thursday, August 15, 2019 5:31 PM
To: fpc-pascal at lists.freepascal.org
Subject: Re: [fpc-pascal] USB Human Interface Devices
Hi James,
I remember going through many similar difficulties with HID. A few years ago I was trying to connect to much simpler devices than yours (game controllers, weather station base, graphic tablet, etc). USB programming is confusing and many abstraction layers have been created aiming at simplifying it. Unfortunately this introduces dependencies. I remember trying to port hidapi headers to Pascal and tried to use the hidraw backend (in linux) with mixed results. Also tried the libhid cross-platform library. In the end I went with libusb 1.0 for which a Pascal header already existed
(https://forum.lazarus.freepascal.org/index.php?topic=11435.0) and used it to implement on top of it a subset of the HID API calls that suited my needs and kept things simple. I just posted an example on github:
https://github.com/svpantazi/libusbxhid
Hope it helps.
In theory you could use the Windows HID API but, as others have suggested, the solution would not be cross platform, or, to put it another way, Windows HID API would become your dependency. My suggestion is also to go the libusb 1.0 route and use a Pascal HID library that depends only on libusb 1.0. Your device appears to be HID-compliant so no additional drivers should be needed for it. As far as I know, the Zadig generic driver is necessary only for non-HID devices. I remember using it for a rtl-sdr USB device on Windows.
Hope you find your solution. Good luck.
On 8/15/19 9:11 AM, James Richters wrote:
> Yes, in device manager I see it listed as "HID-compliant
> vendor-defined device" also Zadig identifies it as "USB Input Device"
> and it shows Driver: HidUsb (v10.1.17763.1)
>
> Is there a way to use the windows system HID interface with FPC already in place as there is for other windows APIs?
>
> James
>
> -----Original Message-----
> From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf
> Of José Mejuto
> Sent: Thursday, August 15, 2019 8:34 AM
> To: fpc-pascal at lists.freepascal.org
> Subject: Re: [fpc-pascal] USB Human Interface Devices
>
> El 14/08/2019 a las 16:29, James Richters escribió:
>
>> I'll have a look at your project.. maybe it will give me some clues.
>> Can you tell me how to get hid.dll? I find it all very confusing, can I just download the dll somewhere or do I have to get this huge confusing package and built it myself? The sample code that is able to access my device with python on Linux uses hid.dll I would like to at least be able to try the hid.dll... if I can get hid.dll somewhere.
>
> Hello,
>
> hid.dll is the windows system HID interface, the API provided by Windows.
>
>>> In the other hand, the hardware you are trying to manage is 10CE:EB93 ?
>> Yes, I got a listing of all devices, then I plugged in the new one, and that is the ID that was not there before.
>>> If the answer is yes, that device is *not* HID compatible so you can
>>> not use hid.dll for native access, you must use WinUSB API set, or
>>> the
>>> libusb-1.0 abstraction layer.
>> I'm curious how you can tell that by looking at the number of it?
>
> No, I just look for the product and try to find its drivers, no one name the HID interface. Do you see the device in windows device manager under the HID section "Human Interface Devices (HID)" ?
>
>
--
_______________________________________________________
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list