[PATCH] DIO: Flow control, Modem info, Read waiting

php.internals

Greg MacLellan

22 years ago
Added two functions: dio_modemget(resource fd) - returns the control line status of a serial port dio_read_waiting(resource fd) - returns the number of bytes waiting in the input buffer (note: i have submitted a patch for dio_modemget before, but since current CVS doesn't have it, I'm sending it again) Modified dio_tcsetattr() so the array accepts two more parameters: 'hwflow' - set to zero to turn hardware flow control (CRTSCTS) off (defaults to on) 'swflow' - set to non-zero to turn software flow control (XON/XOFF) on (defaults to off) Note that the defaults maintain the old behaviour. This change to dio_tcsetattr() is also attached seperately as dio_tcsetattr.patch.txt, but it is also included in dio_changes.patch.txt. dio_modemget() was written to get the status of a UPS. Flow control changes were made to be able to communicate with a serial device that required flow control off (and that was a fun problem to track down..). dio_read_waiting() was also written to communicate with the serial device, as I was having problems using non-blocking, and with blocking read() would sometimes wait forever. fyi, the device is a "weatherduck" http://www.itwatchdogs.com/duckdetails.shtml ttyl, greg
-- Greg MacLellan

Alan Knowles

22 years ago
would it not make sense to implement a) export the ioctl defines DIO_TIOCMGET etc. b) write a generic dio_ioctl($fh,$type,$args) function, with switch/case on the $type that way implementing more features for ioctl would just be a matter of adding the define and handling any special args/return values.?? (it would also follow the ioctl documenation a bit better..) The tcsetattr bit looks OK. Regards Alan Greg MacLellan wrote: