1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Merge pull request #111 from Ysurac/develop

sync
This commit is contained in:
suyuan 2022-03-14 16:08:47 +08:00 committed by GitHub
commit 310afd6848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 23 additions and 1774 deletions

View file

@ -15,4 +15,3 @@ CONFIG_TARGET_SQUASHFS_BLOCK_SIZE=64
CONFIG_KERNEL_SWAP=y CONFIG_KERNEL_SWAP=y
CONFIG_PREINITOPT=y CONFIG_PREINITOPT=y
CONFIG_PACKAGE_kmod-r2ec=y CONFIG_PACKAGE_kmod-r2ec=y
CONFIG_PACKAGE_mnfinfo=y

View file

@ -1,58 +0,0 @@
#
# Copyright (C) 2020 Teltonika
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/download.mk
PKG_NAME:=mnfinfo
PKG_VERSION:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/mnfinfo
SECTION:=net
CATEGORY:=Network
TITLE:=Device mnf-info command line interface
DEPENDS:=+libpthread +libmnfinfo
endef
define Package/libmnfinfo
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Device mnf-info API library
endef
define Package/rpcd-mod-mnfinfo
SECTION:=libs
CATEGORY:=Libraries
TITLE:=mnfinfo rpcd module
DEPENDS:=+rpcd +libmnfinfo
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include/libmnfinfo
$(CP) $(PKG_BUILD_DIR)/*.so $(STAGING_DIR)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/src/include/*.h $(STAGING_DIR)/usr/include/libmnfinfo/
endef
define Package/mnfinfo/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mnf_info $(1)/sbin/mnf_info
endef
define Package/libmnfinfo/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libmnfinfo.so $(1)/usr/lib/
endef
define Package/rpcd-mod-mnfinfo/install
$(INSTALL_DIR) $(1)/usr/lib/rpcd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mnfinfo.so $(1)/usr/lib/rpcd/
endef
$(eval $(call BuildPackage,mnfinfo))
$(eval $(call BuildPackage,libmnfinfo))
$(eval $(call BuildPackage,rpcd-mod-mnfinfo))

View file

@ -1,35 +0,0 @@
MNF_SOURCES = src/mnf_info.c
MNF_OBJS = $(MNF_SOURCES:.c=.o)
MNF_TARGET = mnf_info
MNF_RPC_SOURCES = src/mnf_rpc.c
MNF_RPC_OBJS = $(MNF_RPC_SOURCES:.c=.o)
MNF_RPC_TARGET = mnfinfo.so
LIB_SOURCES = src/libmnfinfo.c
LIB_OBJS = $(LIB_SOURCES:.c=.o)
LIB_TARGET = libmnfinfo.so
CFLAGS += -Wall -Wextra -Wpedantic -Werror -Wno-missing-braces -Wno-unused-function -Wno-unused-parameter -fPIC -I src/include
LDFLAGS += -L.
MNF_LDFLAGS =
MNF_RPC_LDFLAGS = -lmnfinfo
RM = rm -f
all: $(LIB_TARGET) $(MNF_RPC_TARGET) $(MNF_TARGET)
$(LIB_TARGET): $(LIB_OBJS)
$(CC) $(LDFLAGS) -shared -o $@ $^
$(MNF_RPC_TARGET): $(MNF_RPC_OBJS) $(LIB_TARGET)
$(CC) $(LDFLAGS) $(MNF_RPC_LDFLAGS) -shared -o $@ $^
$(MNF_TARGET): $(MNF_OBJS) $(LIB_OBJS)
$(CC) $(LDFLAGS) $(MNF_LDFLAGS) -o $@ $^
clean:
$(RM) $(LIB_OBJS) $(LIB_TARGET)
$(RM) $(MNF_RPC_OBJS) $(MNF_RPC_TARGET)
$(RM) $(MNF_OBJS) $(MNF_TARGET)

View file

@ -1,25 +0,0 @@
# libmnfinfo
How it works: depending on the platform, selected in the menuconfig, a different platform flag is defined during compilation. Depending on that flag, a header file with platform-specific MTD field defines is included. Here are all the defines, (currently) used for these headers:
* `MAX_SIM_ID` - maximum allowed SIM index on the platform.
* `MTD_CONFIG_RO` - absolute path of a read-only MTD partition. Used for most field reads.
* `MTD_CONFIG_RW` - absolute path of a read/write MTD partition. Used for SIM PIN value reads/writes.
* `MAC_OFFSET` - MAC field offset in the `MTD_CONFIG_RO` partition.
* `MAC_LENGTH` - MAC field length in the `MTD_CONFIG_RO` partition.
* `NAME_OFFSET` - product name field offset in the `MTD_CONFIG_RO` partition.
* `NAME_LENGTH` - product name field length in the `MTD_CONFIG_RO` partition.
* `WPS_OFFSET` - WPS field offset in the `MTD_CONFIG_RO` partition.
* `WPS_LENGTH` - WPS field length in the `MTD_CONFIG_RO` partition.
* `SERIAL_OFFSET` - product serial code field offset in the `MTD_CONFIG_RO` partition.
* `SERIAL_LENGTH` - product serial code field length in the `MTD_CONFIG_RO` partition.
* `BATCH_OFFSET` - batch index field offset in the `MTD_CONFIG_RO` partition.
* `BATCH_LENGTH` - batch index field length in the `MTD_CONFIG_RO` partition.
* `HWVER_OFFSET` - hardware version index field offset in the `MTD_CONFIG_RO` partition.
* `HWVER_LENGTH` - hardware version index field length in the `MTD_CONFIG_RO` partition.
* `SIMPIN_OFFSET` - SIM card PIN code field offset in the `MTD_CONFIG_RW` partition.
* `SIMPIN_LENGTH` - SIM card PIN code field length in the `MTD_CONFIG_RW` partition.
* `WIFI_OFFSET` - Wi-Fi password field offset in the `MTD_CONFIG_RO` partition.
* `WIFI_LENGTH` - Wi-Fi password field length in the `MTD_CONFIG_RO` partition.
Only defines with actual values should be written. All other defines should be removed from the platform-specific header file.

View file

@ -1,115 +0,0 @@
#include <stdint.h>
#include <stdbool.h>
#define STRING_NA(a) do { (a)[0] = 'N'; (a)[1] = '/'; (a)[2] = 'A'; (a)[3] = 0; } while(0)
#define STRING_NA_LENGTH 3
#define PARTITION_SIZE 0xA0
#define SECTION_SIZE 0x10
#if defined(RUTX_PLATFORM)
#include "rutx.h"
#elif defined(TRB1_PLATFORM)
#include "trb1.h"
#elif defined(TRB2_PLATFORM)
#include "trb2.h"
#elif defined(RUT2_PLATFORM)
#include "rut2.h"
#elif defined(RUT300_PLATFORM) || defined(RUT360_PLATFORM)
#include "rut3.h"
#else
#error Platform not recognized!
#endif
#if !(defined(MAC_OFFSET) && defined(MAC_LENGTH))
#undef MAC_OFFSET
#undef MAC_LENGTH
#define MAC_OFFSET 0
#define MAC_LENGTH STRING_NA_LENGTH
#else
#define MAC_ENABLED
#endif
#if !(defined(NAME_OFFSET) && defined(NAME_LENGTH))
#undef NAME_OFFSET
#undef NAME_LENGTH
#define NAME_OFFSET 0
#define NAME_LENGTH STRING_NA_LENGTH
#else
#define NAME_ENABLED
#endif
#if !(defined(WPS_OFFSET) && defined(WPS_LENGTH))
#undef WPS_OFFSET
#undef WPS_LENGTH
#define WPS_OFFSET 0
#define WPS_LENGTH STRING_NA_LENGTH
#else
#define WPS_ENABLED
#endif
#if !(defined(SERIAL_OFFSET) && defined(SERIAL_LENGTH))
#undef SERIAL_OFFSET
#undef SERIAL_LENGTH
#define SERIAL_OFFSET 0
#define SERIAL_LENGTH STRING_NA_LENGTH
#else
#define SERIAL_ENABLED
#endif
#if !(defined(BATCH_OFFSET) && defined(BATCH_LENGTH))
#undef BATCH_OFFSET
#undef BATCH_LENGTH
#define BATCH_OFFSET 0
#define BATCH_LENGTH STRING_NA_LENGTH
#else
#define BATCH_ENABLED
#endif
#if !(defined(HWVER_OFFSET) && defined(HWVER_LENGTH))
#undef HWVER_OFFSET
#undef HWVER_LENGTH
#define HWVER_OFFSET 0
#define HWVER_LENGTH STRING_NA_LENGTH
#else
#define HWVER_ENABLED
#endif
#if !(defined(SIMPIN_OFFSET) && defined(SIMPIN_LENGTH))
#undef SIMPIN_OFFSET
#undef SIMPIN_LENGTH
#define SIMPIN_OFFSET 0
#define SIMPIN_LENGTH STRING_NA_LENGTH
#else
#define SIMPIN_ENABLED
#endif
#if !(defined(WIFI_OFFSET) && defined(WIFI_LENGTH))
#undef WIFI_OFFSET
#undef WIFI_LENGTH
#define WIFI_OFFSET 0
#define WIFI_LENGTH STRING_NA_LENGTH
#else
#define WIFI_ENABLED
#endif
/*
* mnfinfo_get_*() functions return ptr to static memory, which is not to be free()d!
* the returned memory ptr is safely accessible throughout the using program's runtime
* bad: free(mnfinfo_get_mac());
*
* returns NULL on /dev/mtdX reading failure, "N/A" if the particular device
* doesn't support the field, or a dummy string if the mtdblock space contains garbage
*/
char* mnfinfo_get_mac(void);
char* mnfinfo_get_name(void);
char* mnfinfo_get_maceth(void);
char* mnfinfo_get_sn(void);
char* mnfinfo_get_hwver(void);
char* mnfinfo_get_batch(void);
char* mnfinfo_get_wps(void);
char* mnfinfo_get_wifi_pw(void);
char* mnfinfo_get_sim_pin(uint8_t sim_id);
// returns true on success
bool mnfinfo_set_sim_pin(uint8_t sim_id, const char *pin);

View file

@ -1,21 +0,0 @@
#define MAX_SIM_ID 1
#define MTD_CONFIG_RO "/dev/mtd1"
#define MTD_CONFIG_RW "/dev/mtd1"
#define MAC_OFFSET 0x00
#define MAC_LENGTH 6
#define NAME_OFFSET 0x10
#define NAME_LENGTH 12
#define WPS_OFFSET 0x20
#define WPS_LENGTH 8
#define SERIAL_OFFSET 0x30
#define SERIAL_LENGTH 10
#define BATCH_OFFSET 0x40
#define BATCH_LENGTH 4
#define HWVER_OFFSET 0x50
#define HWVER_LENGTH 4
#define SIMPIN_OFFSET 0x70
#define SIMPIN_LENGTH 4
#define WIFI_OFFSET 0x90
#define WIFI_LENGTH 16

View file

@ -1,21 +0,0 @@
#define MAX_SIM_ID 1
#define MTD_CONFIG_RO "/dev/mtd1"
#define MTD_CONFIG_RW "/dev/mtd1"
#define MAC_OFFSET 0x00
#define MAC_LENGTH 6
#define NAME_OFFSET 0x10
#define NAME_LENGTH 12
#define WPS_OFFSET 0x20
#define WPS_LENGTH 8
#define SERIAL_OFFSET 0x30
#define SERIAL_LENGTH 10
#define BATCH_OFFSET 0x40
#define BATCH_LENGTH 4
#define HWVER_OFFSET 0x50
#define HWVER_LENGTH 4
#define SIMPIN_OFFSET 0x70
#define SIMPIN_LENGTH 4
#define WIFI_OFFSET 0x90
#define WIFI_LENGTH 16

View file

@ -1,21 +0,0 @@
#define MAX_SIM_ID 4
#define MTD_CONFIG_RO "/dev/mtd13"
#define MTD_CONFIG_RW "/dev/mtd14"
#define MAC_OFFSET 0x00
#define MAC_LENGTH 6
#define NAME_OFFSET 0x10
#define NAME_LENGTH 12
#define WPS_OFFSET 0x20
#define WPS_LENGTH 8
#define SERIAL_OFFSET 0x30
#define SERIAL_LENGTH 10
#define BATCH_OFFSET 0x40
#define BATCH_LENGTH 4
#define HWVER_OFFSET 0x50
#define HWVER_LENGTH 4
#define SIMPIN_OFFSET 0x00
#define SIMPIN_LENGTH 4
#define WIFI_OFFSET 0x90
#define WIFI_LENGTH 16

View file

@ -1,17 +0,0 @@
#define MAX_SIM_ID 1
#define MTD_CONFIG_RO "/dev/mtd7"
#define MTD_CONFIG_RW "/dev/mtd7"
#define MAC_OFFSET 0x50
#define MAC_LENGTH 12
#define NAME_OFFSET 0x20
#define NAME_LENGTH 12
#define SERIAL_OFFSET 0x10
#define SERIAL_LENGTH 10
#define BATCH_OFFSET 0x40
#define BATCH_LENGTH 3
#define HWVER_OFFSET 0x30
#define HWVER_LENGTH 4
#define SIMPIN_LENGTH 4
#define SIMPIN_OFFSET 0x70

View file

@ -1,21 +0,0 @@
#define MAX_SIM_ID 2
#define MTD_CONFIG_RO "/dev/mtd1"
#define MTD_CONFIG_RW "/dev/mtd1"
#define MAC_OFFSET 0x00
#define MAC_LENGTH 6
#define NAME_OFFSET 0x10
#define NAME_LENGTH 12
#define WPS_OFFSET 0x20
#define WPS_LENGTH 8
#define SERIAL_OFFSET 0x30
#define SERIAL_LENGTH 10
#define BATCH_OFFSET 0x40
#define BATCH_LENGTH 4
#define HWVER_OFFSET 0x50
#define HWVER_LENGTH 4
#define SIMPIN_OFFSET 0x70
#define SIMPIN_LENGTH 4
#define WIFI_OFFSET 0x90
#define WIFI_LENGTH 16

View file

@ -1,36 +0,0 @@
#!/bin/sh
. /lib/functions/uci-defaults.sh
CFG=/etc/board.json
SLP=30
check_modem() {
json_select "$2"
json_get_vars id
[ -z "$id" ] && {
json_select ..
return 0
}
ttys=$(ls -d /sys/bus/usb/devices/$id/${id}*/tty?*)
[ -n "$ttys" ] || { #FAILED TO FIND MODEM
mctl -s
sleep 1
mctl -p
json_select ..
return 1
}
#MODEM UP
json_select ..
}
board_config_update
while true; do
json_for_each_item check_modem modems
sleep $SLP
[ $SLP -lt 300 ] && SLP=$((SLP+30))
done

View file

@ -135,15 +135,15 @@ generate_network() {
uci set network.$1.proto='dhcp' uci set network.$1.proto='dhcp'
uci set network.$1.metric='1' uci set network.$1.metric='1'
[ -e /proc/sys/net/ipv6 ] && { #[ -e /proc/sys/net/ipv6 ] && {
uci -q batch <<-EOF # uci -q batch <<-EOF
delete network.${1}6 # delete network.${1}6
set network.${1}6='interface' # set network.${1}6='interface'
set network.${1}6.ifname='$ifname' # set network.${1}6.device='$ifname'
set network.${1}6.proto='dhcpv6' # set network.${1}6.proto='dhcpv6'
set network.${1}6.metric='1' # set network.${1}6.metric='1'
EOF # EOF
} #}
;; ;;
pppoe) pppoe)

View file

@ -1,17 +0,0 @@
#!/bin/sh
sig="/tmp/.$(cat /proc/sys/kernel/random/uuid).sig"
check() {
local ipk="$1"
[ -z "$ipk" ] && return 1
tar -xzOf "$ipk" ./control+data.sig > $sig || return 2
tar -xzOf "$ipk" ./control.tar.gz ./data.tar.gz | usign -V -m - -P /etc/opkg/keys -x $sig || return 3
}
check $1
status=$?
rm -f $sig
return $status

View file

@ -193,9 +193,7 @@ setup_json() {
} }
#~ Get model name for RUTX products #~ Get model name for RUTX products
if ! model="$(mnf_info --name)" 2>/dev/null; then model="$(mnf_info --name)" 2>/dev/null
model="$(mnf_info --prod-code)" 2>/dev/null
fi
platform="$(cat /proc/device-tree/platform)" 2>/dev/null platform="$(cat /proc/device-tree/platform)" 2>/dev/null

View file

@ -1,39 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2021 Teltonika Networks
START=96
USE_PROCD=1
PROG=/bin/board_track
NAME=board_track
PIDCOUNT=1
start_service() {
config_load system
config_get modem_track system modem_track 1
[ "$modem_track" != 0 ] || return
local pid_file="/var/run/${NAME}.${PIDCOUNT}.pid"
procd_open_instance
procd_set_param command "$PROG"
procd_set_param file /etc/config/system
procd_set_param respawn
procd_set_param stdout 1
procd_set_param pidfile $pid_file
procd_close_instance
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger "system"
}

