Hello, I am trying to read and output the data from a device connected to my desktop using "/dev/input/js0" (a ps4 controller). I would like to display the data as it is coming in, like how cat /dev/input/js0
does.
This is the code I am using, but it seems to only print out after clicking buttons several times:
(with-open [r (clojure.java.io/input-stream "/dev/input/js0")]
(loop [c (.read r)]
(print c)
(recur (.read r))))
When I use the cat /dev/input/js0 command I can see the output immediately as I click buttons on my controller, which is what I wish to do.
Anyone know how I can get data as it comes in? What am I doing wrong?