Discussion:
how does this command(at+cfun=1,1) works?
Ritesh Harjani
2012-12-17 07:11:30 UTC
Permalink
Hi Everyone,

When this command (at+cfun=1,1) is executed on phone, it does a reboot. I
want to know which and how this command calls the kernel level functions.
I googled this, but seems like all the data explains only about AT command
and not as to how this reboot process is done.

Coz what I know is that reboot process needs a syncing of filesystem, so
this command must be calling some kernel functions to do that.
Please if anyone can give more detail on this.

Thank you
Ritesh
Yann Droneaud
2012-12-17 09:42:05 UTC
Permalink
Post by Ritesh Harjani
Hi Everyone,
When this command (at+cfun=1,1) is executed on phone, it does a
reboot. I want to know which and how this command calls the kernel
level functions.
I googled this, but seems like all the data explains only about AT
command and not as to how this reboot process is done.
The kernel alone is not responsible of interpreting Hayes commands (AT).

According to ETSI TS 100 916 V7.4.0 (1999-11) Technical Specification
Digital cellular telecommunications system (Phase 2+); AT command set
for GSM Mobile Equipment (ME) (GSM 07.07 version 7.4.0 Release 1998),
Section 8.2 Set phone functionality +CFUN (found through by
http://wiki.openmoko.org/wiki/Hardware:AT_Commands ), this command
(AT+CFUN=1,1) is one of the command a "baseband" must implement.

And this command is asking for a reboot. So what you describe seems more
likely to be a hardware problem.

Regards.
--
Yann Droneaud
OPTEYA
Ritesh Harjani
2012-12-17 10:02:39 UTC
Permalink
Hi Yann,
Post by Yann Droneaud
Post by Ritesh Harjani
Hi Everyone,
When this command (at+cfun=1,1) is executed on phone, it does a
reboot. I want to know which and how this command calls the kernel
level functions.
I googled this, but seems like all the data explains only about AT
command and not as to how this reboot process is done.
The kernel alone is not responsible of interpreting Hayes commands (AT).
According to ETSI TS 100 916 V7.4.0 (1999-11) Technical Specification
Digital cellular telecommunications system (Phase 2+); AT command set
for GSM Mobile Equipment (ME) (GSM 07.07 version 7.4.0 Release 1998),
Section 8.2 Set phone functionality +CFUN (found through by
http://wiki.openmoko.org/wiki/Hardware:AT_Commands ), this command
(AT+CFUN=1,1) is one of the command a "baseband" must implement.
Post by Ritesh Harjani
And this command is asking for a reboot. So what you describe seems more
likely to be a hardware problem.
On Android phones(some of them) there are essentially two processors.
The *Application
Processor (AP)* where your Android operating system (AOS) and user
interface (UI) lives, and the *Baseband/Cellular Processor (BP/CP)* where
all the GSM and other high-tech communication magic happens, including the
modem we wish to communicate with.
Here, AP and BP communicates via UART (serial line), USB, SPI or through
shared RAM and/or a combination of these. Therefore there will always be
some path directly accessible from the outside that we should be able to
use to communicate directly with the BP.

So, what I am asking for is not any hardware problem. What I have figured
out that, this command (at+cun=1,1) calls for sysrq reset which does a
emergency restart.
But, I wanted to know the exact path that it follows before calling Sysrq
key.

Thank you
Ritesh
Post by Yann Droneaud
Regards.
--
Yann Droneaud
OPTEYA
Yann Droneaud
2012-12-17 10:27:53 UTC
Permalink
Hi,
Post by Ritesh Harjani
So, what I am asking for is not any hardware problem. What I have
figured out that, this command (at+cun=1,1) calls for sysrq reset
which does a emergency restart.
That's the problem in the first place.

This function shouldn't be linked to the emergency restart except in
case of emergency (watchdog).
Post by Ritesh Harjani
But, I wanted to know the exact path that it follows before calling
Sysrq key.
IMHO you're looking in the wrong way to fix your problem.

Instead of doing something like 'echo b > /proc/sysrq-trigger' [1] [2]
why not call "reboot" .

If "reboot" or "shutdown -R now" are not available, you could probably
use the following sequence:

echo 'e' > /proc/sysrq-trigger
sleep 1
echo 'i' > /proc/sysrq-trigger
sleep 1
echo 's' > /proc/sysrq-trigger
sleep 1
echo 'u' > /proc/sysrq-trigger
sleep 1
echo 'b' > /proc/sysrq-trigger

This is going to do what 'init' is doing when a "reboot" is issued: send
SIGTERM to each processes, send SIGKILL to remaining processes, flush
the filesystems, try to remount them read-only, and then proceed to
reboot.

[1] http://en.wikipedia.org/wiki/Magic_SysRq_key
[2] http://kernel.org/doc/Documentation/sysrq.txt


PS: you're looking for sysrq_handle_reboot() in drivers/tty/sysrq.c
which call emergency_restart().

Regards.
--
Yann Droneaud
OPTEYA
Anand Arumugam
2012-12-17 18:10:45 UTC
Permalink
Post by Ritesh Harjani
Hi Yann,
Post by Yann Droneaud
Post by Ritesh Harjani
Hi Everyone,
When this command (at+cfun=1,1) is executed on phone, it does a
reboot. I want to know which and how this command calls the kernel
level functions.
I googled this, but seems like all the data explains only about AT
command and not as to how this reboot process is done.
The kernel alone is not responsible of interpreting Hayes commands (AT).
According to ETSI TS 100 916 V7.4.0 (1999-11) Technical Specification
Digital cellular telecommunications system (Phase 2+); AT command set
for GSM Mobile Equipment (ME) (GSM 07.07 version 7.4.0 Release 1998),
Section 8.2 Set phone functionality +CFUN (found through by
http://wiki.openmoko.org/wiki/Hardware:AT_Commands ), this command
(AT+CFUN=1,1) is one of the command a "baseband" must implement.
Post by Ritesh Harjani
And this command is asking for a reboot. So what you describe seems more
likely to be a hardware problem.
On Android phones(some of them) there are essentially two processors. The
*Application Processor (AP)* where your Android operating system (AOS)
and user interface (UI) lives, and the *Baseband/Cellular Processor
(BP/CP)* where all the GSM and other high-tech communication magic
happens, including the modem we wish to communicate with.
Here, AP and BP communicates via UART (serial line), USB, SPI or through
shared RAM and/or a combination of these. Therefore there will always be
some path directly accessible from the outside that we should be able to
use to communicate directly with the BP.
So, what I am asking for is not any hardware problem. What I have figured
out that, this command (at+cun=1,1) calls for sysrq reset which does a
emergency restart.
But, I wanted to know the exact path that it follows before calling Sysrq
key.
Did you try 'strace'?

Anuz Pratap Singh Tomar
2012-12-17 11:01:26 UTC
Permalink
Post by Ritesh Harjani
Hi Everyone,
When this command (at+cfun=1,1) is executed on phone, it does a reboot. I
want to know which and how this command calls the kernel level functions.
I googled this, but seems like all the data explains only about AT command
and not as to how this reboot process is done.
Coz what I know is that reboot process needs a syncing of filesystem, so
this command must be calling some kernel functions to do that.
Please if anyone can give more detail on this.
Thank you
Ritesh
This question probably belongs to the relevant phone's mailing list. For
the most part if you send a reboot command from the command line most
desktop Linux will do whatever is required to carry out the reboot process
including sync with filesystems. at+cfun might be just calling the reboot
command internally. Please have a look at the source code for "at".
Post by Ritesh Harjani
_______________________________________________
Kernelnewbies mailing list
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--
Thank you
Warm Regards
Anuz
Loading...