Sending AT Commands Via ADB Android

旧巷老猫 提交于 2019-11-29 01:34:29

问题


I have a task at work to investigate if it is possible to send AT commands to an android device via ADB shell. So far,I have tried to echo out the AT commands but it passes them as normal strings. Any help please anyone.


回答1:


Please try this:

echo -e "AT+CFUN=?\r\n" > /dev/ttyUSB0

On your phone, the serial line must not necessarily be called ttyUSB0. If this is not working or not available, check out the other entries of the /dev/ directory.
So it could also be /dev/ttyGS0 or /dev/SMD0 (as found out by @Sani).

For further information, please check out this Guide


NOTE:

There might also be phones, that do not respond to AT commands on any of their serial (tty) devices.
I just tried my own procedure on a Samsung Galaxy S4 and did not have any success.




回答2:


Echo them where? In Android you talk to the rild (Radio Interface Layer) daemon, which in turns talks to a proprietary library, which sends commands to the actual hardware. Check rild source code for details. You could probably write a command line program that talks to the rild and execute it via adb shell, if that fits your needs.




回答3:


Yes you can run AT commands from adb shell too...

prerequsite :-
 1. rooted android phone
 2. you are aware of the port that RIL use for i/o operation.
 3. to check which port is being used by RIl use `getprop rild.libargs`

To run AT command from ADB use:

echo -c "AT\r\n" > /dev/smd11

PS: smd11 is port used by RIL.This varies from device to device.

ALso to run AT commands from android application check this tutorial

http://tech-papers.org/executing-at-commands-android-application/




回答4:


In order to find out which port to use : You can check

# cat /proc/tty/drivers

Use logcat -b radio | grep dev to see wich tty the radio is using.



来源:https://stackoverflow.com/questions/12855482/sending-at-commands-via-adb-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!