View file

@ -1,28 +0,0 @@
#!/bin/sh
. /lib/functions.sh
. /lib/functions/board.sh
set_pin() {
local sim="$1"
local modem position num builtin
config_get modem "$sim" modem
builtin=$(is_builtin_modem "$modem")
[ "$builtin" = "0" ] && return
config_get position "$sim" position
#If modem builtin and primary then position num 3 or 4 else 1 or 2
[ "$builtin" = "2" ] && num=$((position + 2)) || num=$position
pin=`/sbin/mnf_info --simpin $num`
[ -z "$pin" ] && return
uci -q set "simcard"."$sim"."pincode"="$pin"
}
config_load simcard
config_foreach set_pin sim
uci commit simcard
exit 0

View file

@ -1,119 +0,0 @@
#!/bin/sh
. /lib/functions.sh
CONFIG="widget"
MOBILE_CONFIG="/etc/config/simcard"
RMS_CONFIG="/etc/config/rms_connect_mqtt"
WIFI_CONFIG="/etc/config/wireless"
ETHERNET=$(uci -q get network.@switch[0].name)
ethernet_widget_exists=0
mobile_widget_exists=0
system_widget_exists=0
wifi_widget_exists=0
rms_widget_exists=0
position=1
radio0_network=1
radio1_network=1
check_for_widgets() {
local widget="$1"
local type
config_get type "$widget" type
if [ "$type" = "ethernet" ]; then
ethernet_widget_exists=1
elif [ "$type" = "mobile" ]; then
mobile_widget_exists=1
elif [ "$type" = "system" ]; then
system_widget_exists=1
elif [ "$type" = "wifi" ]; then
wifi_widget_exists=1
elif [ "$type" = "rms" ]; then
rms_widget_exists=1
fi
}
setup_wifi_fields() {
local iface_section="$1"
local device
config_get device "$iface_section" device
section=$(uci -q add widget widget)
if [ "$device" == "radio0" ]; then
uci -q set $CONFIG."${section}.id"=$device."network${radio0_network}"
let "radio0_network=radio0_network + 1"
elif [ "$device" == "radio1" ]; then
uci -q set $CONFIG."${section}.id"=$device."network${radio1_network}"
let "radio1_network=radio1_network + 1"
fi
uci -q set $CONFIG."${section}.type=wifi"
uci -q set $CONFIG."${section}.position=${position}"
uci -q set $CONFIG."${section}.enabled=1"
let "position=position + 1"
}
check_if_config_exists() {
if [ ! -f "/etc/config/${CONFIG}" ]; then
touch "/etc/config/${CONFIG}"
fi
}
setup_side_widget() {
config_load widget
config_foreach check_for_widgets widget
if [ $ethernet_widget_exists -eq 0 -a -n "$ETHERNET" ]; then
check_if_config_exists
section=$(uci -q add widget widget)
uci -q set $CONFIG."${section}.id=widget1"
uci -q set $CONFIG."${section}.type=ethernet"
uci -q set $CONFIG."${section}.position=${position}"
uci -q set $CONFIG."${section}.enabled=1"
let "position=position + 1"
fi
if [ $mobile_widget_exists -eq 0 -a -s "$MOBILE_CONFIG" -a -f "$MOBILE_CONFIG" ]; then
check_if_config_exists
modem_count=$(jsonfilter -q -i /etc/board.json -e '@["modems"][*]' | wc -l)
for i in $(seq $modem_count)
do
section=$(uci -q add widget widget)
uci -q set $CONFIG."${section}.id=mobile-widget$i"
uci -q set $CONFIG."${section}.type=mobile"
uci -q set $CONFIG."${section}.position=${position}"
uci -q set $CONFIG."${section}.enabled=1"
let "position=position + 1"
done
fi
if [ $system_widget_exists -eq 0 ]; then
check_if_config_exists
section=$(uci -q add widget widget)
uci -q set $CONFIG."${section}.id=widget3"
uci -q set $CONFIG."${section}.type=system"
uci -q set $CONFIG."${section}.position=${position}"
uci -q set $CONFIG."${section}.enabled=1"
let "position=position + 1"
fi
if [ $wifi_widget_exists -eq 0 -a -f "$WIFI_CONFIG" ]; then
check_if_config_exists
config_load wireless
config_foreach setup_wifi_fields wifi-iface
fi
if [ $rms_widget_exists -eq 0 -a -f "$RMS_CONFIG" ]; then
check_if_config_exists
section=$(uci -q add widget widget)
uci -q set $CONFIG."${section}.id=widget5"
uci -q set $CONFIG."${section}.type=rms"
uci -q set $CONFIG."${section}.position=${position}"
uci -q set $CONFIG."${section}.enabled=1"
let "position=position + 1"
fi
uci -q commit $CONFIG
}
setup_side_widget
exit 0

View file

@ -1,16 +0,0 @@
#!/bin/sh
[ -n "$(uci -q get system.modem.disable)" ] || {
for m in /sys/class/gpio/modem*_power; do
local label="$(basename $m | awk -F_ '{print $1}')"
uci set "system.${label}=mctl"
uci set "system.${label}.disable=0"
# modem is turned on in preinit but others are not
[ "${label}" != "modem" ] && /sbin/mctl -p -m "${label}"
done
uci commit system
}
exit 0

View file

