PATCH: get modem status (direct io)

php.internals

Greg MacLellan

22 years ago
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