26

I want to Send AT Command to Android phone.

I know SDK does not support this.

but there are two solution :

  1. change the code of Kernel and release your new Android (it seems it is so hard!)

  2. LoopBack on USB.(i think Bluetooth is same)

About second solution , when you connect your phone to PC with USB cable , you will see a GSM modem on Device Manager that help you to send AT Command to GSM Modem.

If we find a solution to loop back on mobile phone , we can send AT commands to GSM Modem.

Question is : HOW to loop back and what tty file on kernel will help us?

M.Movaffagh
  • 1,284
  • 5
  • 20
  • 33
  • see that: http://stackoverflow.com/questions/10308130/using-android-emulator-to-test-at-commands-by-com-from-external-application/10314862#10314862 –  Apr 25 '12 at 12:34
  • About solution 1, I wonder *where* (in which files of the kernel) is the AT command "manager" within the open source Android? – Hernán Eche Jun 18 '12 at 22:31

1 Answers1

15

first you have to root the phone then in adb shell

su

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

if you want to see answer use

cat /dev/smd0

i've test this command in samsung mini,cooper,s+ and it works.

if you use htc (htc rhyme tested) try to adb shell and type this command "radiooptions 13 AT" if you want to see answer type "logcat -b radio"

try echo to /dev/smd0 for other devices

*you can use this command in sdk java code by using Runtime.exec (require su)

Community
  • 1
  • 1
rattisuk
  • 407
  • 5
  • 7
  • thanks... it worked. but the problem is just AT\r worked and other commands like atd123456789 does not work. – M.Movaffagh Feb 04 '12 at 05:31
  • 2
    try ATD123456789;\r (add ; at the end of phone number) i tested and it works on samsung.and i think it works for all of mobile – rattisuk Feb 04 '12 at 16:07
  • you are correct, atd123456789 is a data call that does not support with the phone i checked. thanks for your answer and regard. – M.Movaffagh Feb 05 '12 at 03:23
  • 1
    The above works, but using `cat /dev/smd0 &` before the AT command is better, since sometimes the `cat` command lock up the device, in case the shell TERM is using CTS/DSR as a serial control signals. – not2qubit Jun 17 '14 at 21:56