@ -1,35 +0,0 @@
#!/bin/sh
. /lib/functions.sh
CONFIG="/etc/config/user_groups"
migrate_tel_list() {
local tel="$1"
local new_section="$2"
uci -q add_list user_groups."$new_section".tel="$tel"
}
migrate_group() {
local group="$1"
local name
config_get name "$group" name ""
local new_section=`uci -q add user_groups phone`
uci -q set user_groups."$new_section".name="$name"
config_list_foreach "$group" tel migrate_tel_list "$new_section"
uci -q delete sms_utils."$group"
}
if [ ! -e "$CONFIG" ]; then
touch "$CONFIG"
fi
config_load sms_utils
config_foreach migrate_group group
uci -q commit user_groups
uci -q commit sms_utils
exit 0

View file

@ -1,140 +0,0 @@
#!/bin/sh
[ -e /etc/config/strongswan ] || exit 0
. /lib/functions.sh
ENABLED=0
move_config() {
local name=$1
#get old config
config_get_bool enabled "$1" "enabled" "0"
config_get keyexchange "$1" "keyexchange"
config_get aggressive "$1" "aggressive"
config_get ipsec_type "$1" "ipsec_type"
config_get my_identifier_type "$1" "my_identifier_type"
config_get my_identifier "$1" "my_identifier"
config_get leftfirewall "$1" "leftfirewall"
config_get forceencaps "$1" "forceencaps"
config_get dpdaction "$1" "dpdaction" "none"
config_get dpddelay "$1" "dpddelay"
config_get dpdtimeout "$1" "dpdtimeout"
config_get psk_key "$1" "psk_key"
config_get right "$1" "right"
config_get rightfirewall "$1" "rightfirewall"
config_get ike_encryption_algorithm "$1" "ike_encryption_algorithm"
config_get ike_authentication_algorithm "$1" "ike_authentication_algorithm"
config_get ike_dh_group "$1" "ike_dh_group"
config_get ikelifetime "$1" "ikelifetime"
config_get esp_encryption_algorithm "$1" "esp_encryption_algorithm"
config_get esp_hash_algorithm "$1" "esp_hash_algorithm"
config_get esp_pfs_group "$1" "esp_pfs_group"
config_get keylife "$1" "keylife"
config_get leftsubnet "$1" "leftsubnet"
config_get rightsubnet "$1" "rightsubnet"
config_get leftprotoport "$1" "leftprotoport"
config_get rightprotoport "$1" "rightprotoport"
[ "$enabled" = 1 ] && ENABLED=1
#set new config structure
config_set
uci_add "ipsec" "proposal" "${name}_ph1"
uci_set "ipsec" $CONFIG_SECTION "encryption_algorithm" "$ike_encryption_algorithm"
uci_set "ipsec" $CONFIG_SECTION "hash_algorithm" "$ike_authentication_algorithm"
uci_set "ipsec" $CONFIG_SECTION "dh_group" "$ike_dh_group"
uci_add "ipsec" "proposal" "${name}_ph2"
uci_set "ipsec" $CONFIG_SECTION "encryption_algorithm" "$esp_encryption_algorithm"
uci_set "ipsec" $CONFIG_SECTION "hash_algorithm" "$esp_hash_algorithm"
uci_set "ipsec" $CONFIG_SECTION "dh_group" "$esp_pfs_group"
uci_add "ipsec" "connection" "${name}_c"
uci_set "ipsec" $CONFIG_SECTION "mode" "start"
uci_set "ipsec" $CONFIG_SECTION "type" "$ipsec_type"
uci_set "ipsec" $CONFIG_SECTION "local_subnet" "$leftsubnet"
uci_set "ipsec" $CONFIG_SECTION "remote_subnet" "$rightsubnet"
uci_set "ipsec" $CONFIG_SECTION "remote_firewall" "$rightfirewall"
uci_set "ipsec" $CONFIG_SECTION "keyexchange" "$keyexchange"
uci_set "ipsec" $CONFIG_SECTION "aggressive" "$aggressive"
uci_set "ipsec" $CONFIG_SECTION "ikelifetime" "$ikelifetime"
uci_set "ipsec" $CONFIG_SECTION "lifetime" "$lifetime"
[ -n "$dpdaction" ] && {
uci_set "ipsec" $CONFIG_SECTION "_dpd" "1"
uci_set "ipsec" $CONFIG_SECTION "dpdaction" "$dpdaction"
uci_set "ipsec" $CONFIG_SECTION "dpddelay" "$dpddelay"
}
uci_set "ipsec" $CONFIG_SECTION "crypto_proposal" "${name}_ph2"
uci_set "ipsec" $CONFIG_SECTION "leftprotoport" "$leftprotoport"
uci_set "ipsec" $CONFIG_SECTION "rightprotoport" "$rightprotoport"
uci_set "ipsec" $CONFIG_SECTION "lifetime" "$keylife"
uci_set "ipsec" $CONFIG_SECTION "forceencaps" "$forceencaps"
uci_add "ipsec" "remote" "${name}"
uci_set "ipsec" $CONFIG_SECTION "enabled" "$enabled"
uci_set "ipsec" $CONFIG_SECTION "gateway" "$right"
uci_set "ipsec" $CONFIG_SECTION "remote_identifier" "%any"
uci_set "ipsec" $CONFIG_SECTION "authentication_method" "psk"
uci_set "ipsec" $CONFIG_SECTION "pre_shared_key" "$psk_key"
uci_set "ipsec" $CONFIG_SECTION "local_identifier" "$my_identifier"
uci_set "ipsec" $CONFIG_SECTION "crypto_proposal" "${name}_ph1"
[ "$ipsec_type" = "tunnel" ] && uci -q add_list "ipsec"."${CONFIG_SECTION}"."tunnel"="${name}_c"
[ "$ipsec_type" = "transport" ] && uci -q add_list "ipsec"."${CONFIG_SECTION}"."transport"="${name}_c"
uci_commit "ipsec"
}
config_load 'strongswan'
config_foreach move_config 'conn'
[ "$ENABLED" = 1 ] && {
uci_add firewall rule
uci_set firewall "$CONFIG_SECTION" src 'wan'
uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-ESP'
uci_set firewall "$CONFIG_SECTION" target 'ACCEPT'
uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec'
uci_set firewall "$CONFIG_SECTION" proto 'esp'
uci_add firewall rule
uci_set firewall "$CONFIG_SECTION" dest_port '4500'
uci_set firewall "$CONFIG_SECTION" src 'wan'
uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-NAT-T'
uci_set firewall "$CONFIG_SECTION" target 'ACCEPT'
uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec'
uci_set firewall "$CONFIG_SECTION" proto 'udp'
uci_add firewall rule
uci_set firewall "$CONFIG_SECTION" dest_port '500'
uci_set firewall "$CONFIG_SECTION" src 'wan'
uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-IKE'
uci_set firewall "$CONFIG_SECTION" target 'ACCEPT'
uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec'
uci_set firewall "$CONFIG_SECTION" proto 'udp'
uci_add firewall rule
uci_set firewall "$CONFIG_SECTION" src 'wan'
uci_set firewall "$CONFIG_SECTION" name 'Allow-IPsec-Forward'
uci_set firewall "$CONFIG_SECTION" extra '-m policy --dir in --pol ipsec'
uci_set firewall "$CONFIG_SECTION" target 'ACCEPT'
uci_set firewall "$CONFIG_SECTION" vpn_type 'IPsec'
uci_set firewall "$CONFIG_SECTION" dest '*'
uci_set firewall "$CONFIG_SECTION" proto 'all'
uci_add firewall redirect
uci_set firewall "$CONFIG_SECTION" proto any
uci_set firewall "$CONFIG_SECTION" name Exclude-IPsec-from-NAT
uci_set firewall "$CONFIG_SECTION" extra '-m policy --dir out --pol ipsec'
uci_set firewall "$CONFIG_SECTION" vpn_type IPsec
uci_set firewall "$CONFIG_SECTION" target ACCEPT
uci_set firewall "$CONFIG_SECTION" dest wan
uci_set firewall "$CONFIG_SECTION" enabled 1
uci_commit firewall
}
rm -f /etc/config/strongswan
exit 0

