×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

How HID 'drivers' are communicate?

  • Posts: 15
  • Thank you received: 0
Hey, generally it's not a specific indi related question, but I believe asking here could be very knowledgeable.

So I'm wondering how HID drivers perform the connection to the platform(indi/ascom). Since HID is pretty much a native driver, there needs to be some way to determine that something has connected, and that it is actually the correct thing.
I've looked it up a bit on ASCOM, but didn't see any support for HID drivers, so I was wondering if for every HID device the "additional drivers" that comes with it for either ascom or indi needs to handle the connection between the platform and the device? Also, does it 'convert' the connection itself to be compatible with serial connection in a way?

Would love to get some input on how HID devices communicate and works with indi/ascom, sorry if I was talking nonsense.

Thanks a lot for the help! :)
Last edit: 3 years 10 months ago by msacco.
3 years 10 months ago #55627

Please Log in or Create an account to join the conversation.

  • Posts: 1029
  • Thank you received: 301
Linux HID communication is done from user space by reading and writing to the /dev device. There's a sample from a knowledgeable person at github.com/torvalds/linux/blob/master/sa...hidraw/hid-example.c.

The hidapi library is another way to go, check github.com/signal11/hidapi/blob/master/hidtest/hidtest.cpp.

Look up the hidapi support files in the indilib/indi repository, folder libs/indibase.



-Eric
3 years 10 months ago #55634

Please Log in or Create an account to join the conversation.

  • Posts: 474
  • Thank you received: 168
INDI uses hidapi library which is layered on top of libusb so it works pretty much everywhere now, even Windows. There is a fairly clear basic example in the SX wheel driver (github.com/indilib/indi-3rdparty/blob/ma.../indi-sx/sxwheel.cpp) First you connect to the device with hid_open() which takes the vendor and device ids as parameters (which identify the device) to get a handle and then send data to the device with hid_write() and read responses back with hid_read() with that handle and eventually close the connection with hid_close(). So the basic communication is very easy from user point of view, devil is in the details what to write and read :)
The following user(s) said Thank You: Eric
3 years 10 months ago #55789

Please Log in or Create an account to join the conversation.

  • Posts: 15
  • Thank you received: 0

Thanks for the comments :)
3 years 9 months ago #55907

Please Log in or Create an account to join the conversation.

Time to create page: 0.531 seconds