I am working on an application that runs a few tasks in the main loop, but has to be sensitive to inputs from an USB joystick
I have come across Intel Edison codes (https://software.intel.com/sites/default/files/managed/7e/79/maker-garage-joystick-guide.pdf https://software.intel.com/sites/default/files/managed/7e/79/maker-garage-joystick-guide.pdf ) where the Joystick is read using polling.
I have come across Intel Edison codes wherein the GPIO is read using interrupts.
Is there a way to respond/ read the inputs from an USB joystick (or any USB device) using interrupt or a non-thread-blocking way. Any pointers/ resources would be welcome!
I haven't tried this on Edison, but normally when you plug a USB joystick into a linux machine, a node is created at /dev/js1 (or similar) and then you can use normal "read" code to read events from the joystick.
You could put the read loop in a separate thread and post callbacks to your main thread.
Thanks for your interest in the Intel® Edison™ Platform.
Unfortunately, there isn't a guide explaining how to use interrupts with a Joystick. Nevertheless, I did some research on my own and I found this video https://software.intel.com/en-us/videos/episode-8-using-a-joystick-with-intel-edison-technology Episode 8 | Using a Joystick with Intel® Edison Technology | Intel® Software that shows how to set up a joystick with the Intel® Edison.
Maybe you can use this video and the suggestion provided by SpiderKenny as reference in order to achieve your project goals.
Hope you find this information useful, have a nice day!