View file

@ -1,82 +0,0 @@
#!/bin/sh
. /lib/functions.sh
#this script move configuration from 1.x firmware
#it should rename some sections and add option disabled to network config
move_config() {
local section="$1"
local file="$2"
config_get_bool enabled "$1" "enabled" "0"
config_get _name "$1" "_name"
config_get _type "$1" "_type"
[ -z "$_type" ] && config_get _type "$1" "type"
[ "$enabled" -eq 1 ] && [ "$_type" = "client" ] && {
uci set network."$1".auto=1
uci_commit "${config}"
}
[ "${_type}_${_name}" = "$section" ] && return
uci_rename "$file" "$section" "${_type:+${_type}_}${_name}"
uci_commit "${config}"
}
move_network() {
local section="$1"
local net_proto net_name net_type net_enabled
config_get net_proto "$section" "proto"
case "$net_proto" in
pptp|\
l2tp)
config_get net_name "$1" "_name"
config_get_bool net_enabled "$1" "enabled"
[ "client_${net_name}" = "$section" ] && return
[ -n "$net_enabled" ] && {
[ "$net_enabled" = "1" ] && uci_set network "$section" disabled 0 || uci_set network "$section" disabled 1
uci_remove network "$section" enabled
}
uci_rename network "$section" "${net_type:+${net_type}_}${net_name}"
uci_commit network
;;
sstp)
config_get_bool net_enabled "$1" "enabled"
[ -z "$net_enabled" ] && return
[ "$net_enabled" = "1" ] && uci_set network "$section" disabled 0 || uci_set network "$section" disabled 1
uci_remove network "$section" enabled
uci_commit network
;;
*)
return
;;
esac
}
# removes client configurations, because they reside in network and with vuci became unncessary
remove_network() {
local section="$1"
local current_config="$2"
local sectionType
config_get sectionType "$1" "type"
if [ "$sectionType" = "client" ]; then
uci_remove "$current_config" "$section"
uci_commit "$current_config"
fi
}
configs="pptpd xl2tpd"
for config in $configs; do
[ -s /etc/config/${config} ] || continue
config_load "$config"
config_foreach move_config "service" "$config"
config_foreach remove_network "service" "$config"
done
[ -s /etc/config/network ] || exit 0
config_load "network"
config_foreach move_network "interface"
exit 0

View file

@ -1,10 +0,0 @@
#!/bin/sh
do_stm32_autoflash() {
# launch STM32 flash utility
[ -e "/sys/r2ec/reset" -a -f /usr/bin/autoflash ] && {
/usr/bin/autoflash
}
}
[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_stm32_autoflash

View file

@ -1,20 +0,0 @@
set_state() {
local label="$1"
local disable
[ -e "/sys/class/gpio/${label}_power/value" ] || return
config_get disable ${label} disable
[ "${disable}" -eq 1 ] && \
/sbin/mctl -s -m "${label}" || \
/sbin/mctl -p -m "${label}"
}
do_power_modem() {
[ -z "$(uci -q get system.modem.disable)" ] && /sbin/mctl -p || {
config_load system
config_foreach set_state mctl
}
}
boot_hook_add preinit_main do_power_modem

View file

@ -1,21 +0,0 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
do_check_version() {
version="$(uci -q get system.@system[0].device_fw_version)"
[ -z "$version" ] && {
return 0
}
numeric_version="${version##*_}"
client_removed="${numeric_version#*.}"
major="${client_removed%%.*}"
[ -f /sysupgrade.tgz ] && [ -n "$major" ] && [ "$major" -lt 2 ] && {
echo "- migration work -"
cp /rom/etc/inittab /etc/inittab
}
}
[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_check_version

View file

@ -184,7 +184,9 @@ platform_do_upgrade() {
PART_NAME="inactive" PART_NAME="inactive"
platform_do_upgrade_dualboot_datachk "$1" platform_do_upgrade_dualboot_datachk "$1"
;; ;;
teltonika,rutx |\ teltonika,rutx)
platform_do_upgrade_ipq "$1"
;;
zte,mf286d) zte,mf286d)
CI_UBIPART="rootfs" CI_UBIPART="rootfs"
nand_do_upgrade "$1" nand_do_upgrade "$1"

View file

@ -1,120 +0,0 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
PS_ON=1
PS_OFF=2
MPS=0
MLBL="modem"
modem_reset() {
local label="$1"
[ -e "/sys/class/gpio/${label}_reset/value" ] || return
echo 1 > "/sys/class/gpio/${label}_reset/value"
sleep 1
echo 0 > "/sys/class/gpio/${label}_reset/value"
}
modem_off() {
local label="$1"
[ -e "/sys/class/gpio/${label}_reset/value" ] || return
echo 1 > "/sys/class/gpio/${label}_reset/value"
}
modem_power() {
local label="$1"
[ -e "/sys/class/gpio/${label}_power/value" ] || return
# simulate power press
echo 1 > "/sys/class/gpio/${label}_power/value"
sleep 1
echo 0 > "/sys/class/gpio/${label}_power/value"
}
modem_list() {
local list="modem"
local label
[ "$(modem_fetch_primary)" -eq 0 ] && {
echo "${list}"
return
}
for m in /sys/class/gpio/modem*_power; do
label="$(basename $m | awk -F_ '{print $1}')"
[ "${label}" != "modem" ] && list="${list},${label}"
done
echo "${list}"
}
modem_fetch_primary() {
local modem modems primary
json_init
json_load_file "/etc/board.json"
json_get_keys modems modems
json_select modems
for modem in $modems; do
json_select "$modem"
json_get_vars primary
[ -n "$primary" ] && {
echo 1
return
}
json_select ..
done
echo 0
}
modem_is_available() {
local label="$1"
[ -e "/sys/class/gpio/${label}_power/value" ]
}
usage() {
cat <<EOF
Usage $0 <option>
Control modem power state.
Options:
-p, --power-on power on modem
-s, --shutdown shutdown modem
-r, --reboot reboot modem
-m, --modem <label> use specified modem instead of default one
Available modem labels:
$(modem_list)
EOF
exit 1
}
while [ -n "$1" ]; do
case "$1" in
-p | --power-on) MPS="${PS_ON}";;
-s | --shutdown) MPS="${PS_OFF}";;
-r | --reboot) MPS="${PS_ON}";;
-m | --modem) MLBL="$2"; shift;;
-*) echo "Invalid option: $1"; usage;;
*) break;;
esac
shift
done
[ "${MPS}" -eq 0 ] && usage
modem_is_available "${MLBL}" || usage
case "${MPS}" in
"${PS_ON}") modem_reset "${MLBL}"; sleep 1; modem_power "${MLBL}";;
"${PS_OFF}") modem_off "${MLBL}";;
esac

View file

