Merge branch 'main' of git.deuxfleurs.fr:quentin/wpj428

This commit is contained in:
Quentin 2021-03-22 14:08:40 +00:00
commit 048a3555cc

190
README.md
View file

@ -6,7 +6,7 @@ Some challenges we have encountered so far:
- OpenWRT stable misses a patch to enable our board ethernet port -> we compile from source
- The Modem Manager simtech plugin does not declare 5GNR
## Flash the router
## Flash OpenWRT from uboot
(Configure your computer with a static IP address 192.168.1.2/24 and make sure you have a running tftp server containing your image)
@ -48,7 +48,192 @@ make download
make -j $(nproc)
```
To inject a config file:
```bash
# Append changes to bottom of .config
cat config >> .config
# Apply changes
make defconfig
make download
make -j $(nproc)
```
## Flash OpenWRT from OpenWRT (!)
Copy the firmware in router's `/tmp`.
Why `/tmp`? Your router has more volatile storage than persistent one, moreover you will overwrite the persistent storage.
So, copy the firmware in `/tmp`!
Next, we will use the `sysupgrade` command. `-v` is verbose, `-n` ask openwrt to erase configuration files (ie. ask for a factory reset).
```
sysupgrade -v -n /tmp/openwrt-ipq40xx-generic-compex_wpj428-squashfs-sysupgrade.bin
```
## Get root on MimoAP
1. Download a backup from your router firmware
2. Extract it, edit `/etc/shadow`, replace the hash of the `root` user with the one from the `admin` user
3. Recompress the folder hierarchy
4. Import this new archive as backup in MimoAP
5. Run `ssh root@192.168.1.1` (replace with the IP address of your router) and use your `admin` password
6. Enjoy! (But you should really install a vanilla OpenWRT instead)
## Flash OpenWRT from Compex ROM (MimoAP)
*Not written*
## Flash MimoAP/OpenWRT with Compex tools on Uboot
*Not written*
## Using ModemManager
Wait for modems:
```
mmcli -M
```
Connect/Disconnect:
```
mmcli -m 0 --simple-connect="apn=free"
mmcli -m 0 --simple-disconnect
```
Set supported/preferred mode:
```
mmcli -m 0 --set-allowed-modes="3G|4G" --set-preferred-mode=4G
mmcli -m 0 --set-allowed-modes="5G"
```
Equivalent with `qmicli`:
```
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --nas-get-system-selection-preference
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --nas-set-system-selection-preference='5gnr|lte'
```
## QMICLI Connect
About our provider (Free Mobile), IPv4 is acquired through DHCP but IPv6 is statically provided.
### IPv6
```
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-start-network="ip-type=6,apn=free" --client-no-release-cid
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-get-current-settings
ip addr add 2a0d:e487:15f:f7f5:5c58:4e37:90c0:74d8/64 dev wwan0
ip route add default via 2a0d:e487:15f:f7f5:49ec:2e4a:ca1:5b20
echo -e "nameserver 2a0d:e480::1\nnameserver 2a0d:e480::2" > /etc/resolv.conf
```
### IPv4
```
qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-start-network="ip-type=4,apn=free" --client-no-release-cid
udhcpc -q -f -n -i wwan0
```
## Error
Despite patching ModemManager simtech plugin, we get an error if we force 5GNR.
We typed:
```
mmcli -m 0 --set-allowed-modes="5G"
mmcli -m 0 --simple-disconnect
mmcli -m 0 --simple-connect="apn=free"
```
We got:
```
Fri Mar 19 23:57:22 2021 daemon.warn [2633]: <warn> [modem0] couldn't load operator code: Current operator MCC/MNC is still unknown
Fri Mar 19 23:57:22 2021 daemon.warn [2633]: <warn> [modem0] couldn't load operator name: Current operator description is still unknown
Fri Mar 19 23:57:48 2021 daemon.info [2633]: <info> [modem0] state changed (connected -> disconnecting)
Fri Mar 19 23:57:48 2021 daemon.info [2633]: <info> [modem0] state changed (disconnecting -> registered)
Fri Mar 19 23:57:48 2021 daemon.info [2633]: <info> [modem0/bearer1] connection #1 finished: duration 936s, tx: 79 bytes, rx :566 bytes
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] simple connect started...
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] simple connect state (4/8): wait to get fully enabled
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] simple connect state (5/8): register
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] simple connect state (6/8): bearer
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] simple connect state (7/8): connect
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] state changed (registered -> connecting)
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0/bearer1] couldn't start network: QMI protocol error (14): 'CallFailed'
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0/bearer1] call end reason (3): generic-no-service
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0/bearer1] verbose call end reason (3,2001): [cm] no-service
Fri Mar 19 23:57:57 2021 daemon.warn [2633]: <warn> [modem0/bearer1] connection attempt #2 failed: QMI protocol error (14): 'CallFailed'
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0] state changed (connecting -> registered)
Fri Mar 19 23:57:57 2021 daemon.info [2633]: <info> [modem0/bearer1] connection #2 finished: duration 0s, tx: 0 bytes, rx :0 bytes
```
And the new bearer contains:
```
root@OpenWrt:/# mmcli -b 1
----------------------------
General | path: /org/freedesktop/ModemManager1/Bearer/1
| type: default
----------------------------
Status | connected: no
| suspended: no
| ip timeout: 20
----------------------------
Properties | apn: free
| roaming: allowed
----------------------------
Statistics | attempts: 2
| attempts: 1
| total-duration: 936
| total-bytes rx: 566
| total-bytes tx: 79
```
Errors :
```
QMI protocol error (14): 'CallFailed'
```
```
call end reason (3): generic-no-service
verbose call end reason (3,2001): [cm] no-service
```
Next step: qmi-utils!
- https://forum.sierrawireless.com/t/mc7354-got-qmi-error-callfailed-when-starting-network/9053
- https://community.autopi.io/t/error-when-starting-qmi-connection/2338
- https://lists.freedesktop.org/archives/libqmi-devel/2018-January/002707.html
## ModemManager
We append the following to ModemManager:
```
config interface 'broadband'
option device '/sys/devices/platform/soc/60f8800.usb2/6000000.dwc3/xhci-hcd.1.auto/usb3/3-1'
option proto 'modemmanager'
option apn 'free'
option iptype 'ipv4v6'
```
Then we can start the interface with:
```
ifup broadband
```
Both IPv6 and IPv4 should work:
```
ping openwrt.org
ping -6 openwrt.org
```
## Logs
@ -133,3 +318,6 @@ eth0
- [All the commits in OpenWRT about the WPJ428](https://git.openwrt.org/?p=openwrt%2Fopenwrt.git&a=search&h=HEAD&st=commit&s=WPJ428)
- https://openwrt.org/docs/guide-developer/build-system/use-buildsystem
- https://damow.net/5g-home-broadband/
- https://techship.com/faq/how-to-step-by-step-set-up-a-data-connection-over-qmi-interface-using-qmicli-and-in-kernel-driver-qmi-wwan-in-linux/
- [No 5GNR, many qmicli commands to help debug and compare!](https://forums.quectel.com/t/rm500q-gl-not-working/6594)