Recent

Author Topic: libhid on Linux  (Read 3137 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
libhid on Linux
« on: February 14, 2019, 11:15:25 am »
I've written a graphical program for setting up a Logitech G600 mouse which I'll publish as soon as I'm able. It had minimal reliance on USB device parsing etc. so I transcribed some of the libusb/libhid stuff to reduce library dependencies.

Looking at the APIs in more detail, it looks as though there's some nasties in data structures etc., particularly on x86_64, which makes it worth using the precompiled library when possible.

I know that libusb's done, but does anybody know of a transcription of libhid to Pascal?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Kays

  • Hero Member
  • *****
  • Posts: 575
  • Whasup!?
    • KaiBurghardt.de
Re: libhid on Linux
« Reply #1 on: February 15, 2019, 02:56:22 pm »
This forum has a search function. The results don't satisfy you, do they?
Yours Sincerely
Kai Burghardt

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: libhid on Linux
« Reply #2 on: February 15, 2019, 03:38:34 pm »
I wasn't aware of it. The reason I wasn't aware of it was that for the last 15 years or so I've used the Pascal and Lazarus mailing lists rather than the foramina, on the basis that the people who frequented them were in the habit of answering a simple question with a simple "yes" or "no" >:-)

Thanks for the URL which I'll follow up presently. In practice it appears to be a fairly simple job for h2pas, but I'm sure that I've got some of the details wrong.

MarkMLl
 
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories


MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: libhid on Linux
« Reply #4 on: February 15, 2019, 05:27:19 pm »
Thanks for that as well. I admit to being slightly mortified as to these references now appearing, the only one I'd found before was brief mention by Henry Vermaak in the mailing list dating back to 2010.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: libhid on Linux
« Reply #5 on: February 19, 2019, 11:04:08 am »
To wrap this one up: a transcript of the "official" libhidapi using h2pas was pretty simple, also https://github.com/prof7bit/HIDAPI.pas seems to be functionally equivalent. https://github.com/LongDirtyAnimAlf/FPC-USB-HID is basically a JEDI interface and as such is too far removed from the standard interfaces for what I wanted.

The libhidapi interface can be implemented on Linux either by talking to the kernel's HID interface or by using libusb. The significance of this distinction is that in the former case the kernel may apply "quirks" to recognised devices that- as a particular example- return a broken descriptor, while in the latter case I believe that quirks aren't applied. I wish I'd appreciated that detail a year ago when a colleague had me waste a vast amount of time investigating why his Elecom trackballs weren't working properly (eventually fixed by a kernel patch).
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018