fix factory reset bug

This commit is contained in:
zribiahmed 2013-02-20 14:26:48 +00:00
parent 29b6d3a7d1
commit 675b632b92
4 changed files with 11 additions and 5 deletions

View file

@ -425,6 +425,12 @@ int run_session_end_func (struct session *session)
if (session->end_session & END_SESSION_RELOAD)
cwmp_apply_acs_changes();
if (session->end_session & END_SESSION_FACTORY_RESET)
{
external_simple("factory_reset", NULL);
exit(EXIT_SUCCESS);
}
session->end_session = 0;
return CWMP_OK;

View file

@ -53,7 +53,8 @@
enum end_session {
END_SESSION_REBOOT = 1,
END_SESSION_EXTERNAL_ACTION = 1<<1,
END_SESSION_RELOAD = 1<<2
END_SESSION_RELOAD = 1<<2,
END_SESSION_FACTORY_RESET = 1<<3
};
enum cwmp_start {

View file

@ -492,7 +492,7 @@ if [ "$action" = "factory_reset" ]; then
else
jffs2_mark_erase "rootfs_data"
sync
ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET} call tr069 command '{ "command": "reboot_end_session" }' 2>&1 > /dev/null
reboot
fi
fi
@ -554,7 +554,7 @@ if [ "$action" = "notify" ]; then
fi
freecwmp_execute_functions "$get_notification_functions" "$__param"
fault_code="$?"
if [ "$fault_code" != "$FAULT_CPE_NO_FAULT" ]; then
if [ "$fault_code" = "$FAULT_CPE_NO_FAULT" ]; then
freecwmp_notify "$__arg1" "$__arg2" "$__arg3"
else
echo "Invalid parameter name" 1>&2

View file

@ -1524,8 +1524,7 @@ int cwmp_handle_rpc_cpe_factory_reset(struct session *session, struct rpc *rpc)
b = mxmlNewElement(b, "cwmp:FactoryResetResponse");
if (!b) goto fault;
if (external_simple("factory_reset", NULL))
goto fault;
cwmp_set_end_session(END_SESSION_FACTORY_RESET);
return 0;