4IceG / luci-app-3ginfo-lite

Graphic visualization of the mPCI-E / M.2 and USB 3G / LTE / LTE-A / 5G modem connection status. (LuCI JS) | OpenWrt >= 21.02
90 stars 35 forks source link

Error: Bad control character in string literal in JSON at position 67 #49

Closed jfrogg closed 7 months ago

jfrogg commented 9 months ago

The error was faced with Sierra EM7455 (1199:9071) but the problem may also occur with some other modems. Here is the relevant part of the script output (before a fix), look at the temperature value:

{
"connt":"-",
"conntx":"-",
"connrx":"-",
"modem":"",
 °C", 25
"firmware":"",
"cport":"/dev/ttyUSB1",

when it should look like this:

{
"connt":"-",
"conntx":"-",
"connrx":"-",
"modem":"",
"mtemp":"25 °C",
"firmware":"",
"cport":"/dev/ttyUSB1",

Here is a fix:

In /usr/share/3ginfo-lite/modem/11999071 (as an example) replace T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}') with something like this: T=$(echo "$O" | awk -F: '/Temperature:/ {print $3}' | grep -oE "\d+\.?\d{0,2}")

4IceG commented 9 months ago

Hi @jfrogg , Thanks, I will add this fix in the next package update.