[bugfix][T108][bug-view-1120/1161] ota maybe block if repeat upgrade no reboot and get current system faild
Only Configure: No
Affected branch:LYNQ_SDK_ASR_T108_V05.04.01.00
Affected module: fota
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no
Change-Id: I7e5de43bf03aec9188c1891e9482895de9765007
diff --git a/mbtk/libql_lib_v2_rilv2/ql_absys_api.c b/mbtk/libql_lib_v2_rilv2/ql_absys_api.c
index 5d0b253..6ef07d8 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_absys_api.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_absys_api.c
@@ -10,24 +10,32 @@
int ql_absys_get_cur_active_part(absystem_t *cur_system)
{
- int active;
- active = mbtk_fota_get_active_absys_type();
- if (active == 0)
+ FILE *file = NULL;
+ char cmdline[1024] = {0};
+
+ file = fopen("/proc/cmdline", "r");
+ if(file == NULL)
{
- *cur_system = SYSTEM_A;
- }
- else if (active == 1)
- {
- *cur_system = SYSTEM_B;
- }
- else
- {
- LOGE("ql_absys_get_cur_active_part fail");
- return -1;
+ LOGE("Failed to open /proc/cmdline");
+ return -1;
}
+ if(fgets(cmdline, sizeof(cmdline), file) != NULL)
+ {
+ if(strstr(cmdline, "system=a") != NULL)
+ {
+ *cur_system = SYSTEM_A;
+ }
+ else
+ {
+ *cur_system = SYSTEM_B;
+ }
+ }
+
+ fclose(file);
return 0;
+
}
int ql_absys_switch(void)