Fix dualsim for some Huawei phones (#143)

* Fix dualsim for some Huawei phones

Huawei P20 Lite doesn't have /odm/phone.prop, we must use /vendor/phone.prop
This commit is contained in:
washinson 2020-01-14 12:40:43 +03:00 committed by Pierre-Hugues Husson
parent 656465ab76
commit 73b20785b8

View File

@ -464,9 +464,12 @@ if [ "$has_hostapd" = false ];then
fi
#Weird /odm/phone.prop Huawei stuff
if [ -f /odm/phone.prop ];then
HW_PRODID="$(sed -nE 's/.*productid=([0-9x]*).*/\1/p' /proc/cmdline)"
if [ -n "$HW_PRODID" ];then
eval "$(awk 'BEGIN { a=0 }; /\[.*\].*/ { a=0 }; tolower($0) ~ /.*0x39606014.*/ { a=1 }; /.*=.*/ { if(a == 1) print $0 }' /odm/phone.prop |sed -nE 's/(.*)=(.*)/setprop \1 "\2";/p')"
HW_PRODID="$(sed -nE 's/.*productid=([0-9xa-f]*).*/\1/p' /proc/cmdline)"
[ -z "$HW_PRODID" ] && HW_PRODID="0x$(od -A none -t x1 /sys/firmware/devicetree/base/hisi,modem_id | sed s/' '//g)"
for part in odm vendor;do
if [ -f /$part/phone.prop ];then
if [ -n "$HW_PRODID" ];then
eval "$(awk 'BEGIN { a=0 }; /\[.*\].*/ { a=0 }; tolower($0) ~ /.*'"$HW_PRODID"'.*/ { a=1 }; /.*=.*/ { if(a == 1) print $0 }' /$part/phone.prop |sed -nE 's/(.*)=(.*)/setprop \1 "\2";/p')"
fi
fi
fi
done