how does this command(at+cfun=1,1) works?
Yann Droneaud
ydroneaud at opteya.com
Mon Dec 17 05:27:53 EST 2012
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
More information about the Kernelnewbies
mailing list