Skip to content

Commit 5224aa9

Browse files
authored
Merge pull request #1372 from kernelkit/misc-fixes
Misc fixes
2 parents 2d9ca0c + 2ed84c2 commit 5224aa9

14 files changed

Lines changed: 195 additions & 109 deletions

File tree

board/common/rootfs/etc/bash.bashrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ log()
4040
less +G -r "$fn"
4141
}
4242

43-
follow()
43+
follow ()
4444
{
4545
local fn="/var/log/syslog"
4646
[ -n "$1" ] && fn="/var/log/$1"
47-
less +F -r "$fn"
47+
48+
tail -F -n +1 "$fn"
4849
}
4950

5051
_logfile_completions()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# --log-level debug
2-
ZEBRA_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog "
2+
ZEBRA_ARGS="-A 127.0.0.1 -u frr -g frr --log syslog --log-level err"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
service name:rousette notify:none log <pid/confd> env:/etc/default/confd \
1+
service name:rousette notify:none log:console <pid/confd> env:/etc/default/confd \
22
[12345] rousette --syslog -t $CONFD_TIMEOUT \
33
-- RESTCONF server
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
service name:wpa_supplicant :%i \
2-
[2345] wpa_supplicant -s -i %i -c /etc/wpa_supplicant-%i.conf -P/var/run/wpa_supplicant-%i.pid \
3-
-- Wi-Fi Station @%i
4-
5-
task name:wifi-scanner :%i [2345] <pid/wpa_supplicant:%i> /usr/libexec/infix/wifi-scanner %i -- Start scanning for SSID @%i
2+
[2345] wpa_supplicant -s -i %i -c /etc/wpa_supplicant-%i.conf -P/var/run/wpa_supplicant-%i.pid \
3+
-- Wi-Fi Station @%i

board/common/rootfs/etc/nginx/nginx.conf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ http {
1919

2020
include /etc/nginx/enabled/*.conf;
2121

22-
access_log syslog:server=unix:/dev/log,nohostname,facility=local7,severity=info;
23-
error_log syslog:server=unix:/dev/log,nohostname,facility=local7 info;
22+
# Skip 2xx and 3xx
23+
# Skip 400 (e.g., rrousette syntax errors)
24+
map $status $loggable {
25+
~^[23] 0;
26+
400 0;
27+
default 1;
28+
}
29+
30+
access_log syslog:server=unix:/dev/log,nohostname,facility=local7,severity=warn combined if=$loggable;
31+
error_log syslog:server=unix:/dev/log,nohostname,facility=local7 warn;
2432
}

board/common/rootfs/usr/libexec/infix/wifi-scanner

Lines changed: 0 additions & 16 deletions
This file was deleted.

configs/aarch64_defconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ BR2_PACKAGE_MARVELL_CN9130_CRB=y
149149
BR2_PACKAGE_MARVELL_ESPRESSOBIN=y
150150
BR2_PACKAGE_RASPBERRYPI_RPI64=y
151151
BR2_PACKAGE_STYX_DCP_SC_28P=y
152-
BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK=y
152+
BR2_PACKAGE_FEATURE_WIFI_MEDIATEK=y
153+
BR2_PACKAGE_FEATURE_WIFI_REALTEK=y
153154
BR2_PACKAGE_CONFD=y
154155
BR2_PACKAGE_CONFD_TEST_MODE=y
155156
BR2_PACKAGE_CURIOS_HTTPD=y

doc/scripting-restconf.md

Lines changed: 91 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,77 +18,116 @@ To simplify RESTCONF operations, create a `curl.sh` wrapper script:
1818
#!/bin/sh
1919
# RESTCONF CLI wrapper for curl
2020

21-
# Show usage and exit
21+
HOST=${HOST:-infix.local}
22+
DATASTORE=running
23+
AUTH=admin:admin
24+
2225
usage()
2326
{
24-
cat <<-EOF >&2
25-
Usage: $0 [-h HOST] [-d DATASTORE] [-u USER:PASS] METHOD PATH [CURL_ARGS...]
26-
27-
Options:
28-
-h HOST Target host (default: infix.local)
29-
-d DS Datastore: running, operational, startup (default: running)
30-
-u CREDS Credentials as user:pass (default: admin:admin)
31-
32-
Methods: GET, POST, PUT, PATCH, DELETE
33-
EOF
34-
exit "$1"
27+
cat <<EOF >&2
28+
Usage: $0 [-v] [-h HOST] [-d DATASTORE] [-u USER:PASS] METHOD XPATH [CURL_ARGS...]
29+
30+
Options:
31+
-h HOST Target host (default: infix.local)
32+
-d DS Datastore: running, operational, startup (default: running)
33+
-u CREDS Credentials as user:pass (default: admin:admin)
34+
-v Verbose mode, use it to display variables and curl command
35+
36+
Methods: GET, POST, PUT, PATCH, DELETE
37+
EOF
38+
exit "$1"
3539
}
3640

37-
# Default values
38-
HOST=${HOST:-infix.local}
39-
DATASTORE=running
40-
AUTH=admin:admin
41+
check()
42+
{
43+
hint="Note: URL may be missing a module prefix (e.g., ietf-system:system)"
44+
resp="$1"
45+
url="$2"
46+
47+
if ! command -v jq >/dev/null 2>&1; then
48+
printf "%s\n" "$resp"
49+
return
50+
fi
51+
52+
case "$resp" in
53+
*"Syntax error"*)
54+
path_only="${url#*//}"
55+
56+
# Check for common URL error(s), e.g., missing module prefix
57+
case "$path_only" in
58+
*":"*)
59+
printf "%s\n" "$resp" | jq .
60+
;;
61+
*)
62+
printf "%s\n" "$resp" | jq --arg hint "$hint" \
63+
'.["ietf-restconf:errors"].error[] |= . + {comment: $hint}'
64+
;;
65+
esac
66+
;;
67+
*)
68+
printf "%s\n" "$resp" | jq .
69+
;;
70+
esac
71+
}
4172

