RDK Documentation (Open Sourced RDK Components)
coldFactoryReset.c
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @defgroup iarmmgrs
23 * @{
24 * @defgroup power
25 * @{
26 **/
27 
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include "resetModes.h"
32 #include "pwrlogger.h"
33 
34 
35 int processColdFactoryReset()
36 {
37  /*Code copied from X1.. Needs modification*/
38  LOG("\n Reset: Processing Cold Factory Reset\n");
39  fflush(stdout);
40  LOG(" Reset: ...Clearing data from your box before reseting \n");
41  fflush(stdout);
42  /*Execute the script for Cold Factory Reset*/
43  system("sh /lib/rdk/deviceReset.sh coldfactory");
44 
45  system("echo 0 > /opt/.rebootFlag");
46  system(" echo `/bin/timestamp` ------------- Rebooting due to Cold Factory Reset process --------------- >> /opt/logs/receiver.log");
47  system("sleep 5; /rebootNow.sh -s PowerMgr_coldFactoryReset -o 'Rebooting the box due to Cold Factory Reset process ...'");
48  return 1;
49 }
50 
51 
52 /** @} */
53 /** @} */