Thread (6 messages) 6 messages, 4 authors, 2012-12-17

how does this command(at+cfun=1,1) works?

From: Yann Droneaud <hidden>
Date: 2012-12-17 10:27:53

Hi,

Le lundi 17 d?cembre 2012 ? 15:32 +0530, Ritesh Harjani a ?crit :

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).
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help