4GPiの使いかたメモ


ハードウェア


インストール

pi@raspberryBlue:~/4GPi $ wget https://mechatrax.github.io/setup.sh 
pi@raspberryBlue:~/4GPi $ cat setup.sh 
#!/bin/bash
set -eu
. /etc/os-release
curl -fsSL https://mechatrax.github.io/setup/${ID}-${VERSION_ID}.sh | bash
pi@raspberryBlue:~/4GPi $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberryBlue:~/4GPi $ . /etc/os-release
pi@raspberryBlue:~/4GPi $ wget https://mechatrax.github.io/setup/${ID}-${VERSION_ID}.sh
--2022-02-17 10:54:16--  https://mechatrax.github.io/setup/raspbian-10.sh
mechatrax.github.io (mechatrax.github.io) をDNSに問いあわせています... 185.199.110.153, 185.199.108.153, 185.199.111.153, ...
mechatrax.github.io (mechatrax.github.io)|185.199.110.153|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 694 [application/x-sh]
`raspbian-10.sh' に保存中

raspbian-10.sh                      100%[===================================================================>]     694  --.-KB/s 時間 0s       

2022-02-17 10:54:16 (8.85 MB/s) - `raspbian-10.sh' へ保存完了 [694/694]
      
pi@raspberryBlue:~/4GPi $ cat raspbian-10.sh 
#!/usr/bin/env bash

set -eu

REPO=http://mechatrax.github.io/raspbian/
DIST=buster
DEB=mechatrax-archive-keyring_2016.12.19.2_all.deb
SHA256=3149c46ec82f3b1763537e4c6029923f849f4cd00a08e9b02255b05f4240fcfb
TMPDIR=$(mktemp -d /tmp/io.github.mechatrax.raspbian.${DIST}.setup.XXXXXXX)

pushd $TMPDIR
echo "$SHA256 $DEB" > sha256.txt
wget http://mechatrax.github.io/raspbian/pool/main/m/mechatrax-archive-keyring/$DEB
sha256sum -c sha256.txt
dpkg -i $DEB
popd
rm -rf $TMPDIR

cat << EOF > /etc/apt/sources.list.d/mechatrax.list
deb $REPO $DIST main contrib non-free
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src $REPO $DIST main contrib non-free
EOF

apt update
      
root@raspberryBlue:/home/pi/4GPi# chmod +x raspbian-10.sh
root@raspberryBlue:/home/pi/4GPi# sudo ./raspbian-10.sh 
/tmp/io.github.mechatrax.raspbian.buster.setup.mzcYqPf /home/pi/4GPi
--2022-02-17 11:02:31--  http://mechatrax.github.io/raspbian/pool/main/m/mechatrax-archive-keyring/mechatrax-archive-keyring_2016.12.19.2_all.deb
mechatrax.github.io (mechatrax.github.io) をDNSに問いあわせています... 185.199.109.153, 185.199.108.153, 185.199.110.153, ...
mechatrax.github.io (mechatrax.github.io)|185.199.109.153|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 5060 (4.9K) [application/octet-stream]
`mechatrax-archive-keyring_2016.12.19.2_all.deb' に保存中

mechatrax-archive-keyring_2016.12.1 100%[===================================================================>]   4.94K  --.-KB/s 時間 0s       

2022-02-17 11:02:31 (72.6 MB/s) - `mechatrax-archive-keyring_2016.12.19.2_all.deb' へ保存完了 [5060/5060]
      
root@raspberryBlue:/home/pi/4GPi# sudo apt install 4gpi-utils 4gpi-net-mods 4gpi-networkmanager
以下の追加パッケージがインストールされます:
  dns-root-data dnsmasq-base gpiod libbluetooth3 libgpiod2 libmbim-glib4 libmbim-proxy libmm-glib0 libndp0 libnm0 libpcap0.8 libqmi-glib5
  libqmi-proxy libteamdctl0 modemmanager network-manager ppp
提案パッケージ:
  libteam-utils
