简体   繁体   English

使用 adb shell 发送 AT 命令

[英]send AT command using adb shell

I need to send AT command to modem.我需要向调制解调器发送 AT 命令。 I am using samsung galaxy S3 I9300 device, which is rooted.我正在使用已植根的三星 Galaxy S3 I9300 设备。

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".我尝试将命令重定向如下: echo -e "AT\r" > /dev/smd0 ,但是当我执行 cat /dev/smd0时,我没有看到任何响应,我只看到“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.请指教我做错了什么。

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. 我建议你试试我的atinout程序,它应该是你要求的:一个从命令行发送AT命令并捕获输出的程序。

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 - . 并捕获输出只是放一个文件名而不是最后一个-

Did you tried that in adb shell 你在adb shell中尝试过吗?

su

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

To do that interactively:要以交互方式执行此操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM