AT command to configure rndis modem

i have an hh41v router with an rndis modem: MDM9207
i want to command the modem to change the network type from 3g to 4g lte, so i need to comunicate with it with AT commands.

with ssh:
dmesg | grep -A 1 -B 12 ttyS
i get:
[ 0.387814] 18020000.uart: ttyS0 at MMIO 0x18020000 (irq = 10, base_baud = 1562500) is a 16550A
16550A UART, which is a common type of serial communication chip
The ttyS0 device is mapped to the memory-mapped I/O address 0x18020000 and uses interrupt request (IRQ) 10

i have installed picocom in the router, then from ssh:
picocom --q /dev/ttyS0 -b 1562500
i prints:
Invalid --baud: 1562500
if i dont set the baud:
picocom --q /dev/ttyS0
it seems that the connection is not set, i get no output when sending: AT

i searched for socat in the repository but i could not find it, it semms it does not have an apk version yet, and i'm using the latest snapshot version with apk and not opkg.

i hope that you can help

But I guess you have no serial interfaces exposed by the modem.

2 Likes

ttyS0 is the router chip's built in serial port. You need to install the matching kmod-usb-serial-xxxx driver for the modem's serial port. This should create about four ttyUSB ports, one of which you can open with picocom etc and send AT commands.

run ls /dev/tty* to see all the serial ports. rndis by itself operates in a different way than serial ports, it will not create or use any.

2 Likes
root@OpenWrt:~# ls /dev/tty*
/dev/tty     /dev/ttyS1   /dev/ttyS11  /dev/ttyS13  /dev/ttyS15  /dev/ttyS3   /dev/ttyS5   /dev/ttyS7   /dev/ttyS9
/dev/ttyS0   /dev/ttyS10  /dev/ttyS12  /dev/ttyS14  /dev/ttyS2   /dev/ttyS4   /dev/ttyS6   /dev/ttyS8

Start from checking with cat /sys/kernel/debug/usb/devices

1 Like
root@OpenWrt:~# cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  1, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 6.06
S:  Manufacturer=Linux 6.6.95 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=1b000000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bbb ProdID=0196 Rev=10.00
S:  Manufacturer=Alcatel
S:  Product=Mobilebroadband
S:  SerialNumber=1234567890ABCDEF
C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Install kmod-usb-serial-option

You should get 2 ports, the last one will be your AT command port.

1 Like

the package: kmod-usb-serial-option is already installed

Then you need to temporary add unknown IDs to the driver:
echo "1bbb 0196" > /sys/bus/usb-serial/drivers/option1/new_id
In this case you will get 3 new ports.

1 Like

thank you.
now i get the response

root@OpenWrt:~# picocom --q /dev/ttyUSB2
at
OK

do i need to add them manually every time i need to use them after router reboot?

You can add this line into your Local Startup script.

2 Likes

thank you very much.