Adding custom AT commands

I have both an X3000-5G and M2 + AXT1800. Is there a file I can modify (thru SSH) to add more AT commands (in addition to the default commands) in the dropdown?

So I don’t have to manually type the AT command.

Yes I remember seeing it few months ago on the forum. Please use the search to find it .

No luck from searching. The closest thing I found is someone making a similar request Using ATX1800 with QUECTEL EM160R-GL - #32 by i7bar

I could not find it either :slight_smile: as it’s been a while. Anyway, I did the research for you and the list of AT commands is defined in the compressed file: gl-sdk4-ui-internet.common.js.gz. This is how you achieve what you have asked for using SSH as a root:

  1. Making a backup of the original file and decompress it:

    # cp /www/views/gl-sdk4-ui-internet.common.js.gz BAKUP_gl-sdk4-ui-internet.common.js.gz
    # ls -l BAKUP_gl-sdk4-ui-internet.common.js.gz 
    -rw-r--r--    1 root     root         76217 Jan  4 11:10 BAKUP_gl-sdk4-ui-internet.common.js.gz
    # cp BAKUP_gl-sdk4-ui-internet.common.js.gz  gl-sdk4-ui-internet.common.js.gz
        gzip -d gl-sdk4-ui-internet.common.js.gz
    
  2. Editing the file with vi:
    # vi gl-sdk4-ui-internet.common.js

  • Once you open the file, follow these steps:
    • hit / to be able to search for a term
    • input manual command
    • hit Enter to move the cursor to the searched term
    • As you can see, this is the original defined list:
  1. Define a custom item list using the following format:

    {label:“any label”,value:“the command you want to execute”}

  • For example, let’s say I want to read all bands set by my operator:

    {label:“READ ALL BANDS SET BY OPERATOR”,value:‘AT+QNWPREFCFG=“policy_band”’}

  • In vi to insert into the open file, you need to hit i (means insert mode). Once you finish editing the file, hit Esc then input :wq and hit Enter. So, inserting my defined list’s item into the list right after the “Manual command” would look like:

    Note! I replaced the double quotes with single quotes since my command itself include double quotes; otherwise it will not work! If your custom command does not include a double quotes, then no need to replace it as I did.

  1. Re-compress the file again and move it to its previous location:

    # gzip gl-sdk4-ui-internet.common.js 
    # ls -l gzip gl-sdk4-ui-internet.common.js.gz
    -rw-r--r--    1 root     root         76747 Jan  4 11:42 gl-sdk4-ui-internet.common.js.gz
    # cp gl-sdk4-ui-internet.common.js.gz  /www/views/gl-sdk4-ui-internet.common.js.gz
    
  2. Verify it by logging into the web interface:


@SpitzAX3000 - you are awesome :slight_smile:

Don’t forget that every firmware update will undo this modification.

This is going to save a lot of time, especially when logging into the web UI from a mobile device. Don’t need to copy/paste AT commands anymore :slight_smile:

Added custom AT commands to UI of AXT1800. I’ll add to AX3000 later.

The file to edit for AXT1800 is: /www/views/gl-sdk4-ui-modemmanage.common.js.gz

1 Like

Thanks for the file hint.

Glad you got it to work !

Would you mind to share the commands with us? Seem to be pretty useful.

These are the additional commands I added:

{label:"Get Enabled Bands",value:'AT+QNWPREFCFG="ue_capability_band"'}
{label:"Get Carrier Aggregation",value:"AT+QCAINFO"}
{label:"Set 5G SA Bands",value:'AT+QNWPREFCFG="nr5g_band",1:2:3:5:7:8:12:13:14:18:20:25:26:28:29:30:38:40:41:48:66:70:71:75:76:77:78:79'}
{label:"Set 5G NSA Bands",value:'AT+QNWPREFCFG="nsa_nr5g_band",1:2:3:5:7:8:12:13:14:18:20:25:26:28:29:30:38:40:41:48:66:70:71:75:76:77:78:79'}
{label:"Set 4G LTE Bands",value:'AT+QNWPREFCFG="lte_band",1:2:3:4:5:7:8:12:13:14:17:18:19:20:25:26:28:29:30:32:34:38:39:40:41:42:43:46:48:66:71'}
{label:"Set WCDMA bands",value:'AT+QNWPREFCFG="gw_band",1:2:4:5:8:19'}
{label:"Get Network Mode",value:'AT+QNWPREFCFG="mode_pref"'}
{label:"Get Roaming Pref.",value:'AT+QNWPREFCFG="roam_pref"'}
{label:"Get Network Acquisition Order",value:'AT+QNWPREFCFG="rat_acq_order"'}

Another Question: Is there a way to chain AT commands - something like <AT_COMMAND_1> && <AT_COMMAND_2>?

Try it first from an SSH session. If it works, then embed it in the JavaScript file. Please note that you may need to add semicolon after each command to inject the next one. And make sure your entire line does not break the Javascript formatting. Here is a quick example on the shell using && and semicolon (;):

# gl_modem AT AT+CSQ && gl_modem AT AT+CPIN?
+CSQ: 31,99
OK

+CPIN: READY
OK

# gl_modem AT AT+CSQ; gl_modem AT AT+CPIN?
+CSQ: 31,99
OK

+CPIN: READY
OK

Altrhough both worked, when doing it as a list item, you might need to prefix it with the modem binary starting from the second command upward:

<AT_COMMAND_1>;gl_modem <AT_COMMAND_2>;gl_modem <AT_COMMAND_3>

As I said, test it first on the shell.

Lastly, open your browser’s Dev tool, the Network tab to see what is going on in the background upon clicking the Send button.

@SpitzAX3000 - it seems this is how you chain the commands

<AT_COMMAND_1>;<AT_COMMAND_2_WITHOUT_AT_PREFIX>

1 Like

Great you got it to work!

@Will12345 You have your command to set 5G SA bands as “AT+QNWPREFCFG=“nr5g_band”,1:2:3…”
Wouldn’t it be best to use ‘AT+QNWPREFCFG=“mode_pref”,NR5G’ instead?
It seems to me that the modem is already configured to use all the band channels from the get go, it doesn’t seem that there is a need to tell the modem to search for all the channels by setting it up again in your example(unless you are trying to lock specific chanels). With the way you have it, the modem is still using AUTO to search for any band it can find in its search and your not locking it to use only the selected band. I believe that the correct way to “Set 5G SA Bands” is to instead set the prefered mode to only use NR5G. Therefore ‘AT+QNWPREFCFG=“mode_pref”,NR5G’ would be correct as this command specifies the network search mode. This is the case for all of set commands that you have entered. Please correct me if I am wrong. At least in my case, this is what works for me.

I have the band listed so I can remove the few bands I don’t want instead of having to list out 20 bands.

It’s easier to remove 1 or 2 bands from a long list than to provide a long list of bands you want to enable

1 Like

This file doesnot work for Gl.inet android app.
Is there another file?