Re: Re: adding tcsetattr to dio extenstion

From: Date: Thu, 15 Aug 2002 09:16:27 +0000
Subject: Re: Re: adding tcsetattr to dio extenstion
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-86855@lists.php.net to get a copy of this message
can somebody give me karma to add this.. and probably karma for phpdoc/en/reference/dio/functions (or similar) regards alan regards alan Sterling Hughes wrote:
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... ?????
Feel free to commit it, my only internet is currently firewalled http and ftp, so I can't really do much in that way (actually, can't even test your patch, but the interface looks fine). O_ASYNC should really be removed, its useless from your php script, and php really can't do async I/O without using the (un-portable) unix aio_* interface, until that is directly support signal based I/O is pretty much impossible in php. -Sterling
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;
} }


« previous php.dev (#86855) next »