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


Groups > comp.lang.php > #18063 > unrolled thread

how to have dio on raspberry

Started byZOT <pasmoi@pasici.us>
First post2019-09-01 14:53 +0200
Last post2019-09-02 16:51 +0100
Articles 11 — 6 participants

Back to article view | Back to comp.lang.php


Contents

  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

#18063 — how to have dio on raspberry

FromZOT <pasmoi@pasici.us>
Date2019-09-01 14:53 +0200
Subjecthow to have dio on raspberry
Message-ID<qkgf0v$a0g$1@gioia.aioe.org>
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.

[toc] | [next] | [standalone]


#18064

FromZOT <pasmoi@pasici.us>
Date2019-09-01 15:23 +0200
Message-ID<qkggof$hsg$1@gioia.aioe.org>
In reply to#18063
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.

[toc] | [prev] | [next] | [standalone]


#18072

From"A. Dumas" <alexandre@dumas.fr.invalid>
Date2019-09-02 09:23 +0200
Message-ID<qkig20$h7p$1@dont-email.me>
In reply to#18064
Op 01-09-19 om 15:23 schreef ZOT:
> 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");
> [...]

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: 
https://www.phpclasses.org/package/3679-PHP-Communicate-with-a-serial-port.html#view_files/files/17926

[toc] | [prev] | [next] | [standalone]


#18065

From"J.O. Aho" <user@example.net>
Date2019-09-01 15:44 +0200
Message-ID<gt20a2F8md7U1@mid.individual.net>
In reply to#18063
On 01/09/2019 14.53, ZOT wrote:
> 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?

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

[toc] | [prev] | [next] | [standalone]


#18066

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2019-09-01 15:48 +0100
Message-ID<qkglos$aa6$1@dont-email.me>
In reply to#18065
On 01/09/2019 14:44, J.O. Aho wrote:
> On 01/09/2019 14.53, ZOT wrote:
>> 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?
> 
> Unless you find php7 dio package in the repository or in a ppa, you will 
> need to compile your own php with dio support.
> 
https://www.php.net/manual/en/ref.dio.php



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

Herbert Spencer

[toc] | [prev] | [next] | [standalone]


#18067

Frombill <william@TechServSys.com>
Date2019-09-01 10:53 -0400
Message-ID<qkgm0c$18bc$1@gioia.aioe.org>
In reply to#18066
On 9/1/2019 10:48 AM, The Natural Philosopher wrote:
> On 01/09/2019 14:44, J.O. Aho wrote:
>> On 01/09/2019 14.53, ZOT wrote:
>>> 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?
>>
>> Unless you find php7 dio package in the repository or in a ppa, 
>> you will need to compile your own php with dio support.
>>
> https://www.php.net/manual/en/ref.dio.php
> 
> 
> 
better, start at the beginning
https://www.php.net/manual/en/intro.dio.php
bill

[toc] | [prev] | [next] | [standalone]


#18068

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2019-09-01 16:21 +0100
Message-ID<qkgnlh$knf$1@dont-email.me>
In reply to#18067
On 01/09/2019 15:53, bill wrote:
> On 9/1/2019 10:48 AM, The Natural Philosopher wrote:
>> On 01/09/2019 14:44, J.O. Aho wrote:
>>> On 01/09/2019 14.53, ZOT wrote:
>>>> 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?
>>>
>>> Unless you find php7 dio package in the repository or in a ppa, you 
>>> will need to compile your own php with dio support.
>>>
>> https://www.php.net/manual/en/ref.dio.php
>>
>>
>>
> better, start at the beginning
> https://www.php.net/manual/en/intro.dio.php
> 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

[toc] | [prev] | [next] | [standalone]


#18069

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2019-09-01 17:10 +0100
Message-ID<87blw4575b.fsf@bsb.me.uk>
In reply to#18068
The Natural Philosopher <tnp@invalid.invalid> writes:

> On 01/09/2019 15:53, bill wrote:
>> On 9/1/2019 10:48 AM, The Natural Philosopher wrote:
>>> On 01/09/2019 14:44, J.O. Aho wrote:
>>>> On 01/09/2019 14.53, ZOT wrote:
>>>>> 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?
>>>>
>>>> Unless you find php7 dio package in the repository or in a ppa, you will need to compile your own php with dio support.
>>>>
>>> https://www.php.net/manual/en/ref.dio.php
>>>
>> better, start at the beginning
>> https://www.php.net/manual/en/intro.dio.php
>> bill
> I dont see that adds anything and it is less informative

