dio_read question
Posted: Wed Jan 10, 2007 10:20 pm
feyd | Please use
Machine is running PHP 4.3 on an Apache server. I know the write request is working, as I monitored the serial data and saw it send controls to the device. However, the returned value ($val) is always an empty string. Running 'minicom' and sending the same string always returns a proper value. Also, just for testing, I ran minicom and tried the same code - without the 'dio_read' portion. I sent the data to the device and minicom showed the proper status on the return.
Any ideas as to why dio_read is always blank? I tried removing the control and blocking options from the dio_open (just keeping the O_RDWR option) and that didn't change anything.
Eddie
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm building a web page that will access a serial port to read and write data to a commercial product. I need to send queries out to the unit and it will return status information. Here's the code snippet I've used:Code: Select all
$fd = dio_open("/dev/ttyS1", O_RDWR | O_NOCTTY | O_NONBLOCK); // open the port
dio_write($fd, "Q00"); // query port 00
$val = dio_read($fd); // put the value into $varAny ideas as to why dio_read is always blank? I tried removing the control and blocking options from the dio_open (just keeping the O_RDWR option) and that didn't change anything.
Eddie
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]