@ -0,0 +1,10 @@
#!/bin/sh
while [[ $# -gt 0 ]]; do
case $1 in
-n|--name)
echo $(dd if=/dev/mtd13 bs=1 count=12 skip=16 2>/dev/null)
shift
;;
esac
done

View file

@ -1,14 +0,0 @@
#!/bin/sh
tar_file="/etc/default-config/config.tar.gz"
[ ! -f "$tar_file" ] && return 1
/usr/bin/ledman --clean
cp $tar_file /tmp/user_defaults.tgz
firstboot -y
[ -d /tmp/overlay ] || mkdir /tmp/overlay
mount -t ubifs ubi0:rootfs_data /tmp/overlay
cp /tmp/user_defaults.tgz /tmp/overlay/
sync
umount /tmp/overlay

View file

@ -1,57 +0,0 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ {
model = "RUTX08/10";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&shift_io 3 GPIO_ACTIVE_HIGH>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
};
};
leds {
compatible = "gpio-leds";
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,122 +0,0 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ {
model = "RUTX09/11";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&shift_io 3 GPIO_ACTIVE_LOW>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&shift_io 21 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&shift_io 22 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_wifi_4"; // not wan_eth_3 !
gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>;
};
led_wan_wifi {
label = "wan_eth_3"; // not wan_wifi_4 !
gpios = <&shift_io 20 GPIO_ACTIVE_HIGH>;
};
led_gen_2 {
label = "mob_gen_2";
gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&shift_io 8 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&shift_io 14 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&shift_io 15 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,149 +0,0 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ {
model = "RUTX12";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 16 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 17 GPIO_ACTIVE_HIGH>;
};
gpio_modem2_reset {
gpio-export,name = "modem2_reset";
gpio-export,output = <0>;
gpios = <&shift_io 18 GPIO_ACTIVE_HIGH>;
};
gpio_modem2_power {
gpio-export,name = "modem2_power";
gpio-export,output = <0>;
gpios = <&shift_io 19 GPIO_ACTIVE_HIGH>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpios = <&shift_io 20 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&shift_io 14 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&shift_io 15 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_wifi_4"; // not wan_eth_3 !
gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
};
led_wan_wifi {
label = "wan_eth_3"; // not wan_wifi_4 !
gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
};
led_gen_2 {
label = "mob_gen_2";
gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&shift_io 4 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&shift_io 3 GPIO_ACTIVE_HIGH>;
};
led2_gen_2 {
label = "mob2_gen_2";
gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>;
};
led2_gen_3 {
label = "mob2_gen_3";
gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>;
};
led2_gen_4 {
label = "mob2_gen_4";
gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led2_ssid_1 {
label = "mob2_ssid_1";
gpios = <&shift_io 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led2_ssid_3 {
label = "mob2_ssid_3";
gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led2_ssid_5 {
label = "mob2_ssid_5";
gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&shift_io 22 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&shift_io 23 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,84 +0,0 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi"
#include "qcom-ipq4018-rutx-i2c.dtsi" // SFP
/ {
model = "RUTXR1";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&shift_io 3 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&shift_io 4 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&shift_io 5 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_wifi_4"; // not wan_eth_3 !
gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>;
};
led_wan_mob {
label = "wan_mob_5";
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&shift_io 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
};
};
};

View file

@ -1,188 +0,0 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-i2c.dtsi"
/ {
model = "RUTX STM32";
io_expander = "stm32";
soc {
i2c_0: i2c@78b7000 {
stm32_io: stm32@74 {
#gpio-cells = <2>;
compatible = "tlt,stm32v1";
reg = <0x74>;
gpio-controller;
interrupt-parent = <&tlmm>;
interrupts = <5 2>;
interrupt-controller;
#interrupt-cells = <2>;
};
};
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>;
};
gpio_modem2_reset {
gpio-export,name = "modem2_reset";
gpio-export,output = <0>;
gpios = <&stm32_io 13 GPIO_ACTIVE_HIGH>;
};
gpio_modem2_power {
gpio-export,name = "modem2_power";
gpio-export,output = <0>;
gpios = <&stm32_io 14 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&stm32_io 22 GPIO_ACTIVE_LOW>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&stm32_io 0 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&stm32_io 1 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_eth_3";
gpios = <&stm32_io 2 GPIO_ACTIVE_HIGH>;
};
led_wan_wifi {
label = "wan_wifi_4";
gpios = <&stm32_io 3 GPIO_ACTIVE_HIGH>;
};
led_wan_mob {
label = "wan_mob_5";
gpios = <&stm32_io 16 GPIO_ACTIVE_HIGH>;
};
led_gen_2 {
label = "mob_gen_2";
gpios = <&stm32_io 4 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&stm32_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&stm32_io 6 GPIO_ACTIVE_HIGH>;
};
led2_gen_2 {
label = "mob2_gen_2";
gpios = <&stm32_io 32 GPIO_ACTIVE_HIGH>;
};
led2_gen_3 {
label = "mob2_gen_3";
gpios = <&stm32_io 33 GPIO_ACTIVE_HIGH>;
};
led2_gen_4 {
label = "mob2_gen_4";
gpios = <&stm32_io 34 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&stm32_io 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&stm32_io 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&stm32_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led2_ssid_1 {
label = "mob2_ssid_1";
gpios = <&stm32_io 31 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led2_ssid_3 {
label = "mob2_ssid_3";
gpios = <&stm32_io 30 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led2_ssid_5 {
label = "mob2_ssid_5";
gpios = <&stm32_io 29 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&stm32_io 19 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&stm32_io 18 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,84 +0,0 @@
#include "qcom-ipq4019-ap.dk01.1.dtsi"
#include <dt-bindings/gpio/gpio.h>
//#include "platform_name.dtsi"
/ {
compatible = "teltonika,rutx", "qcom,ap-dk01.1-c2", "qcom,ipq4019";
memory {
device_type = "memory";
reg = <0x80000000 0x10000000>;
};
soc {
mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 62 0>;
ethphy4: ethernet-phy@4 {
qcom,fiber-enable;
};
};
pinctrl@1000000 {
mdio_pins: mdio_pinmux {
mux_1 {
pins = "gpio53";
function = "mdio";
bias-pull-up;
};
mux_2 {
pins = "gpio52";
function = "mdc";
bias-pull-up;
};
};
};
spi_0: spi@78b5000 {
cs-gpios = <&tlmm 54 0>, <&tlmm 63 0>;
num-cs = <2>;
mx25l25635f@0 {
compatible = "n25q128a11", "mx25l25635f", "jedec,spi-nor";
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
spi-max-frequency = <24000000>;
};
mt29f@1 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand","spinand,mt29f";
reg = <1>;
spi-max-frequency = <24000000>;
};
};
gpio_keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&tlmm 4 1>;
linux,code = <0x198>;
};
};
usb3: usb3@8af8800 {
dwc3@8a00000 {
snps,dis_u2_susphy_quirk;
snps,dis_u3_susphy_quirk;
};
};
usb2: usb2@60f8800 {
dwc3@6000000 {
snps,dis_u2_susphy_quirk;
};
};
};
};

View file

@ -1,20 +0,0 @@
/ {
soc {
pinctrl@1000000 {
i2c_0_pins: i2c_0_pinmux {
mux {
pins = "gpio58", "gpio59";
function = "blsp_i2c0";
bias-disable;
};
};
};
i2c_0: i2c@78b7000 { /* BLSP1 QUP2 */
pinctrl-0 = <&i2c_0_pins>;
pinctrl-names = "default";
clock-frequency = <400000>;
status = "ok";
};
};
};

View file

@ -1,25 +0,0 @@
/ {
io_expander = "shiftreg_1";
soc {
ext_io {
compatible = "spi-gpio";
#address-cells = <1>;
#size-cells = <0>;
gpio-sck = <&tlmm 1 GPIO_ACTIVE_HIGH>; // SRCLK
gpio-mosi = <&tlmm 3 GPIO_ACTIVE_HIGH>; // SER
cs-gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>; // RCLK
num-chipselects = <1>;
shift_io: shift_io@0 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <3>;
spi-max-frequency = <10000000>;
};
};
};
};