Well the intro does say

  Note:
  This extension has been moved to the » PECL repository and is no
  longer bundled with PHP as of PHP 5.1.0.

That might be helpful to know...

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#18070

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2019-09-02 03:48 +0100
Message-ID<qkhvu6$3gr$1@dont-email.me>
In reply to#18069
On 01/09/2019 17:10, Ben Bacarisse wrote:
> The Natural Philosopher <tnp@invalid.invalid> writes:
> 
>> On 01/09/2019 15:53, bill wrote:
>>> On 9/1/2019 10:48 AM, The Natural Philosopher wrote:
>>>> On 01/09/2019 14:44, J.O. Aho wrote:
>>>>> On 01/09/2019 14.53, ZOT wrote:
>>>>>> 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?
>>>>>
>>>>> Unless you find php7 dio package in the repository or in a ppa, you will need to compile your own php with dio support.
>>>>>
>>>> https://www.php.net/manual/en/ref.dio.php
>>>>
>>> better, start at the beginning
>>> https://www.php.net/manual/en/intro.dio.php
>>> bill
>> I dont see that adds anything and it is less informative
> 
> Well the intro does say
> 
>    Note:
>    This extension has been moved to the » PECL repository and is no
>    longer bundled with PHP as of PHP 5.1.0.
> 
> That might be helpful to know...
> 
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

[toc] | [prev] | [next] | [standalone]


#18071

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2019-09-02 04:42 +0100
Message-ID<qki33d$gv5$2@dont-email.me>
In reply to#18070
On 02/09/2019 03:48, The Natural Philosopher wrote:
> On 01/09/2019 17:10, Ben Bacarisse wrote:
>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>
>>> On 01/09/2019 15:53, bill wrote:
>>>> On 9/1/2019 10:48 AM, The Natural Philosopher wrote:
>>>>> On 01/09/2019 14:44, J.O. Aho wrote:
>>>>>> On 01/09/2019 14.53, ZOT wrote:
>>>>>>> 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?
>>>>>>
>>>>>> Unless you find php7 dio package in the repository or in a ppa, 
>>>>>> you will need to compile your own php with dio support.
>>>>>>
>>>>> https://www.php.net/manual/en/ref.dio.php
>>>>>
>>>> better, start at the beginning
>>>> https://www.php.net/manual/en/intro.dio.php
>>>> bill
>>> I dont see that adds anything and it is less informative
>>
>> Well the intro does say
>>
>>    Note:
>>    This extension has been moved to the » PECL repository and is no
>>    longer bundled with PHP as of PHP 5.1.0.
>>
>> That might be helpful to know...
>>
> Tht info was in the link I posted first as well.
> 
> 
> 
As was the more imnporatnt note:

"It is not bundled anymore. See http://pecl.php.net/dio 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

[toc] | [prev] | [next] | [standalone]


#18073

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2019-09-02 16:51 +0100
Message-ID<87woeq4rxi.fsf@bsb.me.uk>
In reply to#18071
The Natural Philosopher <tnp@invalid.invalid> writes:

> On 02/09/2019 03:48, The Natural Philosopher wrote:
>> On 01/09/2019 17:10, Ben Bacarisse wrote:
>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>
>>>> On 01/09/2019 15:53, bill wrote:
>>>>> On 9/1/2019 10:48 AM, The Natural Philosopher wrote:
>>>>>> On 01/09/2019 14:44, J.O. Aho wrote:
>>>>>>> On 01/09/2019 14.53, ZOT wrote:
>>>>>>>> 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?
>>>>>>>
>>>>>>> Unless you find php7 dio package in the repository or in a ppa, you will need to compile your own php with dio support.
>>>>>>>
>>>>>> https://www.php.net/manual/en/ref.dio.php
>>>>>>
>>>>> better, start at the beginning
>>>>> https://www.php.net/manual/en/intro.dio.php
>>>>> bill
>>>> I dont see that adds anything and it is less informative
>>>
>>> Well the intro does say
>>>
>>>    Note:
>>>    This extension has been moved to the » PECL repository and is no
>>>    longer bundled with PHP as of PHP 5.1.0.
>>>
>>> That might be helpful to know...
>>>
>> Tht info was in the link I posted first as well.

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

> As was the more imnporatnt note:
>
> "It is not bundled anymore. See http://pecl.php.net/dio to fetch the
> CVS version (being unmaintained, there is no release in pecl). Not a
> bug > bogus."

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

-- 
Ben.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web