• <bdo id='cpbOc'></bdo><ul id='cpbOc'></ul>

  • <i id='cpbOc'><tr id='cpbOc'><dt id='cpbOc'><q id='cpbOc'><span id='cpbOc'><b id='cpbOc'><form id='cpbOc'><ins id='cpbOc'></ins><ul id='cpbOc'></ul><sub id='cpbOc'></sub></form><legend id='cpbOc'></legend><bdo id='cpbOc'><pre id='cpbOc'><center id='cpbOc'></center></pre></bdo></b><th id='cpbOc'></th></span></q></dt></tr></i><div id='cpbOc'><tfoot id='cpbOc'></tfoot><dl id='cpbOc'><fieldset id='cpbOc'></fieldset></dl></div>

    1. <legend id='cpbOc'><style id='cpbOc'><dir id='cpbOc'><q id='cpbOc'></q></dir></style></legend>
    2. <tfoot id='cpbOc'></tfoot>

      <small id='cpbOc'></small><noframes id='cpbOc'>

      1. PhpSerial:没有可用的 stty——似乎无法让它工作

        时间:2023-10-12
          <tfoot id='MBbIz'></tfoot>
        1. <legend id='MBbIz'><style id='MBbIz'><dir id='MBbIz'><q id='MBbIz'></q></dir></style></legend>

            <small id='MBbIz'></small><noframes id='MBbIz'>

                <tbody id='MBbIz'></tbody>

                  <bdo id='MBbIz'></bdo><ul id='MBbIz'></ul>

                  <i id='MBbIz'><tr id='MBbIz'><dt id='MBbIz'><q id='MBbIz'><span id='MBbIz'><b id='MBbIz'><form id='MBbIz'><ins id='MBbIz'></ins><ul id='MBbIz'></ul><sub id='MBbIz'></sub></form><legend id='MBbIz'></legend><bdo id='MBbIz'><pre id='MBbIz'><center id='MBbIz'></center></pre></bdo></b><th id='MBbIz'></th></span></q></dt></tr></i><div id='MBbIz'><tfoot id='MBbIz'></tfoot><dl id='MBbIz'><fieldset id='MBbIz'></fieldset></dl></div>
                  本文介绍了PhpSerial:没有可用的 stty——似乎无法让它工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开展一个项目,该项目涉及使用 Raspberry Pi 上的 UART 引脚读取和写入串行板.但是,我已经撞到了砖墙.每当我尝试使用 PhpSerial 时,我总是收到错误:

                  I'm working on a project which involves reading and writing to a Serial board, using the UART pins on my Raspberry Pi. However, I have hit a brick wall already. Any time I try use PhpSerial I always get the error:

                  致命错误:没有可用的 stty,无法运行.在/var/www/PHP-Serial/examples/PhpSerial.php 第 56 行

                  Fatal error: No stty available, unable to run. in /var/www/PHP-Serial/examples/PhpSerial.php on line 56

                  我已经尝试了多种输入配置:

                  I've tried numerous configurations with the input:

                  // First we must specify the device. This works on both linux and windows (if
                  // your linux serial device is /dev/ttyS0 for COM1, etc)
                  $serial->deviceSet("/dev/ttyAMA0");
                  
                  // We can change the baud rate, parity, length, stop bits, flow control
                  $serial->confBaudRate(38400);
                  $serial->confParity("none");
                  $serial->confCharacterLength(8);
                  $serial->confStopBits(1);
                  $serial->confFlowControl("none");
                  

                  php/lighthttpd 作为 www-data 运行,我尝试将 /dev/ttyAMA0 chowning 给该用户,并且我已将拨出组添加到该用户.我在 php.ini 中看不到任何禁用功能或任何内容.我也没有按照 wiki 在 pi 上使用串行设备的标准设置,并且我能够使用

                  php/lighthttpd is running as www-data, Ive tried chowning the /dev/ttyAMA0 to that user, and I've added the dialout group to said user. I cant see any disable functions or anything in my php.ini. I've also don't the standard setup for using serial devices on the pi as per the wiki, and I am able to read/write data to and from the circuit using

                  sudo minicom -b 38400 -o -D/dev/ttyAMA0

                  sudo minicom -b 38400 -o -D /dev/ttyAMA0

                  以下是错误所指的行:

                      if (substr($sysName, 0, 5) === "Linux") {
                          $this->_os = "linux";
                  
                          if ($this->_exec("stty") === 0) {
                              register_shutdown_function(array($this, "deviceClose"));
                          } else {
                              trigger_error(
                                  "No stty available, unable to run.",
                                  E_USER_ERROR
                              );
                          }
                  

                  我无法理解,但其他人可能会理解.提前致谢.

                  I can't make sense of it but someone else might. Thanks in advance.

                  推荐答案

                  你的问题解决方案如下:

                  您必须在 PhpSerial.php 类中更改以下代码行

                  The solution to your problem is as follows:

                  You have to change the following line of code in the PhpSerial.php class

                  发件人:

                  if ($this->_exec("stty") === 0) {
                  

                  致:

                  if ($this->_exec("stty --version") === 0) {
                  

                  =>因此,这解决了没有可用的 stty,无法运行..."的问题.错误.请参阅此线程:https://www.raspberrypi.org/论坛/viewtopic.php?f=91&t=100481

                  => This consequently resolves the "No stty available, unable to run..." error. See this thread: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=100481

                  我还应该补充一点,在我写出串行数据之前我不得不延迟,例如

                  I should also add that I've had to place a delay before I write serial data out e.g.

                  <?php
                  

                  error_reporting(E_ALL);ini_set('display_errors', '1');

                  error_reporting(E_ALL); ini_set('display_errors', '1');

                  include "PhpSerial.php";//serial class: https://github.com/Xowap/PHP-Serial/blob/develop/examples/VS421CPNTA.php
                  
                  $serial = new phpSerial;
                  //$serial->deviceSet("/dev/ttyAMA0");
                  $serial->deviceSet("/dev/ttyACM0");
                  
                  $serial->confBaudRate(9600);
                  $serial->confParity("none");
                  $serial->confCharacterLength(8);
                  $serial->confStopBits(1);
                  $serial->deviceOpen();
                  
                  sleep(3);//delay
                  $serial->sendMessage("1");
                  
                  $serial->deviceClose();
                  echo "Serial message sent! 
                  ";
                  

                  这篇关于PhpSerial:没有可用的 stty——似乎无法让它工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我想与 304 响应一起发送哪些标头? 下一篇:与手动执行相比,通过 PhP 执行 bash 脚本给出了不同的结果

                  相关文章

                  <small id='yjnj4'></small><noframes id='yjnj4'>

                • <i id='yjnj4'><tr id='yjnj4'><dt id='yjnj4'><q id='yjnj4'><span id='yjnj4'><b id='yjnj4'><form id='yjnj4'><ins id='yjnj4'></ins><ul id='yjnj4'></ul><sub id='yjnj4'></sub></form><legend id='yjnj4'></legend><bdo id='yjnj4'><pre id='yjnj4'><center id='yjnj4'></center></pre></bdo></b><th id='yjnj4'></th></span></q></dt></tr></i><div id='yjnj4'><tfoot id='yjnj4'></tfoot><dl id='yjnj4'><fieldset id='yjnj4'></fieldset></dl></div>
                    <bdo id='yjnj4'></bdo><ul id='yjnj4'></ul>
                  <legend id='yjnj4'><style id='yjnj4'><dir id='yjnj4'><q id='yjnj4'></q></dir></style></legend>
                    1. <tfoot id='yjnj4'></tfoot>