以下のパッケージが新たにインストールされます:
  4gpi-net-mods 4gpi-networkmanager 4gpi-utils dns-root-data dnsmasq-base gpiod libbluetooth3 libgpiod2 libmbim-glib4 libmbim-proxy
  libmm-glib0 libndp0 libnm0 libpcap0.8 libqmi-glib5 libqmi-proxy libteamdctl0 modemmanager network-manager ppp
アップグレード: 0 個、新規インストール: 20 個、削除: 0 個、保留: 324 個。
6,376 kB のアーカイブを取得する必要があります。
この操作後に追加で 22.4 MB のディスク容量が消費されます。
続行しますか? [Y/n] y
取得:1 http://mechatrax.github.io/raspbian buster/main armhf 4gpi-net-mods all 1.4.0~buster1 [2,976 B]
取得:2 http://mechatrax.github.io/raspbian buster/main armhf 4gpi-utils all 3.1.0 [6,604 B]                                                    
取得:3 http://mechatrax.github.io/raspbian buster/main armhf 4gpi-networkmanager all 3.0.0 [7,164 B]                                         
取得:4 http://archive.raspberrypi.org/debian buster/main armhf libbluetooth3 armhf 5.50-1.2~deb10u2+rpt1 [94.0 kB]               
取得:5 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libmm-glib0 armhf 1.10.0-1 [903 kB]
取得:6 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libndp0 armhf 1.6-1 [9,328 B]
取得:7 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libnm0 armhf 1.14.6-2+deb10u1 [295 kB]
取得:8 http://archive.raspberrypi.org/debian buster/main armhf dnsmasq-base armhf 2.80-1+rpt1+deb10u1 [400 kB]
取得:9 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libteamdctl0 armhf 1.28-1 [10.1 kB]
取得:10 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf network-manager armhf 1.14.6-2+deb10u1 [2,136 kB]
取得:11 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libmbim-glib4 armhf 1.18.0-1 [142 kB]                          
取得:12 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libmbim-proxy armhf 1.18.0-1 [70.7 kB]                         
取得:13 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libqmi-glib5 armhf 1.22.0-1.2 [443 kB]                         
取得:14 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libqmi-proxy armhf 1.22.0-1.2 [9,032 B]                        
取得:15 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf modemmanager armhf 1.10.0-1 [1,363 kB]                         
取得:16 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libpcap0.8 armhf 1.8.1-6 [124 kB]                              
取得:17 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf ppp armhf 2.4.7-2+4.1+deb10u1 [312 kB]                         
取得:18 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf libgpiod2 armhf 1.2-3+rpi1 [29.0 kB]                           
取得:19 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf gpiod armhf 1.2-3+rpi1 [13.9 kB]                               
取得:20 http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian buster/main armhf dns-root-data all 2019031302 [5,396 B]                         
 [..........................................................................................................................................]  
