msacco replied to the topic 'How HID 'drivers' are communicate?' in the forum. 4 years ago

TallFurryMan wrote: 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

jpaana wrote: 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 :)


Thanks for the comments :)

Read More...