実際のところ
あらかじめ設定済みの/dev/ttyUSB0を対象とします。
読む
$ tail -f /dev/ttyUSB0
または
$ cat /dev/ttyUSB0
書く
一行書く。
$ echo "val=123" > /dev/ttyUSB0
改行不要なら"-n"で。
$ echo -n "val=123" > /dev/ttyUSB0
printfでもいけます。お好みで。
$ printf "val=%05d\n" 30 > /dev/ttyUSB0
あらかじめ設定済みの/dev/ttyUSB0を対象とします。
$ tail -f /dev/ttyUSB0
または
$ cat /dev/ttyUSB0
一行書く。
$ echo "val=123" > /dev/ttyUSB0
改行不要なら"-n"で。
$ echo -n "val=123" > /dev/ttyUSB0
printfでもいけます。お好みで。
$ printf "val=%05d\n" 30 > /dev/ttyUSB0
XWindow環境(i3など)で"Fatal server error: could not open default font 'fixed'"と出たら……フォントの入れ忘れかもしれません。
環境を再構築していた時のこと……。
$ vncserver :1 -geometry 1280x800 -depth 24 Couldn't start Xtightvnc; trying default font path. Please set correct fontPath in the vncserver script. Couldn't start Xtightvnc process. 23/11/18 08:11:16 Xvnc version TightVNC-1.3.9 23/11/18 08:11:16 Copyright (C) 2000-2007 TightVNC Group 23/11/18 08:11:16 Copyright (C) 1999 AT&T Laboratories Cambridge 23/11/18 08:11:16 All Rights Reserved. 23/11/18 08:11:16 See http://www.tightvnc.com/ for information on TightVNC 23/11/18 08:11:16 Desktop name 'X' (linaro-alip:1) 23/11/18 08:11:16 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t 23/11/18 08:11:16 Listening for VNC connections on TCP port 5901 Font directory '/usr/share/fonts/X11/misc/' not found - ignoring Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring Fatal server error: could not open default font 'fixed' 23/11/18 08:11:17 Xvnc version TightVNC-1.3.9 23/11/18 08:11:17 Copyright (C) 2000-2007 TightVNC Group 23/11/18 08:11:17 Copyright (C) 1999 AT&T Laboratories Cambridge 23/11/18 08:11:17 All Rights Reserved. 23/11/18 08:11:17 See http://www.tightvnc.com/ for information on TightVNC 23/11/18 08:11:17 Desktop name 'X' (linaro-alip:1) 23/11/18 08:11:17 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t 23/11/18 08:11:17 Listening for VNC connections on TCP port 5901 Font directory '/usr/share/fonts/X11/misc/' not found - ignoring Font directory '/usr/share/fonts/X11/Speedo/' not found - ignoring Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring Font directory '/usr/share/fonts/X11/100dpi/' not found - ignoring Fatal server error: could not open default font 'fixed'
エラーをみると、どうもフォント周りのようなので
$ sudo apt install xfonts-base Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: xfonts-encodings xfonts-utils The following NEW packages will be installed: xfonts-base xfonts-encodings xfonts-utils 0 upgraded, 3 newly installed, 0 to remove and 250 not upgraded. Need to get 6557 kB of archives. After this operation, 8380 kB of additional disk space will be used. Do you want to continue? [Y/n] y #... Setting up xfonts-utils (1:7.7+4) ... Setting up xfonts-base (1:1.0.4+nmu1) ...
これであらためてやると……はい動きました。
$ vncserver :1 -geometry 1280x800 -depth 24 New 'X' desktop is linaro-alip:1 Starting applications specified in /home/linaro/.vnc/xstartup Log file is /home/linaro/.vnc/linaro-alip:1.log
こういう事は構築に慣れた時ほど見落としがちです。
……なに、Docke? そんなハイカラなもん使えません(逆ギレ
scpコマンドをつかうと、UNIX系システム間ファイル送信できます。
たとえば、macOS上でセコセコ作っていたC++のコードをRasPiに転送したり……。
manの解説によると以下の通りなので……sshコマンドの仕組みを使ってるようです。
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1).
接続先が"pi@192.168.0.xxx"だとして……
今いるディレクトリのmain.py
$ scp ./main.py pi@192.168.0.xxx:~/www
$ scp -rC ./www pi@192.168.0.xxx:~/www
タイトルまんまで、同一のLAN内(同一サブネット内)につながっている機体のIPアドレスを調べる方法について。
$ echo 192.168.0.{1..254} | xargs -P256 -n1 ping -s1 -c1 -W1 | grep ttl | cut -d" " -f 4 | tr -d : 192.168.0.3 192.168.0.1 192.168.0.13 192.168.0.18 192.168.0.21 ... 192.168.0.201 192.168.0.202 192.168.0.254 192.168.0.253
$ echo 192.168.0.{1..254} | xargs -P256 -n1 ping -s1 -c1 -W1 | grep ttl=64 | cut -d" " -f 4 | tr -d : 192.168.0.3 192.168.0.21 ... 192.168.0.202 192.168.0.201 192.168.0.253
この続きにxargsなどをくっつけると総当たり式にsshでログイン試行という地獄のようなこともできます……(小声