以前に未選択のパッケージ libbluetooth3:armhf を選択しています。.............................................................................] 
(データベースを読み込んでいます ... 現在 169611 個のファイルとディレクトリがインストールされています。)
.../00-libbluetooth3_5.50-1.2~deb10u2+rpt1_armhf.deb を展開する準備をしています ...
libbluetooth3:armhf (5.50-1.2~deb10u2+rpt1) を展開しています...
以前に未選択のパッケージ libmm-glib0:armhf を選択しています。
.../01-libmm-glib0_1.10.0-1_armhf.deb を展開する準備をしています ...
libmm-glib0:armhf (1.10.0-1) を展開しています...
以前に未選択のパッケージ libndp0:armhf を選択しています。
.../02-libndp0_1.6-1_armhf.deb を展開する準備をしています ...
libndp0:armhf (1.6-1) を展開しています...
以前に未選択のパッケージ libnm0:armhf を選択しています。
.../03-libnm0_1.14.6-2+deb10u1_armhf.deb を展開する準備をしています ...
libnm0:armhf (1.14.6-2+deb10u1) を展開しています...
以前に未選択のパッケージ libteamdctl0:armhf を選択しています。
.../04-libteamdctl0_1.28-1_armhf.deb を展開する準備をしています ...
libteamdctl0:armhf (1.28-1) を展開しています...
以前に未選択のパッケージ network-manager を選択しています。
.../05-network-manager_1.14.6-2+deb10u1_armhf.deb を展開する準備をしています ...
network-manager (1.14.6-2+deb10u1) を展開しています...
以前に未選択のパッケージ 4gpi-net-mods を選択しています。
.../06-4gpi-net-mods_1.4.0~buster1_all.deb を展開する準備をしています ...
4gpi-net-mods (1.4.0~buster1) を展開しています...
以前に未選択のパッケージ libmbim-glib4:armhf を選択しています。
.../07-libmbim-glib4_1.18.0-1_armhf.deb を展開する準備をしています ...
libmbim-glib4:armhf (1.18.0-1) を展開しています...
以前に未選択のパッケージ libmbim-proxy を選択しています。
.../08-libmbim-proxy_1.18.0-1_armhf.deb を展開する準備をしています ...
libmbim-proxy (1.18.0-1) を展開しています...
以前に未選択のパッケージ libqmi-glib5:armhf を選択しています。
.../09-libqmi-glib5_1.22.0-1.2_armhf.deb を展開する準備をしています ...
libqmi-glib5:armhf (1.22.0-1.2) を展開しています...
以前に未選択のパッケージ libqmi-proxy を選択しています。
.../10-libqmi-proxy_1.22.0-1.2_armhf.deb を展開する準備をしています ...
libqmi-proxy (1.22.0-1.2) を展開しています...
以前に未選択のパッケージ modemmanager を選択しています。
.../11-modemmanager_1.10.0-1_armhf.deb を展開する準備をしています ...
modemmanager (1.10.0-1) を展開しています...
以前に未選択のパッケージ libpcap0.8:armhf を選択しています。
.../12-libpcap0.8_1.8.1-6_armhf.deb を展開する準備をしています ...
libpcap0.8:armhf (1.8.1-6) を展開しています...
以前に未選択のパッケージ ppp を選択しています。
.../13-ppp_2.4.7-2+4.1+deb10u1_armhf.deb を展開する準備をしています ...
ppp (2.4.7-2+4.1+deb10u1) を展開しています...
以前に未選択のパッケージ libgpiod2:armhf を選択しています。
.../14-libgpiod2_1.2-3+rpi1_armhf.deb を展開する準備をしています ...
libgpiod2:armhf (1.2-3+rpi1) を展開しています...
以前に未選択のパッケージ gpiod を選択しています。
.../15-gpiod_1.2-3+rpi1_armhf.deb を展開する準備をしています ...
gpiod (1.2-3+rpi1) を展開しています...
以前に未選択のパッケージ 4gpi-utils を選択しています。
.../16-4gpi-utils_3.1.0_all.deb を展開する準備をしています ...
4gpi-utils (3.1.0) を展開しています...
以前に未選択のパッケージ 4gpi-networkmanager を選択しています。
.../17-4gpi-networkmanager_3.0.0_all.deb を展開する準備をしています ...
4gpi-networkmanager (3.0.0) を展開しています...
以前に未選択のパッケージ dns-root-data を選択しています。
.../18-dns-root-data_2019031302_all.deb を展開する準備をしています ...
dns-root-data (2019031302) を展開しています...
以前に未選択のパッケージ dnsmasq-base を選択しています。
.../19-dnsmasq-base_2.80-1+rpt1+deb10u1_armhf.deb を展開する準備をしています ...
dnsmasq-base (2.80-1+rpt1+deb10u1) を展開しています...
dnsmasq-base (2.80-1+rpt1+deb10u1) を設定しています ...
dns-root-data (2019031302) を設定しています ...
libpcap0.8:armhf (1.8.1-6) を設定しています ...
libteamdctl0:armhf (1.28-1) を設定しています ...
4gpi-net-mods (1.4.0~buster1) を設定しています ...
libnm0:armhf (1.14.6-2+deb10u1) を設定しています ...
ppp (2.4.7-2+4.1+deb10u1) を設定しています ...
Created symlink /etc/systemd/system/multi-user.target.wants/pppd-dns.service → /lib/systemd/system/pppd-dns.service.
libmm-glib0:armhf (1.10.0-1) を設定しています ...
libbluetooth3:armhf (5.50-1.2~deb10u2+rpt1) を設定しています ...
libndp0:armhf (1.6-1) を設定しています ...
libgpiod2:armhf (1.2-3+rpi1) を設定しています ...
libmbim-glib4:armhf (1.18.0-1) を設定しています ...
network-manager (1.14.6-2+deb10u1) を設定しています ...
Created symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service → /lib/systemd/system/NetworkManager-dispatcher.service.
Created symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service → /lib/systemd/system/NetworkManager-wait-online.service.
Created symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service → /lib/systemd/system/NetworkManager.service.
libmbim-proxy (1.18.0-1) を設定しています ...
gpiod (1.2-3+rpi1) を設定しています ...
4gpi-utils (3.1.0) を設定しています ...
Created symlink /etc/systemd/system/multi-user.target.wants/4gpi-setup.service → /lib/systemd/system/4gpi-setup.service.
4gpi-modem-config.service is a disabled or a static unit, not starting it.
libqmi-glib5:armhf (1.22.0-1.2) を設定しています ...
libqmi-proxy (1.22.0-1.2) を設定しています ...
modemmanager (1.10.0-1) を設定しています ...
Created symlink /etc/systemd/system/dbus-org.freedesktop.ModemManager1.service → /lib/systemd/system/ModemManager.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ModemManager.service → /lib/systemd/system/ModemManager.service.
4gpi-networkmanager (3.0.0) を設定しています ...
Created symlink /etc/systemd/system/multi-user.target.wants/4gpi-networkmanager-helper.service → /lib/systemd/system/4gpi-networkmanager-helper.service.
A dependency job for 4gpi-networkmanager-helper.service failed. See 'journalctl -xe' for details.
systemd (241-7~deb10u5+rpi1) のトリガを処理しています ...
man-db (2.8.5-2) のトリガを処理しています ...
dbus (1.12.20-0+deb10u1) のトリガを処理しています ...
hicolor-icon-theme (0.17-2) のトリガを処理しています ...
libc-bin (2.28-10+rpi1) のトリガを処理しています ...

