adding tcsetattr to dio extenstion
| From: | Alan Knowles | Date: | Wed, 07 Aug 2002 07:35:26 +0000 |
| Subject: | adding tcsetattr to dio extenstion | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-86587@lists.php.net to get a copy of this message | ||
attached is a patch to add tcsetattr() to the dio extension
any objections/suggestions for it..
for some reason if I do O_ASYNC on SET_FL i get 'I/O possible' and
dies... ?????
usage:
dl('dio.so');
$fd = dio_open('/dev/ttyS0', O_RDWR | O_NOCTTY | O_NONBLOCK);
/* signal callbacks
....
*/
dio_fcntl($fd,F_SETOWN,posix_getpid());
//dio_fcntl($fd,F_SETFL, O_ASYNC ); // <- produces a 'I/O possible' and
dies... ?????
dio_fcntl($fd,F_SETFL, O_SYNC );
dio_tcsetattr($fd, array(
'baud' => 9600,
'bits' => 8,
'stop' =>1,
'parity' => 0
));
echo "STARTING READ";
while (1) {
$data = dio_read($fd,256);
if ($data) {
echo $data;
}
}