I am unsure if this is the correct place for this question. I am attempting to obtain the axis position values from a joystick /dev/input/js0
on my system. If I run jstest /dev/input/js0
it will give me live feedback on all buttons and axis positions. I am trying to feed this information into my C program to control servos. Is there a function for doing this? I have not worked much with input devices in programming so this is all new to me. Any help is greatly appreciated.
Tell me more
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
migrated from unix.stackexchange.com Apr 16 at 9:09
This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..
This page: http://scaryreasoner.wordpress.com/2008/02/22/programming-joysticks-with-linux/ has a nice writeup on how to read the info from /dev/input/js0 The format of the events you read from the file are documented here: https://www.kernel.org/doc/Documentation/input/input.txt . It's a simple struct containing a timestamp, the event type and identifier and the value:
|
|||
|