mkd156
mkd156

Reputation: 435

send AT command using adb shell

I need to send AT command to modem. I am using samsung galaxy S3 I9300 device, which is rooted.

The steps I did are:

abd shell
su
echo -e "AT\r"

But I am not sure how to read the response given by the above commands. I tried to redirect the command as follows: echo -e "AT\r" > /dev/smd0, but when I execute cat /dev/smd0 I do not see any response I just see "AT". Seems like the command I intended to be executed is interpreted just as string and I see that string instead of the result of that operation.

Please advice what am I doing wrong.

Upvotes: 5

Views: 12410

Answers (4)

Zibri
Zibri

Reputation: 9827

Even better:

strace 2>/dev/null -e inject=ioctl:retval=0 microcom /dev/smd7

for an interactive session :D

Upvotes: 1

Zibri
Zibri

Reputation: 9827

To do that interactively:

while read a;do echo -e "${a}\r" >>/dev/smd7 ; timeout 1s cat /dev/smd7;done

Upvotes: 1

AMAN SINGH
AMAN SINGH

Reputation: 3561

Did you tried that in adb shell

su

echo -e "AT\r" > /dev/smd0

Upvotes: 0

hlovdal
hlovdal

Reputation: 28180

I suggest that you try out my atinout program which should be exactly what you are asking for: a program to send AT commands from the command line and capture the output.

In your case the result should be like

$ abd shell
$ su
$ echo AT | atinout - /dev/smd0 -

OK
$

and to capture the output just put a file name instead of the last -.

Upvotes: 1

Related Questions