how to have dio on raspberry

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

Reply to
ZOT
Loading thread data ...

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");

Reply to
ZOT

Unless you find php7 dio package in the repository or in a ppa, you will need to compile your own php with dio support.

--

  //Aho
Reply to
J.O. Aho

formatting link

--
?The ultimate result of shielding men from the effects of folly is to  
fill the world with fools.? 

Herbert Spencer
Reply to
The Natural Philosopher

better, start at the beginning

formatting link
bill

Reply to
bill

I dont see that adds anything and it is less informative

--
It?s easier to fool people than to convince them that they have been fooled. 
Mark Twain
Reply to
The Natural Philosopher

Well the intro does say

Note:

longer bundled with PHP as of PHP 5.1.0.

That might be helpful to know...

--
Ben.
Reply to
Ben Bacarisse

Tht info was in the link I posted first as well.

--
?It is hard to imagine a more stupid decision or more dangerous way of  
making decisions than by putting those decisions in the hands of people  
who pay no price for being wrong.? 

Thomas Sowell
Reply to
The Natural Philosopher

As was the more imnporatnt note:

"It is not bundled anymore. See

formatting link
to fetch the CVS version (being unmaintained, there is no release in pecl). Not a bug > bogus."

--
?it should be clear by now to everyone that activist environmentalism  
(or environmental activism) is becoming a general ideology about humans,  
about their freedom, about the relationship between the individual and  
the state, and about the manipulation of people under the guise of a  
'noble' idea. It is not an honest pursuit of 'sustainable development,'  
a matter of elementary environmental protection, or a search for  
rational mechanisms designed to achieve a healthy environment. Yet  
things do occur that make you shake your head and remind yourself that  
you live neither in Joseph Stalin?s Communist era, nor in the Orwellian  
utopia of 1984.? 

Vaclav Klaus
Reply to
The Natural Philosopher

Op 01-09-19 om 15:23 schreef ZOT:

Alternatively, just use fopen(), fclose(), fread(), fwrite(). Set port parameters with exec("stty -F [device] [parameters]"), see: man stty. Flushing the buffers at the right moment might be tricky, or it might work well automatically; I don't know.

Look at this old thing for inspiration:

formatting link

Reply to
A. Dumas

I could not find it. Maybe we are seeing different text?

Yes, that's useful, but it's in a user note. This one is probably reliable though.

--
Ben.
Reply to
Ben Bacarisse

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.