MOBILE PLANNINGのシムの設定

pi@raspberryBlue:~ $ sudo nmcli con add type gsm ifname "*" con-name gsm-4gpi-ppsim apn ppsim.jp user pp@sim password jpn
      

mmcliによるSMSの送受信

SMSの送信

$ mmcli -m 0 --messaging-create-sms="number=080********,text='hello from  4GPi again. Good day'"
    Successfully created new SMS: /org/freedesktop/ModemManager1/SMS/2
$ mmcli -m 0 --messaging-list-sms
    /org/freedesktop/ModemManager1/SMS/2 (unknown)
    /org/freedesktop/ModemManager1/SMS/1 (received)
    /org/freedesktop/ModemManager1/SMS/0 (sent)
$ mmcli -s 2 --send
    successfully sent the SMS 

SMSの受信

$mmcli -m 0 --messaging-list-sms
   /org/freedesktop/ModemManager1/SMS/1 (received)
   /org/freedesktop/ModemManager1/SMS/0 (sent)
$mmcli -m 0 --sms 1
  -----------------------
  General    | dbus path: /org/freedesktop/ModemManager1/SMS/1
  -----------------------
  Content    |    number: 080********
             |      text: テスト
  -----------------------
  Properties |  pdu type: deliver
             |     state: received
             |   storage: sm
             |      smsc: +8180********
             | timestamp: 220216164400+09