I'm trying to read some serial data from an Arduino device on a usb serial port, /dev/ttyUSB0 to be exact.
The problem is, when the arduino senses loss of serial communication, it resets. A good feature in some situations. To overcome this I am using cat to redirect all serial communication to a FIFO.
cat /dev/ttyUSB0 > serialBuffer
I made it run in the background with nohup.
Now, how can I get PHP to read the data from that fifo? I've tried opening it like a file, but PHP doesn't seem to like that. I have no problem writing to the usb port. The problem is, I need to send a request for data to the arduino. Then read the data back from the serial port. I need PHP to wait for a full line, then continue on. Is there a simple way to get PHP to open a fifo and load up a string until a newline character is read?