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

Commit 0b01380

Browse files
committed
fix formatting (rather: parsing) of service states with Android 8+
1 parent 2ce5579 commit 0b01380

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/deviceinfo.lib

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ print_radiostat() {
1515
esac
1616
echo "* Signal strength: [${mradio[mSignalStrength]}](http://android.stackexchange.com/a/74954/16575)" >> "$devicedoc"
1717
local serv
18-
if [[ "${mradio[mServiceState]:0:1}" = "{" ]]; then # Android 8+?
18+
if [[ "${mradio[mServiceState]:0:1}" = "{" ]]; then # Android 8+
1919
mradio["mServiceState"]=${mradio["mServiceState"]:1:-1} # get rid of the curly braces
20-
serv=(${mradio["mServiceState"]//,/}) # remove comma separator
20+
IFS=',' read -ra serv <<< "${mradio["mServiceState"]}" # comma-separated string to array
2121
echo "* Service state:" >> "$devicedoc"
2222
for i in "${serv[@]}"; do
23+
i="${i#"${i%%[![:space:]]*}"}" # ltrim
2324
echo " * ${i}" >> "$devicedoc"
2425
done
2526
else

0 commit comments

Comments
 (0)