So I have a device than transmits integers at a set frame-rate (10 fps or something). It connects via a usb cable to my linux machine (ubuntu 20.04) where it is recognized as ttyACM0. I can cat this dev and see the input being received.
However, what I want to do is write a function/script, either in c or bash, which polls the device. So ideally 99% of the time, it would go and read if any new input has been received. If not, return nothing, however if you poll and one of the frame-integers has been received return that.
What would be the best way to go about this? Would an event-driven approach be better / more accurate, so have something trigger a callback whenever a frame is received or something?