×
INDI Library v1.8.6 Released (21 Aug 2020)

August 2020 release of INDI Library v1.8.6 introduces new drivers while providing fixes and improvements to existing devices and core framework.

How HID 'drivers' are communicate?

3 months 1 week ago 3 months 1 week ago by msacco.
msacco
Fresh Boarder
Fresh Boarder
Posts: 14
More
Topic Author
How HID 'drivers' are communicate? #55627
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! :)

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

3 months 1 week ago
TallFurryMan
Platinum Boarder
Platinum Boarder
Posts: 900
Karma: 13
More
How HID 'drivers' are communicate? #55634
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

HEQ5-Pro - Atik 314E - Orion ED80T - DMK21 on Orion 50mm
DIY 3D-printed Moonlite and FWheel RGB/LPR
KStars and indiserver on two Atom 1.6GHz 1GB RAM Linux, VPN remote access

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

3 months 1 week ago
jpaana
Gold Boarder
Gold Boarder
Posts: 277
Karma: 6
More
How HID 'drivers' are communicate? #55789
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 :)

Remote observatory running Ubuntu 20.04 x64 with ScopeDome 2M, Skywatcher EQ8, TS 8" RC, Atik 383L+, ASI178MC, ASI120MM-S, SX Lodestar X2, SX USB wheel with OAG, ZWO EAF, Gemini SnapCap, USB_DewPoint, KomaHub
The following user(s) said Thank You TallFurryMan

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

3 months 4 days ago
msacco
Fresh Boarder
Fresh Boarder
Posts: 14
More
Topic Author
How HID 'drivers' are communicate? #55907

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

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

Time to create page: 0.454 seconds