[fpc-pascal] USB Human Interface Devices
Johann Glaser
Johann.Glaser at gmx.at
Wed Aug 21 21:56:59 CEST 2019
Hi!
Am Montag, den 19.08.2019, 18:22 -0400 schrieb James Richters:
> Oh, for some reason I wasn't thinking I was replacing mydevice.pas
> with snapi.pas... Ok.. so if
> I understand this correctly, make the changes necessary in snapi.pas
> to use libusboop.pas instead of the old usb.pas, and then use
> TSNAPIDevice.Create to create a TLIBUSBPseudoHIDInterface to my
> device? ... and that will allow me a more generic method to access
> the device?
Hmm, no. You should make your own unit for your device, from scratch.
And then use snapi.pas as a guide how to do that. As I've written in my
previous EMail:
--- schnipp ---
You really should create your own class descending from TLibUsbDevice
(instead of TLibUsbDeviceWithFirmware).
In your constructor, you have to get a reference to the HID interface
of your device, e.g., by
TLibUsbPseudoHIDInterface.Create(...)
analogous to
https://github.com/Zaaphod/pas-libusb/blob/Hack/src/examples/mydevice.pas#L141
.
This internally also gets references to the necessary endpoints,
therefore you most probably don't need manual FInterface.FindEndpoint()
(like TMyDevice).
--- schnapp ---
But please pay attention to the new methods, parameters, ...
Bye
Hansi
More information about the fpc-pascal
mailing list