[GH-ISSUE #30] 3gdetail: JSON.parse: unexpected end of data #22

Closed
opened 2026-03-04 11:57:41 +03:00 by kerem · 12 comments
Owner

Originally created by @Jalakas on GitHub (Dec 26, 2022).
Original GitHub issue: https://github.com/4IceG/luci-app-3ginfo-lite/issues/30

Page "http://192.168.1.1/cgi-bin/luci/admin/modem/3ginfo-lite/3gdetail"
has error: "SyntaxError
JSON.parse: unexpected end of data at line 1 column 1 of the JSON data"

Git commit: github.com/4IceG/luci-app-3ginfo-lite@f5a7f57680
Modem: Huawei E3272
3ginfo works fine in ncm mode.

Originally created by @Jalakas on GitHub (Dec 26, 2022). Original GitHub issue: https://github.com/4IceG/luci-app-3ginfo-lite/issues/30 Page "http://192.168.1.1/cgi-bin/luci/admin/modem/3ginfo-lite/3gdetail" has error: "SyntaxError JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" Git commit: https://github.com/4IceG/luci-app-3ginfo-lite/commit/f5a7f5768081e3eb08af9db6e4400961329af5fa Modem: Huawei E3272 3ginfo works fine in ncm mode.
kerem closed this issue 2026-03-04 11:57:41 +03:00
Author
Owner

@Jalakas commented on GitHub (Dec 26, 2022):

Caused by request:
"/usr/share/3ginfo-lite/3ginfo.sh json"
having error:

root@OpenWrt:~# /usr/share/3ginfo-lite/3ginfo.sh json
/usr/share/3ginfo-lite/3ginfo.sh: /usr/share/3ginfo-lite/3ginfo-addon/12d11506: line 89: arithmetic syntax error

caused by modem 3272 having no reply to command:

root@OpenWrt:~# sms_tool -d /dev/ttyUSB1 at 'AT^HFREQINFO?'
AT^HFREQINFO?
<!-- gh-comment-id:1365404368 --> @Jalakas commented on GitHub (Dec 26, 2022): Caused by request: "/usr/share/3ginfo-lite/3ginfo.sh json" having error: ``` root@OpenWrt:~# /usr/share/3ginfo-lite/3ginfo.sh json /usr/share/3ginfo-lite/3ginfo.sh: /usr/share/3ginfo-lite/3ginfo-addon/12d11506: line 89: arithmetic syntax error ``` caused by modem 3272 having no reply to command: ``` root@OpenWrt:~# sms_tool -d /dev/ttyUSB1 at 'AT^HFREQINFO?' AT^HFREQINFO? ```
Author
Owner

@4IceG commented on GitHub (Dec 26, 2022):

Hi @Jalakas , Ok thanks for the hint.
I'll try to fix it as soon as I get some free time.

<!-- gh-comment-id:1365458103 --> @4IceG commented on GitHub (Dec 26, 2022): Hi @Jalakas , Ok thanks for the hint. I'll try to fix it as soon as I get some free time.
Author
Owner

@4IceG commented on GitHub (Jan 6, 2023):

I did an update, it should be better.

<!-- gh-comment-id:1374090084 --> @4IceG commented on GitHub (Jan 6, 2023): I did an update, it should be better.
Author
Owner

@4IceG commented on GitHub (Jan 25, 2023):

It should work ok now (package waiting to be compiled).

<!-- gh-comment-id:1403876219 --> @4IceG commented on GitHub (Jan 25, 2023): It should work ok now (package waiting to be compiled).
Author
Owner

@Jalakas commented on GitHub (Feb 4, 2023):

I have now again access to this device and the JSON error is still present, now caused by line https://github.com/4IceG/luci-app-3ginfo-lite/blob/main/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506#L93:
/usr/share/3ginfo-lite/3ginfo.sh: /usr/share/3ginfo-lite/3ginfo-addon/12d11506: line 93: arithmetic syntax error

Test in line https://github.com/4IceG/luci-app-3ginfo-lite/blob/main/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506#L86 seems to fail, because variable "$XFR" has non empty value "at^hfreqinfo?".

<!-- gh-comment-id:1416737572 --> @Jalakas commented on GitHub (Feb 4, 2023): I have now again access to this device and the JSON error is still present, now caused by line https://github.com/4IceG/luci-app-3ginfo-lite/blob/main/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506#L93: `/usr/share/3ginfo-lite/3ginfo.sh: /usr/share/3ginfo-lite/3ginfo-addon/12d11506: line 93: arithmetic syntax error` Test in line https://github.com/4IceG/luci-app-3ginfo-lite/blob/main/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506#L86 seems to fail, because variable "$XFR" has non empty value "at^hfreqinfo?".
Author
Owner

@Jalakas commented on GitHub (Feb 4, 2023):

This will fix JSON error:
if [ ! -z "$TDL" ]; then
DL=$(($TDL/1000))
fi

TUL=$(echo "$TBX" | cut -d ',' -f9-9 )
if [ ! -z "$TUL" ]; then
UL=$(($TUL/1000))
fi
pilt

<!-- gh-comment-id:1416747894 --> @Jalakas commented on GitHub (Feb 4, 2023): This will fix JSON error: if [ ! -z "$TDL" ]; then DL=$(($TDL/1000)) fi TUL=$(echo "$TBX" | cut -d ',' -f9-9 ) if [ ! -z "$TUL" ]; then UL=$(($TUL/1000)) fi ![pilt](https://user-images.githubusercontent.com/1070619/216769577-4021b974-b98c-4989-b1b3-3fa8e78e51a3.png)
Author
Owner

@4IceG commented on GitHub (Feb 4, 2023):

I tested these changes and had no errors. The command returns different values (not always empty) on different modems.

@Jalakas show the result of this command on your modem
at^hfreqinfo?

Like now, it can't be either... why should we show "nothing", it's better to hide it completely.

<!-- gh-comment-id:1416750205 --> @4IceG commented on GitHub (Feb 4, 2023): I tested these changes and had no errors. The command returns different values (not always empty) on different modems. @Jalakas show the result of this command on your modem `at^hfreqinfo?` Like now, it can't be either... why should we show "nothing", it's better to hide it completely.
Author
Owner

@Jalakas commented on GitHub (Feb 4, 2023):

Huawei E3272 modem, using sms_tool:

root@OpenWrt:~# sms_tool -d /dev/ttyUSB1 at 'at^chiptemp?'
at^chiptemp?
^CHIPTEMP: 373,373,65535,28,65535

root@OpenWrt:~# sms_tool -d /dev/ttyUSB1 at 'at^hfreqinfo?'
at^hfreqinfo?
root@OpenWrt:~#
<!-- gh-comment-id:1416753733 --> @Jalakas commented on GitHub (Feb 4, 2023): Huawei E3272 modem, using sms_tool: ``` root@OpenWrt:~# sms_tool -d /dev/ttyUSB1 at 'at^chiptemp?' at^chiptemp? ^CHIPTEMP: 373,373,65535,28,65535 root@OpenWrt:~# sms_tool -d /dev/ttyUSB1 at 'at^hfreqinfo?' at^hfreqinfo? root@OpenWrt:~# ```
Author
Owner

@4IceG commented on GitHub (Feb 4, 2023):

OK thanks. I'll be doing package updates this week, so I'll fix this situation.

<!-- gh-comment-id:1416775911 --> @4IceG commented on GitHub (Feb 4, 2023): OK thanks. I'll be doing package updates this week, so I'll fix this situation.
Author
Owner

@Jalakas commented on GitHub (Feb 25, 2023):

As far I see, the fix has not been released yet?

<!-- gh-comment-id:1445057948 --> @Jalakas commented on GitHub (Feb 25, 2023): As far I see, the fix has not been released yet?
Author
Owner

@4IceG commented on GitHub (Feb 25, 2023):

I haven't tested it with a modem, but I've added some code that checks the output of the command, and it's supposed to work.

XFR=$(sms_tool -d $DEVICE at "at^hfreqinfo?")
XFRCOUNT=$(echo -n "$XFR" | wc -c)

if [ -n "$XFR" ] && [ "$XFRCOUNT" -gt "15" ]; then
<!-- gh-comment-id:1445061071 --> @4IceG commented on GitHub (Feb 25, 2023): I haven't tested it with a modem, but I've added some code that checks the output of the command, and it's supposed to work. ``` XFR=$(sms_tool -d $DEVICE at "at^hfreqinfo?") XFRCOUNT=$(echo -n "$XFR" | wc -c) if [ -n "$XFR" ] && [ "$XFRCOUNT" -gt "15" ]; then ```
Author
Owner

@Jalakas commented on GitHub (Feb 25, 2023):

Tested this patch and it works fine:
pilt

<!-- gh-comment-id:1445063025 --> @Jalakas commented on GitHub (Feb 25, 2023): Tested this patch and it works fine: ![pilt](https://user-images.githubusercontent.com/1070619/221355089-c517af64-95d6-40c3-b485-cf013d68d5e6.png)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/luci-app-3ginfo-lite#22
No description provided.