On Sat, 2006-04-01 at 20:18 +0100, Peter Onion wrote:
For devices I much prefer to use open/read/write where you are closer to the device and can get more reliable error indications.
You also probably want to try and open it in non-blocking mode so that the call to open can't block.
Do you mean dio_open dio_write etc ?
I looked at those but they seem to be getting deprecated (No longer available on Unix platforms from PHP5 and only available as an external function on Windows from php5.10) which made me think they weren't the best choice.....I may reconsider if there are no other options.
I was thinking of something like using stream_select in a loop to check the device...but I don't think I can do that until I have a file pointer..which I can't get until I do the fopen which hangs if the device is not responding....hmmm
How about this ? Use system () to create a fifo and link the output to /dev/lp0...I think if I do it with system I can get it to not block...return from system with a true or false...if false then set the fifo to the dump file....then my fwrites etc go to the fifo rather than the dev node...or is that going to far into kludge city :-)