# PATCH: get modem status (direct io)

- Thread: https://externals.io/message/4515
- Original archive: https://news-web.php.net/php.internals/4515
- Started by Greg MacLellan on 2003-09-17T19:11:19+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4515 — Greg MacLellan — 2003-09-17T19:11:19+00:00

URL: https://externals.io/message/4515#4515

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
