Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
2450b3571e
@ -22,7 +22,7 @@ service() {
|
||||
printf "%-30s\t%10s\t%10s\n" "$F" \
|
||||
$( $($F enabled) && echo "enabled" || echo "disabled" ) \
|
||||
$( [ "$(ubus call service list "{ 'verbose': true, 'name': '$(basename $F)' }" \
|
||||
| jsonfilter -q -e "@.$(basename $F).instances[*].running" | uniq)" = "true" ] \
|
||||
| jsonfilter -q -e "@['$(basename $F)'].instances[*].running" | uniq)" = "true" ] \
|
||||
&& echo "running" || echo "stopped" )
|
||||
done;
|
||||
return 1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uqmi
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uqmi.git
|
||||
|
||||
@ -209,19 +209,36 @@ proto_qmi_setup() {
|
||||
|
||||
uqmi -s -d "$device" --sync > /dev/null 2>&1
|
||||
|
||||
uqmi -s -d "$device" --network-register > /dev/null 2>&1
|
||||
|
||||
echo "Waiting for network registration"
|
||||
sleep 1
|
||||
local registration_timeout=0
|
||||
while uqmi -s -d "$device" --get-serving-system | grep '"searching"' > /dev/null; do
|
||||
[ -e "$device" ] || return 1
|
||||
if [ "$registration_timeout" -lt "$timeout" -o "$timeout" = "0" ]; then
|
||||
let registration_timeout++
|
||||
sleep 1;
|
||||
local registration_state=""
|
||||
while true; do
|
||||
registration_state=$(uqmi -s -d "$device" --get-serving-system 2>/dev/null | jsonfilter -e "@.registration" 2>/dev/null)
|
||||
|
||||
[ "$registration_state" = "registered" ] && break
|
||||
|
||||
if [ "$registration_state" = "searching" ] || [ "$registration_state" = "not_registered" ]; then
|
||||
if [ "$registration_timeout" -lt "$timeout" ] || [ "$timeout" = "0" ]; then
|
||||
[ "$registration_state" = "searching" ] || {
|
||||
echo "Device stopped network registration. Restart network registration"
|
||||
uqmi -s -d "$device" --network-register > /dev/null 2>&1
|
||||
}
|
||||
let registration_timeout++
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
echo "Network registration failed, registration timeout reached"
|
||||
else
|
||||
echo "Network registration failed"
|
||||
proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
# registration_state is 'registration_denied' or 'unknown' or ''
|
||||
echo "Network registration failed (reason: '$registration_state')"
|
||||
fi
|
||||
|
||||
proto_notify_error "$interface" NETWORK_REGISTRATION_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
done
|
||||
|
||||
[ -n "$modes" ] && uqmi -s -d "$device" --set-network-modes "$modes" > /dev/null 2>&1
|
||||
|
||||
@ -697,10 +697,13 @@ int __init rb_hardconfig_init(struct kobject *rb_kobj)
|
||||
|
||||
hc_buflen = mtd->size;
|
||||
hc_buf = kmalloc(hc_buflen, GFP_KERNEL);
|
||||
if (!hc_buf)
|
||||
if (!hc_buf) {
|
||||
put_mtd_device(mtd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = mtd_read(mtd, 0, hc_buflen, &bytes_read, hc_buf);
|
||||
put_mtd_device(mtd);
|
||||
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
@ -686,6 +686,8 @@ static ssize_t sc_commit_store(struct kobject *kobj, struct kobj_attribute *attr
|
||||
}
|
||||
write_unlock(&sc_bufrwl);
|
||||
|
||||
put_mtd_device(mtd);
|
||||
|
||||
if (ret)
|
||||
goto mtdfail;
|
||||
|
||||
@ -721,10 +723,13 @@ int __init rb_softconfig_init(struct kobject *rb_kobj)
|
||||
|
||||
sc_buflen = mtd->size;
|
||||
sc_buf = kmalloc(sc_buflen, GFP_KERNEL);
|
||||
if (!sc_buf)
|
||||
if (!sc_buf) {
|
||||
put_mtd_device(mtd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = mtd_read(mtd, 0, sc_buflen, &bytes_read, sc_buf);
|
||||
put_mtd_device(mtd);
|
||||
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user