diff options
author | guaiyihu <guaiyihu@foxmail.com> | 2018-06-18 17:03:14 +0800 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-04-30 00:48:53 +0300 |
commit | 101067422561daf32c42b1075f0dcdd68ed14854 (patch) | |
tree | aebd4fcc0e1e397dce40cc6e14ec8130a860f9c6 | |
parent | 5e78e173b4b225aa6fc22fc7243280920aa2e596 (diff) |
sdm660-common: rootdir: Set MTP product name dynamically
Change-Id: I3af1f3ea3bd15a20e7623fcb5078e585619c1564
-rw-r--r-- | rootdir/bin/init.qcom.usb.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/rootdir/bin/init.qcom.usb.sh b/rootdir/bin/init.qcom.usb.sh index 28e8324..b332530 100644 --- a/rootdir/bin/init.qcom.usb.sh +++ b/rootdir/bin/init.qcom.usb.sh @@ -174,12 +174,15 @@ fi # check configfs is mounted or not if [ -d /config/usb_gadget ]; then - # Chip-serial is used for unique MSM identification in Product string - msm_serial=`cat /sys/devices/soc0/serial_number`; - msm_serial_hex=`printf %08X $msm_serial` - machine_type=`cat /sys/devices/soc0/machine` - product_string="$machine_type-$soc_hwplatform _SN:$msm_serial_hex" - echo "$product_string" > /config/usb_gadget/g1/strings/0x409/product + product_string=`cat /config/usb_gadget/g1/strings/0x409/product` 2> /dev/null + if [ "product_string" == "" ]; then + # Chip-serial is used for unique MSM identification in Product string + msm_serial=`cat /sys/devices/soc0/serial_number`; + msm_serial_hex=`printf %08X $msm_serial` + machine_type=`cat /sys/devices/soc0/machine` + product_string="$machine_type-$soc_hwplatform _SN:$msm_serial_hex" + echo "$product_string" > /config/usb_gadget/g1/strings/0x409/product + fi # ADB requires valid iSerialNumber; if ro.serialno is missing, use dummy serialnumber=`cat /config/usb_gadget/g1/strings/0x409/serialnumber 2> /dev/null` |