PATCH: get modem status (direct io)
| From: | Greg MacLellan | Date: | Wed, 17 Sep 2003 19:11:19 +0000 |
| Subject: | PATCH: get modem status (direct io) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-4515@lists.php.net to get a copy of this message | ||
Quick patch to add a function dio_modemget() to the DirectIO extension.
Does an ioctl(TIOCMGET) to get the status of the modem control lines.
array dio_modemget(fd descriptor)
Returns an array with elements "dsr", "cts", etc equal to 1 or 0.
Example output:
array(6) {
["dsr"]=>
int(0)
["cts"]=>
int(0)
["dcd"]=>
int(0)
["ri"]=>
int(0)
["rts"]=>
int(1)
["dtr"]=>
int(1)
}
I wrote this for a script that checks the status of a UPS (which is
provided on the serial control lines). A test script is also attached.
Btw, this is my first attempt at both working on PHP itself, and
submitting a patch. If anything here is wrong, let me know! :p
ttyl, greg
--
Greg MacLellan