You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
816 B
Bash
50 lines
816 B
Bash
#! /bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
iface="$(uci_get plc plc interface br-lan)"
|
|
|
|
fw=/lib/firmware/plc
|
|
|
|
src=plc && res="$(plctools-wrapper plctool "" -i "$iface" -I)"
|
|
[ -z "$res" ] && src=user.pib.tmp && res="$(chkpib -qv "$fw/user.pib.tmp")"
|
|
[ -z "$res" ] && src=user.pib && res="$(chkpib -qv "$fw/user.pib")"
|
|
[ -z "$res" ] && src=default
|
|
|
|
case "$(echo "$res" | sed -ne "/^\tCCo/s,.*CCo ,,p")" in
|
|
Auto)
|
|
cco=auto
|
|
;;
|
|
Never)
|
|
cco=never
|
|
;;
|
|
Always)
|
|
cco=always
|
|
;;
|
|
*)
|
|
cco=auto
|
|
;;
|
|
esac
|
|
case "$(echo "$res" | sed -ne "/^\tMDU/s,.*MDU ,,p")" in
|
|
N/A)
|
|
mdu=disabled
|
|
;;
|
|
Slave)
|
|
mdu=slave
|
|
;;
|
|
Master)
|
|
mdu=master
|
|
;;
|
|
*)
|
|
mdu=disabled
|
|
;;
|
|
esac
|
|
|
|
. /usr/share/libubox/jshn.sh
|
|
json_init
|
|
#debug only: json_add_string source "$src"
|
|
json_add_string cco "$cco"
|
|
json_add_string mdu "$mdu"
|
|
json_close_object
|
|
json_dump
|