Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18064

Re: how to have dio on raspberry

From ZOT <pasmoi@pasici.us>
Newsgroups comp.lang.php, comp.sys.raspberry-pi
Subject Re: how to have dio on raspberry
Date 2019-09-01 15:23 +0200
Organization Aioe.org NNTP Server
Message-ID <qkggof$hsg$1@gioia.aioe.org> (permalink)
References <qkgf0v$a0g$1@gioia.aioe.org>

Cross-posted to 2 groups.

Show all headers | View raw


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.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to have dio on raspberry ZOT <pasmoi@pasici.us> - 2019-09-01 14:53 +0200
  Re: how to have dio on raspberry ZOT <pasmoi@pasici.us> - 2019-09-01 15:23 +0200
    Re: how to have dio on raspberry "A. Dumas" <alexandre@dumas.fr.invalid> - 2019-09-02 09:23 +0200
  Re: how to have dio on raspberry "J.O. Aho" <user@example.net> - 2019-09-01 15:44 +0200
    Re: how to have dio on raspberry The Natural Philosopher <tnp@invalid.invalid> - 2019-09-01 15:48 +0100
      Re: how to have dio on raspberry bill <william@TechServSys.com> - 2019-09-01 10:53 -0400
        Re: how to have dio on raspberry The Natural Philosopher <tnp@invalid.invalid> - 2019-09-01 16:21 +0100
          Re: how to have dio on raspberry Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-01 17:10 +0100
            Re: how to have dio on raspberry The Natural Philosopher <tnp@invalid.invalid> - 2019-09-02 03:48 +0100
              Re: how to have dio on raspberry The Natural Philosopher <tnp@invalid.invalid> - 2019-09-02 04:42 +0100
                Re: how to have dio on raspberry Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-09-02 16:51 +0100

csiph-web