【问题标题】:Set up serial on start up Raspberry Pi在启动 Raspberry Pi 时设置串行
【发布时间】:2013-09-20 03:46:30
【问题描述】:

我正在尝试进行设置,以便在启动后不必输入这两个命令(PI 作为用户):

1) sudo CHMOD 777 /dev/ttyAMA0

2) sudo stty -F /dev/ttyAMA0 cs8 9600 -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echo -echoctl -echoke noflsh -ixon -crtscts

谢谢

【问题讨论】:

    标签: linux raspberry-pi


    【解决方案1】:

    您可以将其添加到 /etc/rc.local 的末尾,

    CHMOD 777 /dev/ttyAMA0 &
    stty -F /dev/ttyAMA0 cs8 9600 -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echoke noflsh -ixon -crtscts &
    

    【讨论】:

    • 现在,我看到了:_IP=$(hostname -I) ||如果 ["$_IP"] 则为真;然后 printf "My IP address is %s\n" "$_IP" fi 在这里添加代码?
    【解决方案2】:

    您可以将您的脚本可执行命令添加到.bashrc 的底部,该命令将在您每次登录时运行您的脚本。

    如果您正在寻找可在控制台启动时工作的解决方案,请查看this link

    如果您希望在启动到 LXDE 环境时运行脚本,您可以查看this Raspberry Pi forum post

    https://raspberrypi.stackexchange.com/a/8735

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-11
      • 2021-08-01
      • 2020-10-10
      • 1970-01-01
      • 1970-01-01
      • 2014-04-02
      • 1970-01-01
      相关资源
      最近更新 更多