Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Commit

Permalink
make it possible to skip radio details (SIM, provider) in device doc …
Browse files Browse the repository at this point in the history
…(e.g. for WiFi-only tabs)
  • Loading branch information
IzzySoft committed Jun 26, 2020
1 parent 7486494 commit f0b714f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
1 change: 1 addition & 0 deletions adebar-cli
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ MK_DEVICEINFO=1
MK_DEVICEINFO_SENSORS=1
MK_DEVICEINFO_PMLISTFEATURES=1
MK_DEVICEINFO_STATUS=1
MK_RADIO=1
MK_PARTINFO=1
MK_PARTBACKUP=0
PARTITION_SRC="auto"
Expand Down
2 changes: 2 additions & 0 deletions doc/config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ MK_DEVICEINFO_SENSORS=1
MK_DEVICEINFO_PMLISTFEATURES=1
# Include device status (e.g. battery status)?
MK_DEVICEINFO_STATUS=1
# Show details on the "mobile radio" (SIM etc)? You'll want to turn this off e.g. for your WiFi-only tablet.
MK_RADIO=1
# Partition details for device doc and backup script
MK_PARTINFO=1
MK_PARTBACKUP=0
Expand Down
87 changes: 45 additions & 42 deletions lib/deviceinfo.lib
Original file line number Diff line number Diff line change
Expand Up @@ -206,49 +206,52 @@ getDeviceInfo() {
*) echo "* ${left}: ${right}" >> "$devicedoc" ;;
esac
done < "${tmp}"

doProgress " + Radio status" 3
echo >> "$devicedoc"
echo "### Radio Status" >> "$devicedoc"
[[ -n "${DEVPROP[gsm.version.baseband]}" ]] && echo "* Baseband: ${DEVPROP[gsm.version.baseband]}" >> "$devicedoc"
[[ -n "${DEVPROP[gsm.version.baseband1]}" ]] && echo "* Baseband (SIM2): ${DEVPROP[gsm.version.baseband1]}" >> "$devicedoc"
[[ -n "${DEVPROP[gsm.version.ril-impl]}" ]] && {
if [[ -n "${DEVPROP[rild.libpath]}" ]]; then echo "* RIL: ${DEVPROP[gsm.version.ril-impl]} (\`${DEVPROP[rild.libpath]}\`)" >> "$devicedoc"
else echo "* RIL: ${DEVPROP[gsm.version.ril-impl]}" >> "$devicedoc"
fi
}
declare -A radio
declare -A radio1
copyAdbContent dumpsys_telephony.registry "adb ${ADBOPTS} shell dumpsys telephony.registry" $tmp2
grep "=" $tmp2 > $tmp
local callstate=(idle ringing off-hook)
local servicestate=(service "out of service" "emergency only" "powered off")
local dataactivity=(none in out inout)
local dataconnectionstate=(disconnected connecting connected suspended)
local phoneid=0
local vname
while IFS='' read zeile; do
zeile="${zeile//[$'\t\r\n']}"
zeile="${zeile#"${zeile%%[![:space:]]*}"}" #"
vname="${zeile%%=*}"
if [[ "$vname" = "Phone Id" ]]; then # MultiSIM
phoneid="${zeile#*=}"
continue
fi
[[ "${vname:0:1}" == "{" ]] && break # only registration history follows here
case $phoneid in
0) radio[${zeile%%=*}]="${zeile#*=}" ;;
1) radio1[${zeile%%=*}]="${zeile#*=}" ;;
*) oops "dev" "${LINENO}" "Unexpected phone id: '${zeile#*=}'" 2 ;;
esac
done < "${tmp}"
[[ $phoneid -gt 0 ]] && echo "#### SIM1" >> "$devicedoc"
print_radiostat 0
[[ $phoneid -gt 0 ]] && {
echo "#### SIM2" >> "$devicedoc"
print_radiostat 1
}
echo >> "$devicedoc"

if [[ ${MK_RADIO} -gt 0 ]]; then
doProgress " + Radio status" 3
echo >> "$devicedoc"
echo "### Radio Status" >> "$devicedoc"
[[ -n "${DEVPROP[gsm.version.baseband]}" ]] && echo "* Baseband: ${DEVPROP[gsm.version.baseband]}" >> "$devicedoc"
[[ -n "${DEVPROP[gsm.version.baseband1]}" ]] && echo "* Baseband (SIM2): ${DEVPROP[gsm.version.baseband1]}" >> "$devicedoc"
[[ -n "${DEVPROP[gsm.version.ril-impl]}" ]] && {
if [[ -n "${DEVPROP[rild.libpath]}" ]]; then echo "* RIL: ${DEVPROP[gsm.version.ril-impl]} (\`${DEVPROP[rild.libpath]}\`)" >> "$devicedoc"
else echo "* RIL: ${DEVPROP[gsm.version.ril-impl]}" >> "$devicedoc"
fi
}
declare -A radio
declare -A radio1
copyAdbContent dumpsys_telephony.registry "adb ${ADBOPTS} shell dumpsys telephony.registry" $tmp2
grep "=" $tmp2 > $tmp
local callstate=(idle ringing off-hook)
local servicestate=(service "out of service" "emergency only" "powered off")
local dataactivity=(none in out inout)
local dataconnectionstate=(disconnected connecting connected suspended)
local phoneid=0
local vname
while IFS='' read zeile; do
zeile="${zeile//[$'\t\r\n']}"
zeile="${zeile#"${zeile%%[![:space:]]*}"}" #"
vname="${zeile%%=*}"
if [[ "$vname" = "Phone Id" ]]; then # MultiSIM
phoneid="${zeile#*=}"
continue
fi
[[ "${vname:0:1}" == "{" ]] && break # only registration history follows here
case $phoneid in
0) radio[${zeile%%=*}]="${zeile#*=}" ;;
1) radio1[${zeile%%=*}]="${zeile#*=}" ;;
*) oops "dev" "${LINENO}" "Unexpected phone id: '${zeile#*=}'" 2 ;;
esac
done < "${tmp}"
[[ $phoneid -gt 0 ]] && echo "#### SIM1" >> "$devicedoc"
print_radiostat 0
[[ $phoneid -gt 0 ]] && {
echo "#### SIM2" >> "$devicedoc"
print_radiostat 1
}
echo >> "$devicedoc"
fi
fi

if [[ -n "${DEVPROP[gsm.operator.alpha]}" ]]; then # Provider info
Expand Down

0 comments on commit f0b714f

Please sign in to comment.