pstar: add initial device specific rootdir
This commit is contained in:
parent
39edadedcd
commit
cb1aae3e9d
5 changed files with 445 additions and 0 deletions
84
rootdir/bin/init.oem.fingerprint.overlay.sh
Executable file
84
rootdir/bin/init.oem.fingerprint.overlay.sh
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
#!/vendor/bin/sh
|
||||
#
|
||||
# Identify fingerprint sensor model
|
||||
#
|
||||
# Copyright (c) 2019 Lenovo
|
||||
# All rights reserved.
|
||||
#
|
||||
# Changed Log:
|
||||
# ---------------------------------
|
||||
# April 15, 2019 chengql2@lenovo.com Initial version
|
||||
# April 28, 2019 chengql2 Add fps_id creating step
|
||||
# December 2, 2019 chengql2 Store fps_id into persist fs, and identify sensor
|
||||
# again when secure unit boots as factory mode.
|
||||
|
||||
script_name=${0##*/}
|
||||
script_name=${script_name%.*}
|
||||
function log {
|
||||
echo "$script_name: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
persist_fps_id=/mnt/vendor/persist/fps/vendor_id
|
||||
|
||||
FPS_VENDOR_GOODIX=goodix
|
||||
FPS_VENDOR_FPC=fpc
|
||||
FPS_VENDOR_NONE=none
|
||||
|
||||
PROP_FPS_IDENT=vendor.hw.fps.ident
|
||||
MAX_TIMES=20
|
||||
|
||||
function ident_fps {
|
||||
log "- install FPC driver"
|
||||
insmod /vendor/lib/modules/fpc1020_mmi.ko
|
||||
sleep 1
|
||||
log "- identify FPC sensor"
|
||||
setprop $PROP_FPS_IDENT ""
|
||||
start fpc_ident
|
||||
for i in $(seq 1 $MAX_TIMES)
|
||||
do
|
||||
sleep 0.1
|
||||
ident_status=$(getprop $PROP_FPS_IDENT)
|
||||
log "-result : $ident_status"
|
||||
if [ $ident_status == $FPS_VENDOR_FPC ]; then
|
||||
log "ok"
|
||||
echo $FPS_VENDOR_FPC > $persist_fps_id
|
||||
return 0
|
||||
elif [ $ident_status == $FPS_VENDOR_NONE ]; then
|
||||
log "fail"
|
||||
log "- unload FPC driver"
|
||||
rmmod fpc1020_mmi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
log "- install Goodix driver"
|
||||
insmod /vendor/lib/modules/goodix_fod_mmi.ko
|
||||
echo $FPS_VENDOR_GOODIX > $persist_fps_id
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ ! -f $persist_fps_id ]; then
|
||||
ident_fps
|
||||
return $?
|
||||
fi
|
||||
|
||||
fps_vendor=$(cat $persist_fps_id)
|
||||
if [ -z $fps_vendor ]; then
|
||||
fps_vendor=$FPS_VENDOR_NONE
|
||||
fi
|
||||
log "FPS vendor: $fps_vendor"
|
||||
|
||||
if [ $fps_vendor == $FPS_VENDOR_GOODIX ]; then
|
||||
log "- install Goodix driver"
|
||||
insmod /vendor/lib/modules/goodix_fod_mmi.ko
|
||||
return $?
|
||||
fi
|
||||
|
||||
if [ $fps_vendor == $FPS_VENDOR_FPC ]; then
|
||||
log "- install FPC driver"
|
||||
insmod /vendor/lib/modules/fpc1020_mmi.ko
|
||||
return $?
|
||||
fi
|
||||
|
||||
ident_fps
|
||||
return $?
|
||||
123
rootdir/bin/init.oem.fingerprint2.sh
Executable file
123
rootdir/bin/init.oem.fingerprint2.sh
Executable file
|
|
@ -0,0 +1,123 @@
|
|||
#!/vendor/bin/sh
|
||||
#
|
||||
# Start indicated fingerprint HAL service
|
||||
#
|
||||
# Copyright (c) 2019 Lenovo
|
||||
# All rights reserved.
|
||||
#
|
||||
# April 15, 2019 chengql2@lenovo.com Initial version
|
||||
# December 2, 2019 chengql2 Store fps_id into persist fs
|
||||
|
||||
script_name=${0##*/}
|
||||
script_name=${script_name%.*}
|
||||
function log {
|
||||
echo "$script_name: $*" > /dev/kmsg
|
||||
}
|
||||
|
||||
persist_fps_id=/mnt/vendor/persist/fps/vendor_id
|
||||
persist_fps_id2=/mnt/vendor/persist/fps/last_vendor_id
|
||||
MAX_TIMES=100
|
||||
|
||||
if [ ! -f $persist_fps_id ]; then
|
||||
log "warn: no associated persist file found"
|
||||
return -1
|
||||
fi
|
||||
FPS_VENDOR_NONE=none
|
||||
FPS_VENDOR_GOODIX=goodix
|
||||
FPS_VENDOR_FPC=fpc
|
||||
|
||||
prop_fps_status=vendor.hw.fingerprint.status
|
||||
prop_persist_fps=persist.vendor.hardware.fingerprint
|
||||
|
||||
FPS_STATUS_NONE=none
|
||||
FPS_STATUS_OK=ok
|
||||
|
||||
fps_vendor2=$(cat $persist_fps_id2)
|
||||
if [ -z $fps_vendor2 ]; then
|
||||
fps_vendor2=$FPS_VENDOR_NONE
|
||||
fi
|
||||
log "FPS vendor (last): $fps_vendor2"
|
||||
fps_vendor=$(cat $persist_fps_id)
|
||||
if [ -z $fps_vendor ]; then
|
||||
fps_vendor=$FPS_VENDOR_NONE
|
||||
fi
|
||||
log "FPS vendor: $fps_vendor"
|
||||
|
||||
if [ $fps_vendor == $FPS_STATUS_NONE ]; then
|
||||
log "warn: boot as the last FPS"
|
||||
fps=$fps_vendor2
|
||||
else
|
||||
fps=$fps_vendor
|
||||
fi
|
||||
|
||||
for i in $(seq 1 2)
|
||||
do
|
||||
|
||||
setprop $prop_fps_status $FPS_STATUS_NONE
|
||||
if [ $fps == $FPS_VENDOR_FPC ]; then
|
||||
log "start fps_hal"
|
||||
start fps_hal
|
||||
else
|
||||
log "start goodix_hal"
|
||||
start goodix_hal
|
||||
fi
|
||||
|
||||
log "wait for HAL finish ..."
|
||||
fps_status=$(getprop $prop_fps_status)
|
||||
for ii in $(seq 1 $MAX_TIMES)
|
||||
do
|
||||
# log "check fps vendor status: $fps_status"
|
||||
if [ $fps_status != $FPS_STATUS_NONE ]; then
|
||||
break
|
||||
fi
|
||||
sleep 0.2
|
||||
fps_status=$(getprop $prop_fps_status)
|
||||
done
|
||||
log "fingerprint HAL status: $fps_status"
|
||||
|
||||
if [ $fps_status == $FPS_STATUS_OK ]; then
|
||||
log "HAL success"
|
||||
setprop $prop_persist_fps $fps
|
||||
if [ $fps_vendor2 == $fps ]; then
|
||||
return 0
|
||||
fi
|
||||
log "- update FPS vendor (last)"
|
||||
echo $fps > $persist_fps_id2
|
||||
log "- done"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $fps == $fps_vendor2 ]; then
|
||||
if [ $fps == $FPS_VENDOR_FPC ]; then
|
||||
rmmod fpc1020_mmi
|
||||
sleep 0.1
|
||||
stop fps_hal
|
||||
sleep 0.1
|
||||
insmod /vendor/lib/modules/goodix_fod_mmi.ko
|
||||
fps=$FPS_VENDOR_GOODIX
|
||||
else
|
||||
rmmod goodix_fod_mmi
|
||||
sleep 0.1
|
||||
stop goodix_hal
|
||||
sleep 0.1
|
||||
insmod /vendor/lib/modules/fpc1020_mmi.ko
|
||||
fps=$FPS_VENDOR_FPC
|
||||
fi
|
||||
log "- update FPS vendor"
|
||||
echo $fps > $persist_fps_id
|
||||
sleep 1
|
||||
else
|
||||
log "error: HAL fail unload ko"
|
||||
if [ $fps == $FPS_VENDOR_FPC ]; then
|
||||
rmmod fpc1020_mmi
|
||||
else
|
||||
rmmod goodix_fod_mmi
|
||||
fi
|
||||
setprop $prop_persist_fps $FPS_VENDOR_NONE
|
||||
echo $FPS_VENDOR_NONE > $persist_fps_id
|
||||
|
||||
log "- done"
|
||||
return 1
|
||||
fi
|
||||
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue