# Adding custom AT commands

**URL:** <https://forum.gl-inet.com/t/adding-custom-at-commands/36767>\
**Category:** Router\
**Created:** [January 3, 2024, 10:43am UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767 "2024-01-03T10:43:52Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [January 3, 2024, 10:43am UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/1 "2024-01-03T10:43:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SpitzAX3000](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/spitzax3000/32/11018_2.png) [@SpitzAX3000](https://forum.gl-inet.com/u/SpitzAX3000)\
**Post date:** [January 3, 2024, 9:33pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/2 "2024-01-03T21:33:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [January 4, 2024, 12:53am UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/3 "2024-01-04T00:53:41Z")

</div>

No luck from searching. The closest thing I found is someone making a similar request [Using ATX1800 with QUECTEL EM160R-GL - #32 by i7bar](https://forum.gl-inet.com/t/using-atx1800-with-quectel-em160r-gl/23443/32)

---

<div class="post-metadata">

**Author:** ![SpitzAX3000](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/spitzax3000/32/11018_2.png) [@SpitzAX3000](https://forum.gl-inet.com/u/SpitzAX3000)\
**Post date:** [January 4, 2024, 12:21pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/4 "2024-01-04T12:21:53Z")

</div>

I could not find it either 🙂 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:

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:  
 ![2](https://forum-static.gl-inet.com/original/2X/b/b1263ae646b832ec2a8323d3c481260b92d488ae.png)

1. Define a custom item list using the following format:

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

- 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:  

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

2. Verify it by logging into the web interface:

---

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [January 4, 2024, 1:29pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/5 "2024-01-04T13:29:20Z")

</div>

@SpitzAX3000 - you are awesome 🙂

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [January 4, 2024, 1:30pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/6 "2024-01-04T13:30:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [January 4, 2024, 2:27pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/7 "2024-01-04T14:27:08Z")

</div>

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 🙂

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

 ![at](https://forum-static.gl-inet.com/original/2X/3/3a61f6ff136101f2401111fb716338b9005a50b2.png)

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

---

<div class="post-metadata">

**Author:** ![SpitzAX3000](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/spitzax3000/32/11018_2.png) [@SpitzAX3000](https://forum.gl-inet.com/u/SpitzAX3000)\
**Post date:** [January 4, 2024, 4:25pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/8 "2024-01-04T16:25:20Z")

</div>

> [@Will12345](#):
>
> /www/views/gl-sdk4-ui-modemmanage.common.js.gz

Thanks for the file hint.

Glad you got it to work !

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [January 4, 2024, 4:27pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/9 "2024-01-04T16:27:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [January 4, 2024, 5:56pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/10 "2024-01-04T17:56:44Z")

</div>

These are the additional commands I added:

```auto
{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\>?

---

<div class="post-metadata">

**Author:** ![SpitzAX3000](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/spitzax3000/32/11018_2.png) [@SpitzAX3000](https://forum.gl-inet.com/u/SpitzAX3000)\
**Post date:** [January 4, 2024, 6:34pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/11 "2024-01-04T18:34:21Z")

</div>

> [@Will12345](#):
>
> 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** ( **;** ):

```auto
# 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.

---

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [January 8, 2024, 1:01pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/12 "2024-01-08T13:01:01Z")

</div>

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

\<AT\_COMMAND\_1\>;\<AT\_COMMAND\_2\_WITHOUT\_AT\_PREFIX\>

 ![image](https://forum-static.gl-inet.com/original/2X/1/1e91245c798e17ac2cf83a218b080e7917d6d01e.png)

---

<div class="post-metadata">

**Author:** ![SpitzAX3000](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/spitzax3000/32/11018_2.png) [@SpitzAX3000](https://forum.gl-inet.com/u/SpitzAX3000)\
**Post date:** [January 8, 2024, 3:58pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/13 "2024-01-08T15:58:34Z")

</div>

Great you got it to work!

---

<div class="post-metadata">

**Author:** ![gainestr](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@gainestr](https://forum.gl-inet.com/u/gainestr)\
**Post date:** [April 2, 2024, 4:30am UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/14 "2024-04-02T04:30:27Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Will12345](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@Will12345](https://forum.gl-inet.com/u/Will12345)\
**Post date:** [April 4, 2024, 11:36am UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/15 "2024-04-04T11:36:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![caymann](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/c/91b2a8/32.png) [@caymann](https://forum.gl-inet.com/u/caymann)\
**Post date:** [April 15, 2024, 2:45pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/16 "2024-04-15T14:45:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gainestr](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@gainestr](https://forum.gl-inet.com/u/gainestr)\
**Post date:** [October 13, 2024, 10:34pm UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/17 "2024-10-13T22:34:39Z")

</div>

I believe you would need to edit the app itself which probably isn't possible. Just use router GUI instead.

---

<div class="post-metadata">

**Author:** ![admon](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/admon/32/32880_2.png) [@admon](https://forum.gl-inet.com/u/admon)\
**Post date:** [October 14, 2024, 5:24am UTC](https://forum.gl-inet.com/t/adding-custom-at-commands/36767/18 "2024-10-14T05:24:57Z")

</div>


