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
100 stars 39 forks source link

Provide more information for Huawei E3372 via AT commands #25

Closed patrakov closed 1 year ago

patrakov commented 1 year ago

Huawei E3372 reflashed to stick mode is already supported and has its own 3ginfo-addon file:

Bus 001 Device 003: ID 12d1:1506 HUAWEI_MOBILE HUAWEI_MOBILE

Currently, it is missing the display of IMEI, IMSI, ICCID, TAC, and the active band.

It can provide IMEI either as a part of its response to ATI, or as a response to AT+GSN.

# sms_tool -d /dev/ttyUSB1 at 'AT+GSN'
AT+GSN
861XXXXXXXXXXXX

# sms_tool -d /dev/ttyUSB1 at 'ATI'
ATI
Manufacturer: huawei
Model: E3372
Revision: 21.200.07.00.00
IMEI: 861XXXXXXXXXXXX
+GCAP: +CGSM,+DS,+ES

Regarding IMSI:

# sms_tool -d /dev/ttyUSB1 at 'AT+CIMI'
AT+CIMI
51566XXXXXXXXXX

Regarding ICCID:

# sms_tool -d /dev/ttyUSB1 at 'AT^ICCID?'
AT^ICCID?
^ICCID: 896XXXXXXXXXXXXXXXXX

I could not find how to request TAC.

There is no dedicated command to display the band used, but there is AT^HFREQINFO? which displays frequency information which can be a (more detailed) substitute. I could not find any documentation specific to E3372, but http://download-c.huawei.com/download/downloadCenter?downloadId=100630 contains this command.

# sms_tool -d /dev/ttyUSB1 at 'AT^HFREQINFO?'
AT^HFREQINFO?
^HFREQINFO:0,6,1,425,21525,15000,18425,19625,15000

...which means: no unsolicited reporting, LTE mode, LTE band 1, downlink frequency point (EARFCN) 425, downlink frequency 2152.5 MHz, downlink bandwidth 15 MHz, uplink frequency point (EARFCN) 18425, downlink frequency 1962.5 MHz, downlink bandwidth 15 MHz.

4IceG commented 1 year ago

Ok, I'll add this when I have some free time for the week. TAC will probably double with LAC if it can't be read.

patrakov commented 1 year ago

LAC is actually retrieved successfully, but TAC is missing.

patrakov commented 1 year ago

I have tried the latest release, it works. Now it says:

Primary band | PCI & EARFCN B1 (2100 MHz) DL: @15 MHz UL: @15 MHz | - 425

So PCI is missing. I have tried the commands from the PDF that might return it, but they all fail (because the PDF is for a different Huawei modem), so well, it is not obtainable.

All other information that I requested is correctly reported.

patrakov commented 1 year ago

Oops, the chip temperature is missing.

# sms_tool -d /dev/ttyUSB1 at "AT^CHIPTEMP?"
AT^CHIPTEMP?
^CHIPTEMP: 473,473,65535,35,65535

I have manually copy-pasted the awk command, and it prints the correct temperature. So the bug must be not in the parsing of the AT command response, but in how it is propagated to the json.

patrakov commented 1 year ago

The problem is due to the inappropriate reuse of the $O variable:

O=$(sms_tool -d $DEVICE at "at^chiptemp?;^hcsq?")                                                                                                       
...
O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs)                                  
...
T=$(echo "$O" | awk ...)   # of course it won't find the temperature in the AT+CIMI response
4IceG commented 1 year ago

Ok thanks for the tests. I'll fix it tomorrow.

Can't find a command for reading PCI so left blank.

4IceG commented 1 year ago

It should be OK.