From 883d57a3e734e5f2963a34ddd8b79d0fde7c0b01 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:24:32 +0200 Subject: [PATCH 01/11] Network failover --- .../rootfs_uclibc_rv1106/etc/network/interfaces | 9 +++++++++ .../usr/local/bin/femto-runonce.sh | 16 ++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces index 315112b..bfde602 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/network/interfaces @@ -8,4 +8,13 @@ iface lo inet loopback allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf + metric 100 + post-up sleep 5 && dhclient wlan0 + pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev wlan0 metric 100 + +allow-hotplug eth0 +iface eth0 inet dhcp + metric 10 + post-up ip route replace default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10 + pre-down ip route del default via $(ip route | awk '/default/ {print $3}') dev eth0 metric 10 diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 4ba57a2..8f6073b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -70,16 +70,16 @@ fi # prevent randomized mac address for eth0. If `eth0`` is already present in /etc/network/interfaces, skip mac="$(awk '/Serial/ {print $3}' /proc/cpuinfo | tail -c 11 | sed 's/^\(.*\)/a2\1/' | sed 's/\(..\)/\1:/g;s/:$//')" -if ! grep -q "eth0" /etc/network/interfaces; then +file="/etc/network/interfaces" +if ! grep -q " hwaddress ether $mac" "$file"; then log_message "Setting eth0 MAC address to $mac (derivative of CPU s/n)" - cat <> /etc/network/interfaces -# static mac address for onboard ethernet (castellated pins) -allow-hotplug eth0 -iface eth0 inet dhcp -hwaddress ether $mac -EOF + awk -v mac="$mac" ' + { print } + /allow-hotplug eth0/ { count=5 } + count && --count == 0 { print " hwaddress ether " mac } + ' "$file" > "$file.tmp" && mv "$file.tmp" "$file" else - log_message "eth0 already exists in /etc/network/interfaces, skipping" + log_message "eth0 mac address already set in /etc/network/interfaces, skipping" fi # Add term stuff to .bashrc From a980af7e47a46cc040cc1fb1abeda744c6355db0 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:49:53 +0200 Subject: [PATCH 02/11] add back ssh keygen --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index 8f6073b..df60518 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -110,7 +110,7 @@ systemctl enable meshtasticd #generate SSH keys log_message "Generating new SSH encryption keys. This can take a couple minutes..." -#femto-utils.sh -E +femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." From 01b65a642454b29e01ab590865cf62b6ebf33044 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 13:50:27 +0200 Subject: [PATCH 03/11] Update femto-runonce.sh --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index df60518..c0d19ac 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,6 +115,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." /usr/local/bin/packages/ttyd.sh -k +systemctl enable ttyd # remove first boot flag systemctl disable femto-runonce From 9db705447e8a218e659e89e8275d5b01a3e92831 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 14:14:38 +0200 Subject: [PATCH 04/11] disable ttyd in chroot and re-enable on first boot --- environment-setup/femtofox.chroot | 3 ++- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index 19d213c..d0274df 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -62,7 +62,8 @@ systemctl enable femto-boot-complete.service systemctl enable femto-wifi-mesh-control systemctl enable femto-watchclock-dog -systemctl disable meshtasticd +systemctl disable ttyd # enabled on first boot +systemctl disable meshtasticd # enabled on first boot systemctl disable apt-daily.timer systemctl disable unattended-upgrades systemctl disable smbd nmbd # samba services, can be enabled via menu diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index c0d19ac..a319a38 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,6 +115,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." /usr/local/bin/packages/ttyd.sh -k +log_message "Enabling Web Terminal (ttyd) service... systemctl enable ttyd # remove first boot flag From 21519c034503af71ddfe8de4e0b88c575b63b2c4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 14:34:42 +0200 Subject: [PATCH 05/11] Fix typo in lora settings menu --- .../usr/local/bin/femto-meshtasticd-lora-dialogs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh index 2ab2b5b..d8acc49 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-lora-dialogs.sh @@ -180,7 +180,7 @@ lora_settings_actions() { done menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "") while true; do - choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${$lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \ + choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \ "${menu_items[@]}" 3>&1 1>&2 2>&3) [ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog [ "$choice" == "" ] && continue # Restart loop if no choice made From 80fa90e1201553955683d328c18176ff652e2798 Mon Sep 17 00:00:00 2001 From: nagumii Date: Wed, 19 Feb 2025 20:39:02 +0200 Subject: [PATCH 06/11] Missing " in runonce --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh index a319a38..d38262a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh @@ -115,7 +115,7 @@ femto-utils.sh -E #generate ttyd SSL keys log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..." /usr/local/bin/packages/ttyd.sh -k -log_message "Enabling Web Terminal (ttyd) service... +log_message "Enabling Web Terminal (ttyd) service..." systemctl enable ttyd # remove first boot flag From ff37008b0f5cb138bc6d256909944632666cd426 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 20 Feb 2025 00:32:41 +0200 Subject: [PATCH 07/11] Fix small pinouts issues --- .../usr/local/bin/femto-config | 2 +- .../usr/local/bin/femto-pinout.sh | 96 +++++++++---------- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index bcfde72..8fcc0da 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -636,7 +636,7 @@ help_menu() { 2) #Display pinout) choice="" # zero the choice before loading the submenu while true; do - choice=$(dialog --no-collapse --cancel-label "Back" --item-help --menu "Pinouts" 15 40 5 \ + choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --item-help --menu "Pinouts" 15 40 5 \ 1 "Femtofox Pro/CE" "" \ 2 "Femtofox Zero" "" \ 3 "Femtofox Tiny" "" \ diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh index a3f374b..c54db4b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-pinout.sh @@ -60,58 +60,58 @@ KILL: add PWR switch or thermal cutoff/fuse & remove resistor." femtofox_zero="\ - ┌────┐ ┌────┐ - │⚪ \ / ⚪│ - │ \ / │ - │ └─────────┘ │ - │ ┌─────────────────┐ │ - │ ●│● USB-C ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ ●│● LUCKFOX ●│● │ - │ ●│● PICO MINI ●│● │ - │ ●│● ●│● │ - │ ●│● FOXHOLE ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ ●│● ●│● │ - │ └────●─●─●─●─●────┘ │ - ├───┐ ┌─────────────┐ ┌───┤ - GND │ ● │ │ HT-RA62 │ │ ● │ GND - 3V3 │ ● │ │ ┌───────┐ │ │ ● │ 3V3 -UART4-RX │ ● │ │ │ │ │ │ ● │ I2C SDA -UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL - ├───┘ │ │SX 1262│ │ └───┤ - │ │ └───────┘ │ ● │ UNUSED - │ └─────────────┘ ● │ GND - │⚪ ETH ⚪│ - └────────●─●─●─●─●────────┘ - R R G T T - X X N X X - - + D - + \n" + ┌────┐ ┌────┐ \n\ + │⚪ \ / ⚪│ \n\ + │ \ / │ \n\ + │ └─────────┘ │ \n\ + │ ┌─────────────────┐ │ \n\ + │ ●│● USB-C ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● LUCKFOX ●│● │ \n\ + │ ●│● PICO MINI ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● FOXHOLE ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ ●│● ●│● │ \n\ + │ └────●─●─●─●─●────┘ │ \n\ + ├───┐ ┌─────────────┐ ┌───┤ \n\ + GND │ ● │ │ HT-RA62 │ │ ● │ GND \n\ + 3V3 │ ● │ │ ┌───────┐ │ │ ● │ 3V3 \n\ +UART4-RX │ ● │ │ │ │ │ │ ● │ I2C SDA \n\ +UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL \n\ + ├───┘ │ │SX 1262│ │ └───┤ \n\ + │ │ └───────┘ │ ● │ UNUSED \n\ + │ └─────────────┘ ● │ GND \n\ + │⚪ ETH ⚪│ \n\ + └────────●─●─●─●─●────────┘ \n\ + R R G T T \n\ + X X N X X \n\ + - + D - + " femtofox_tiny="coming soon" luckfox="\ - ┌────┬───────┬────┐ - VBUS 3.3-5V ●│● │ USB-C │ ●│● 1V8 OUT - GND ●│● │ │ ●│● GND - 3V3 IN/OUT ●│● └───────┘ ●│● 145, SARADC-IN1 1.8V -UART2-TX DEBUG, 42 ●│● ●│● 144, SARADC-IN0 1.8V -UART2-RX DEBUG, 43 ●│● [BTN] ●│● 4 - CS0, 48 ●│● ●│● 55, IRQ - CLK, 49 ●│● ●│● 54, BUSY - MOSI, 50 ●│● ●│● 59, I2C SCL - MISO, 51 ●│● ●│● 58, I2C SDA - UART4-RX, 52 ●│● ●│● 57, NRST, UART3-RX - UART4-TX, 53 ●│● ETH ●│● 56, RXEN, UART3-TX - └──●──●──●──●──●──┘ - R R G T T - X X N X X - - + D - + -GPIO BANK 0 (3.3v): 4 -GPIO BANK 1 (3.3v): 42 43 48 49 50 51 52 53 54 55 56 57 58 59 + ┌────┬───────┬────┐ \n\ + VBUS 3.3-5V ●│● │ USB-C │ ●│● 1V8 OUT \n\ + GND ●│● │ │ ●│● GND \n\ + 3V3 IN/OUT ●│● └───────┘ ●│● 145, SARADC-IN1 1.8V\n\ +UART2-TX DEBUG, 42 ●│● ●│● 144, SARADC-IN0 1.8V\n\ +UART2-RX DEBUG, 43 ●│● [BTN] ●│● 4 \n\ + CS0, 48 ●│● ●│● 55, IRQ \n\ + CLK, 49 ●│● ●│● 54, BUSY \n\ + MOSI, 50 ●│● ●│● 59, I2C SCL \n\ + MISO, 51 ●│● ●│● 58, I2C SDA \n\ + UART4-RX, 52 ●│● ●│● 57, NRST, UART3-RX \n\ + UART4-TX, 53 ●│● ETH ●│● 56, RXEN, UART3-TX \n\ + └──●──●──●──●──●──┘ \n\ + R R G T T \n\ + X X N X X \n\ + - + D - + \n\ +GPIO BANK 0 (3.3v): 4 \n\ +GPIO BANK 1 (3.3v): 42 43 48 49 50 51 52 53 54 55 56 57 58 59\n\ GPIO BANK 4 (1.8v): 144 145 " # Parse options From 5e018368a0ad7562ec93ac0432a2417d322a7fe3 Mon Sep 17 00:00:00 2001 From: noon92 <40807970+noon92@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:01:06 +0200 Subject: [PATCH 08/11] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 675ef38..41dd90d 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,13 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo | Dimensions | 63 x 54 x 19mm | **Accomplished:** -- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](supported_hardware.md)) -- [x] WIFI over USB (see [supported hardware](supported_hardware.md)) +- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) +- [x] WIFI over USB (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) - [x] Ethernet over pins (see *Networking* below and wiring diagram at bottom of page) - [x] UART communications with Meshtastic nodes (2 pin pairs) such as RAK Wisblock -- [x] USB serial communications with Meshtastic nodes (see [supported hardware](supported_hardware.md)) +- [x] USB serial communications with Meshtastic nodes (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) - [x] USB mass storage -- [x] Real time clock (RTC) support (see [supported hardware](supported_hardware.md)) +- [x] Real time clock (RTC) support (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware)) - [x] Activity LED disabled. User LED will blink for 5 seconds when boot is complete - [x] Short pressing the "BOOT" button toggles wifi, 2-5 second press triggers reboot, 5+ second press shuts system down - [x] Ability to reconfigure wifi via USB flash drive From 4550289068bdbb2687eb24a10698343bc53ce230 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 23 Feb 2025 14:37:33 +0200 Subject: [PATCH 09/11] Add meshtastic_cli to usb config tool --- .../usr/local/bin/femto-meshtasticd-config.sh | 13 ++++++++----- .../usr/local/bin/femto-usb-config-tool.sh | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 70a0dac..d9c2fec 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -44,11 +44,12 @@ meshtastic_update() { local command="$1" local attempts=$2 local ref="$3: " + echo "${ref:+$ref}meshtastic --host $command" echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do - local output=$(meshtastic --host $command 2>&1 | tee $(if [ -e /dev/tty ]; then echo /dev/tty; else echo /dev/ttyFIQ0; fi)) - logger $output - if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then + output=$(meshtastic --host --info | tee /dev/fd/2) + logger "$output" + if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno|failed|Failed"; then if [ "$retries" -lt $attempts ]; then local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..." echo "$msg" @@ -177,8 +178,10 @@ get_meshtastic_settings() { eval "url_primary_channel='$(echo "$meshtastic_info" | sed -n 's/^Primary channel URL: //p')'" [[ "$1" != *"quiet"* ]] && echo "url_primary_channel:$url_primary_channel" - eval "url_all_channels='$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')'" - [[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels" + if echo "$meshtastic_info" | grep -q "^Complete URL (includes all channels): "; then + url_all_channels=$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p') + [[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels" + fi fi } diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 5096583..5bf0574 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -270,6 +270,13 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_security_command+=" -o \"$meshtastic_legacy_admin\"" # add to the command list fi + # get meshtastic_cli= lines and run them + while IFS='=' read -r key value; do + log_message "Meshtastic CLI command found." + femto-meshtasticd-config.sh -m "$value" 3 "Meshtastic CLI command" 2>&1 | tee -a /tmp/femtofox-config.log + found_config=true + done < <(grep '^meshtastic_cli=' "$usb_config" | sed -E 's/^meshtastic_cli=["]?(.*[^"])["]?$/meshtastic_cli=\1/') + if [ "$found_config" = true ]; then #if we found a config file containing valid data if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi log_message "Making changes to wifi settings and restarting wifi." From 0cdd6f7125f07b95d0ef95f607e3cd62a676debf Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 23 Feb 2025 15:52:25 +0200 Subject: [PATCH 10/11] Fix meshtastic_cli support --- assets/femtofox-config.txt | 5 +++++ .../usr/local/bin/femto-meshtasticd-config.sh | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/femtofox-config.txt b/assets/femtofox-config.txt index 22d3ca1..01e4d3c 100644 --- a/assets/femtofox-config.txt +++ b/assets/femtofox-config.txt @@ -21,6 +21,11 @@ ### Meshtastic settings +## Multiple meshtastic_cli lines can be added. This is important, as the Meshtastic CLI requires that different settings categories (such as device and lora) be handled in separate commands. +## See Meshtastic CLI docs (https://meshtastic.org/docs/software/python/cli/) for more information. +#meshtastic_cli="--set lora.modem_preset LONG_FAST" +#meshtastic_cli="--set device.role CLIENT" + ## Radio module to use. Options are: ## "ebyte-e22-900m30s" ## "ebyte-e22-900m22s" diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index d9c2fec..1e9c80e 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -47,9 +47,9 @@ meshtastic_update() { echo "${ref:+$ref}meshtastic --host $command" echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do - output=$(meshtastic --host --info | tee /dev/fd/2) + output=$(eval meshtastic --host $command 2>&1 | tee /dev/fd/2) # display the output on screen live. Use eval so quotes will be handled correctly in $command logger "$output" - if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno|failed|Failed"; then + if echo "$output" | grep -qiE "Abort|invalid|Error|error|unrecognized|refused|Errno|failed|Failed"; then if [ "$retries" -lt $attempts ]; then local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..." echo "$msg" From 581236ad7b61b8b29ea79c010c1f5a35ae07b95c Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 24 Feb 2025 22:46:26 +0200 Subject: [PATCH 11/11] Add new meshing-around dependencies --- environment-setup/femtofox.chroot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-setup/femtofox.chroot b/environment-setup/femtofox.chroot index d0274df..73d2b87 100644 --- a/environment-setup/femtofox.chroot +++ b/environment-setup/femtofox.chroot @@ -39,7 +39,8 @@ DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force- echo "Installing dependencies for meshing-around and meshtastic cli..." #pip config set global.extra-index-url https://www.piwheels.org/simple -pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python +pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python pubsub datetime + if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi echo "Downloading ttyd and enabling service..."