TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: ZOT
date: 2019-09-01 15:23:00
subject: Re: how to have dio on ra

Le 01/09/2019 14:53, ZOT a écrit :
> I have a brand new install of raspian, fresh install of apache2 + php
> +rrdools
> But the php script that ran well on a old version of rapian ( I had
> compiled both apache and php at that time) faile with '
> -- undefined function dio_open() '
> So probably php is not compiled with dio!
> Is there a way to add these functionality to php without recompile?
> Many tanks to all
>
> Les politiciens sont imprévoyants, les électeurs sans mémoire.

to give some precision, dio allow direct access to tty, ..
exmple:
$DEVICE="/dev/ttyS1";
$LOCK="/var/lock/lockdev/LCK..ttyS1";

-----
$fd = dio_open($DEVICE, O_RDWR |O_NOCTTY | O_NONBLOCK );
if (! $fd ) {
    LogErrors($myErrors,"Error opening $DEVICE");ABORT("error opening
$DEVICE ");}

$param = array( 'baud' => 9600, 'bits' => 8, 'stop'  =>1, 'parity' => 0);
if ( ! dio_tcsetattr($fd, $param) ) {
           dio_close($fd);
           ABORT("Error while dio_tcsetattr \n");
}

$rc = dio_write($fd, "\r");
sleep(1);
while ($rs != ":" ) {
    $rs = dio_read($fd, 1);
}

$rc = dio_write($fd, "E0\r");

$rs = "";
$x =0;
while ($rs != ":" ) {
    $rs = dio_read($fd, 1);
    $x++;
    if ( $x > 10000 ) { LogErrors($myErrors,"Timeout waiting
prompt");ABORT("Timeout waiting prompt\n"); }
}

$rc = dio_write($fd, "SH\r");


--
Les politiciens sont imprévoyants, les électeurs sans mémoire.

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.