Re: [PHP-DEV] Re: adding tcsetattr to dio extenstion

2002-08-15 Thread Alan Knowles

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;
   }
}






  





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Re: adding tcsetattr to dio extenstion

2002-08-15 Thread Sterling Hughes

 can somebody give me karma to add this..
 and probably karma for phpdoc/en/reference/dio/functions (or similar)


done.

-Sterling

 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;
   }
 }

 
 
 
 
 
  
 
 
 
 

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php