Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Talking to modem with AT commands on android

I'm trying to talk to samsung galaxy s2 plus and huawei p1 xl (u9200) modem sending AT commands, but can't get any result. I'm sending commands using adb shell and view logs with logcat.

In samsung when i execute cat /proc/tty/drivers i get the following:

/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster

rfcomm               /dev/rfcomm   216 0-255 serial
g_serial             /dev/ttyGS    237 0-3 serial
serial               /dev/ttyS       4 64-67 serial
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console

Looks like i should send commands to /dev/ttyGS0, but it doesn't reply. I've tried the following commands:

echo "AT\r" > /dev/ttyGS0
echo "ATD12345678900;\r" > /dev/ttyGS0

but nothing happens. Actually, i'm not sure that i have to send commands to this file, but others don't reply too. I've read article on XDA-developers, but it didn't help.

With Huawei i know which file i should use, but i can't make data call. I can make regular voice call, but i can't execute AT+CSNS=4. Just doesn't work. Also i have LG P765, which is based on a similar chipset and on LG i can make data call. Can anyone tell me what should i do?

All devices are rooted.

like image 788
MightySeal Avatar asked Jul 18 '13 08:07

MightySeal


1 Answers

I suggest that you try to send AT command using the atinout program, e.g. instead of redirecting output to the modem device run

echo "ATD12345678900;" | atinout - /dev/ttyGS0 -

I am guessing, but it could be that the echo command in the adb shell does not interpret \r as anything special (that would at least explain no response whatsoever). By using atinout you are guarantied that AT command lines are properly terminated with \r and capturing should be simpler and work much more reliably.

like image 140
hlovdal Avatar answered Oct 03 '22 10:10

hlovdal