Search code examples
linuxgsmat-commandadb

Run AT commands from adb shell on Redmi 7


I tried this:

echo -e "ATD123456789;\r" > /dev/smd0

and then when I ran:

cat /dev/smd0

I got this output:

ATD123456789;

Is that what I'm supposed to see? The phone didn't respond to the command.

Update: The phone made a call when I used smd7 or smd11. The problem is I'm trying to send SMS messages using AT+CMGS and it's not working.

Update2: I run this command:cat /dev/smd7 & echo -e "AT+CMGS=24;\r" > /dev/smd7. Then I enter the PDU message and I get this: /system/bin/sh: 079...771B: not found


Solution

  • As you probably know, the command

    ATD<number>;\r
    

    performs a voice call to the destination number <number> (without the semicolon ; the call type would depend o the current settings of AT+FCLASS command).

    By default the OK result code would be received as soon as it starts remotely ringing, so after some seconds. But it would take even more if there are network problems or the remote number is unavailable/doesn't exist.

    The default timeout of ATD command during a voice call is 30s, and can be changed by issuing ATS7 command. For example, to set a 1 minute timeout:

    ATS7=60
    

    The answer you get is the command echo: in fact the modem, by default, echoes every character sent to its AT port (the echo can be desabled through ATE0 command and aenabled again with ATE1). Receiving it **is the proof that the modem is correctly powered on and that it communicates correctly.

    So, even though I'm aware that's not the only thing you expect to seee (you would like to see an answer!) you are actually supposed to see it.


    Some pieces of advice in order to receive your answer:

    1. Start providing simplier commands with shorter timeouts. For example the very basic AT.
    2. Make sure to wait at least the maximum command timeout
    3. Set the cat command in background and before starting providing commands:
        cat /dev/smd0 &
    
        echo -e "AT\r" > /dev/smd0
        OK
    

    Note: I'm not aware of any timeout in cat command.