42-
# Parse options
43-
while getopts "h:d:u:" opt; do
44-
case $opt in
45-
h) HOST="$OPTARG" ;;
46-
d) DATASTORE="$OPTARG" ;;
47-
u) AUTH="$OPTARG" ;;
48-
*) usage 1 ;;
49-
esac
73+
while getopts "h:d:u:v" opt; do
74+
case $opt in
75+
h) HOST="$OPTARG" ;;
76+
d) DATASTORE="$OPTARG" ;;
77+
u) AUTH="$OPTARG" ;;
78+
v) VERBOSE=1 ;;
79+
*) usage 1 ;;
80+
esac
5081
done
5182
shift $((OPTIND - 1))
5283

53-
# Validate required arguments
5484
if [ $# -lt 2 ]; then
55-
echo "Error: METHOD and PATH are required" >&2
56-
usage 1
85+
echo "Error: METHOD and XPATH are required" >&2
86+
usage 1
5787
fi
5888

5989
METHOD=$1
60-
PATH=$2
90+
XPATH=$2
6191
shift 2
6292

63-
# Ensure PATH starts with /
64-
case "$PATH" in
65-
/*) ;;
66-
*) PATH="/$PATH" ;;
93+
# Ensure XPATH starts with /
94+
case "$XPATH" in
95+
/*) ;;
96+
*) XPATH="/$XPATH" ;;
6797
esac
6898

69-
# Build URL based on datastore
7099
case "$DATASTORE" in
71-
running|startup)
72-
URL="https://${HOST}/restconf/data${PATH}"
73-
;;
74-
operational)
75-
URL="https://${HOST}/restconf/data${PATH}"
76-
;;
77-
*)
78-
echo "Error: Invalid datastore '$DATASTORE'. Use: running, operational, or startup" >&2
79-
exit 1
80-
;;
100+
running|startup)
101+
URL="https://${HOST}/restconf/data${XPATH}"
102+
;;
103+
operational)
104+
URL="https://${HOST}/restconf/data${XPATH}"
105+
;;
106+
*)
107+
echo "Error: Invalid datastore '$DATASTORE'. Use: running, operational, or startup" >&2
108+
exit 1
109+
;;
81110
esac
82111

83-
# Execute curl with all remaining arguments passed through
84-
exec /usr/bin/curl \
85-
--insecure \
86-
--user "${AUTH}" \
87-
--request "${METHOD}" \
88-
--header "Content-Type: application/yang-data+json" \
89-
--header "Accept: application/yang-data+json" \
90-
"$@" \
91-
"${URL}"
112+
if [ "$VERBOSE" ]; then
113+
echo "DS : $DATASTORE"
114+
echo "OP : $METHOD"
115+
echo "XPATH : $XPATH"
116+
echo "AUTH : $AUTH"
117+
echo "=> URL : $URL"
118+
set -x
119+
fi
120+
121+
RESP=$(/usr/bin/curl --silent \
122+
--insecure \
123+
--user "${AUTH}" \
124+
--request "${METHOD}" \
125+
--header "Content-Type: application/yang-data+json" \
126+
--header "Accept: application/yang-data+json" \
127+
"$@" \
128+
"${URL}")
129+
130+
check "$RESP" "$URL"
92131
```
93132

94133
Make it executable:

package/feature-wifi/Config.in

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,25 @@ config BR2_PACKAGE_FEATURE_WIFI
1414
help
1515
Enables WiFi in Infix. Enables all requried applications.
1616

17-
config BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK
18-
bool "Realtek USB WiFi Dongles"
17+
config BR2_PACKAGE_FEATURE_WIFI_MEDIATEK
18+
bool "Mediatek WiFi Devices"
19+
depends on BR2_PACKAGE_FEATURE_WIFI
20+
select BR2_PACKAGE_LINUX_FIRMWARE
21+
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U
22+
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7610E
23+
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT76X2E
24+
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7921
25+
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7922
26+
select BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7925
27+
help
28+
Enables support for various Mediatek WiFi devices.
29+
30+
config BR2_PACKAGE_FEATURE_WIFI_REALTEK
31+
bool "Realtek WiFi Devices"
1932
depends on BR2_PACKAGE_FEATURE_WIFI
2033
select BR2_PACKAGE_LINUX_FIRMWARE
2134
select BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX
2235
select BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW88
2336
select BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW89
2437
help
25-
Enables Support for RTW88 and RTW89 USB dongles.
38+
Enables support for RTL81xx, RTW88, and RTW89 WiFi devices.

package/feature-wifi/feature-wifi.mk

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,24 @@ define FEATURE_WIFI_LINUX_CONFIG_FIXUPS
1313
$(call KCONFIG_SET_OPT,CONFIG_MAC80211,m)
1414
$(call KCONFIG_SET_OPT,CONFIG_CFG80211,m)
1515

16-
$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_DONGLE_REALTEK)),
16+
$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_MEDIATEK)),
17+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7601U)
18+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x0U)
19+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x0E)
20+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x2E)
21+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT76x2U)
22+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7603E)
23+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7615E)
24+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7663U)
25+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7915E)
26+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT798X_WMAC)
27+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7921E)
28+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7921U)
29+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7996E)
30+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7925E)
31+
$(call KCONFIG_ENABLE_OPT,CONFIG_MT7925U)
32+
)
33+
$(if $(filter y,$(BR2_PACKAGE_FEATURE_WIFI_REALTEK)),
1734
$(call KCONFIG_ENABLE_OPT,CONFIG_WLAN_VENDOR_REALTEK)
1835
$(call KCONFIG_ENABLE_OPT,CONFIG_RTL8XXXU)
1936
$(call KCONFIG_ENABLE_OPT,CONFIG_RTL8XXXU_UNTESTED)
@@ -47,5 +64,4 @@ define FEATURE_WIFI_LINUX_CONFIG_FIXUPS
4764
)
4865
endef
4966

50-
5167
$(eval $(generic-package))

0 commit comments

Comments
 (0)