@@ -145,6 +145,7 @@ static void detectQualcomm(FFCPUResult* cpu)
145145{
146146 // https://en.wikipedia.org/wiki/List_of_Qualcomm_Snapdragon_systems_on_chips
147147
148+ assert (cpu -> name .length >= 2 );
148149 uint32_t code = (uint32_t ) strtoul (cpu -> name .chars + 2 , NULL , 10 );
149150 const char * name = NULL ;
150151
@@ -189,6 +190,7 @@ static void detectMediaTek(FFCPUResult* cpu)
189190{
190191 // https://en.wikipedia.org/wiki/List_of_MediaTek_systems_on_chips
191192
193+ assert (cpu -> name .length >= 2 );
192194 uint32_t code = (uint32_t ) strtoul (cpu -> name .chars + 2 , NULL , 10 );
193195 const char * name = NULL ;
194196
@@ -225,18 +227,26 @@ static void detectAndroid(FFCPUResult* cpu)
225227 {
226228 if (ffSettingsGetAndroidProperty ("ro.soc.model" , & cpu -> name ))
227229 ffStrbufClear (& cpu -> vendor ); // We usually detect the vendor of CPU core as ARM, but instead we want the vendor of SOC
228- else if (ffSettingsGetAndroidProperty ("ro.mediatek.platform" , & cpu -> name ))
229- ffStrbufSetStatic (& cpu -> vendor , "MTK" );
230230 }
231231 if (cpu -> vendor .length == 0 )
232232 {
233233 if (!ffSettingsGetAndroidProperty ("ro.soc.manufacturer" , & cpu -> vendor ))
234- ffSettingsGetAndroidProperty ("ro.product.product.manufacturer" , & cpu -> vendor );
234+ if (!ffSettingsGetAndroidProperty ("ro.product.product.manufacturer" , & cpu -> vendor ))
235+ if (!ffSettingsGetAndroidProperty ("ro.product.vendor.manufacturer" , & cpu -> vendor ))
236+ if (ffSettingsGetAndroidProperty ("ro.mediatek.platform" , & cpu -> name ))
237+ ffStrbufSetStatic (& cpu -> vendor , "MediaTek" );
235238 }
236239
237- if (ffStrbufEqualS (& cpu -> vendor , "QTI" ) && ffStrbufStartsWithS (& cpu -> name , "SM" ))
240+ if (ffStrbufEqualS (& cpu -> vendor , "QTI" ))
241+ ffStrbufSetStatic (& cpu -> vendor , "Qualcomm" );
242+ else if (ffStrbufIgnCaseEqualS (& cpu -> vendor , "MediaTek" )) // sometimes "Mediatek"
243+ ffStrbufSetStatic (& cpu -> vendor , "MediaTek" );
244+ else if (cpu -> vendor .length > 0 )
245+ cpu -> vendor .chars [0 ] = (char ) toupper (cpu -> vendor .chars [0 ]);
246+
247+ if (ffStrbufEqualS (& cpu -> vendor , "Qualcomm" ) && ffStrbufStartsWithS (& cpu -> name , "SM" ))
238248 detectQualcomm (cpu );
239- else if (ffStrbufEqualS (& cpu -> vendor , "MTK " ) && ffStrbufStartsWithS (& cpu -> name , "MT" ))
249+ else if (ffStrbufEqualS (& cpu -> vendor , "MediaTek " ) && ffStrbufStartsWithS (& cpu -> name , "MT" ))
240250 detectMediaTek (cpu );
241251}
242252#endif
0 commit comments